@@ -13,82 +13,20 @@ function return_type(interp::Core.Compiler.AbstractInterpreter, mi::Core.MethodI
1313 end
1414end
1515
16- function primal_interp_world (
17- @nospecialize (:: ReverseMode ),
18- world:: UInt
19- )
20- mode = Enzyme. API. DEM_ReverseModeCombined
21-
22- CT = @static if VERSION >= v " 1.11.0-DEV.1552"
23- EnzymeCacheToken (
24- typeof (DefaultCompilerTarget ()),
25- false ,
26- GPUCompiler. GLOBAL_METHOD_TABLE, #= job.config.always_inline=#
27- EnzymeCompilerParams,
28- world,
29- false ,
30- true ,
31- true
32- )
33- else
34- Enzyme. Compiler. GLOBAL_REV_CACHE
35- end
36-
37- Enzyme. Compiler. Interpreter. EnzymeInterpreter (CT, nothing , world, mode, true )
16+ function primal_interp_world (mode:: Enzyme.API.CDerivativeMode , world, mi)
17+ target = Compiler. DefaultCompilerTarget ()
18+ params = PrimalCompilerParams (mode)
19+ job = GPUCompiler. CompilerJob (mi, GPUCompiler. CompilerConfig (target, params), world)
20+ return GPUCompiler. get_interpreter (job)
3821end
3922
40- function primal_interp_world (
41- @nospecialize (:: ForwardMode ),
42- world:: UInt
43- )
44- mode = Enzyme. API. DEM_ForwardMode
45-
46- CT = @static if VERSION >= v " 1.11.0-DEV.1552"
47- EnzymeCacheToken (
48- typeof (DefaultCompilerTarget ()),
49- false ,
50- GPUCompiler. GLOBAL_METHOD_TABLE, #= job.config.always_inline=#
51- EnzymeCompilerParams,
52- world,
53- true ,
54- false ,
55- true
56- )
57- else
58- Enzyme. Compiler. GLOBAL_FWD_CACHE
59- end
23+ primal_interp_world (mode:: Mode , world, mi) = primal_interp_world (convert (Enzyme. API. CDerivativeMode, mode), world, mi)
6024
61- Enzyme. Compiler. Interpreter. EnzymeInterpreter (CT, nothing , world, mode, true )
62- end
63-
64- @inline primal_interp_world (
65- @nospecialize (:: ReverseModeSplit ),
66- world:: UInt ) = primal_interp_world (Reverse, world)
67-
68- function primal_return_type_world (
69- @nospecialize (mode:: Mode ),
70- world:: UInt ,
71- @nospecialize (TT:: Type ),
72- )
73- Core. Compiler. _return_type (primal_interp_world (mode, world), TT)
74- end
75-
76- function primal_return_type_world (
77- @nospecialize (mode:: Mode ),
78- world:: UInt ,
79- mi:: Core.MethodInstance ,
80- )
81- interp = primal_interp_world (mode, world)
25+ function primal_return_type_world (mode, world, mi)
26+ interp = primal_interp_world (mode, world, mi)
8227 return_type (interp, mi)
8328end
8429
85- primal_return_type_world (
86- @nospecialize (mode:: Mode ),
87- world:: UInt ,
88- @nospecialize (FT:: Type ),
89- @nospecialize (TT:: Type ),
90- ) = primal_return_type_world (mode, world, Tuple{FT, TT. parameters... })
91-
9230function primal_return_type end
9331
9432function primal_return_type_generator (world:: UInt , source, self, @nospecialize (mode:: Type ), @nospecialize (ft:: Type ), @nospecialize (tt:: Type ))
0 commit comments