Skip to content

Commit e8d6bfc

Browse files
committed
Provide JuliaContext to GPUCompiler.codegen
1 parent 60fe2aa commit e8d6bfc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/StaticCompiler.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
@@ -448,7 +449,9 @@ end
448449
# Return an LLVM module
449450
function 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
453456
end
454457

0 commit comments

Comments
 (0)