@@ -141,8 +141,9 @@ function generate_obj(f, tt, path::String = tempname(), name = GPUCompiler.safe_
141141 tm = GPUCompiler. llvm_machine (NativeCompilerTarget ())
142142 job, kwargs = native_job (f, tt; name, kwargs... )
143143 # Get LLVM to generated a module of code for us. We don't want GPUCompiler's optimization passes.
144- mod, meta = GPUCompiler. codegen (:llvm , job; strip= strip_llvm, only_entry= false , validate= false , optimize= false )
145-
144+ mod, meta = GPUCompiler. JuliaContext () do context
145+ GPUCompiler. codegen (:llvm , job; strip= strip_llvm, only_entry= false , validate= false , optimize= false , ctx= context)
146+ end
146147 # Use Enzyme's annotation and optimization pipeline
147148 annotate! (mod)
148149 optimize! (mod, tm)
448449# Return an LLVM module
449450function native_llvm_module (f, tt, name = GPUCompiler. safe_name (repr (f)); kwargs... )
450451 job, kwargs = native_job (f, tt; name, kwargs... )
451- m, _ = GPUCompiler. codegen (:llvm , job; strip= true , only_entry= false , validate= false )
452+ m, _ = GPUCompiler. JuliaContext () do context
453+ GPUCompiler. codegen (:llvm , job; strip= true , only_entry= false , validate= false , ctx= context)
454+ end
452455 return m
453456end
454457
0 commit comments