Skip to content

Commit 70e3ffd

Browse files
committed
tell the serializer to not cache code instances originating from Enzyme
1 parent c063f5b commit 70e3ffd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/compiler/interpreter.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ else
6868
Core.Compiler.code_cache(interp::EnzymeInterpreter) = WorldView(interp.code_cache, interp.world)
6969
end
7070

71+
@static if HAS_INTEGRATED_CACHE
72+
function CC.CodeInstance(interp::EnzymeInterpreter, result::CC.InferenceResult,
73+
valid_worlds::CC.WorldRange)
74+
ci = @invoke CC.CodeInstance(interp::CC.AbstractInterpreter, result::CC.InferenceResult,
75+
valid_worlds::CC.WorldRange)
76+
77+
# FIXME: Enzyme embeds global pointers and other fun things directly
78+
# So forbid the caching of the results.
79+
ci.relocatability = 0x0
80+
return ci
81+
end
82+
end
83+
7184
# No need to do any locking since we're not putting our results into the runtime cache
7285
Core.Compiler.lock_mi_inference(interp::EnzymeInterpreter, mi::MethodInstance) = nothing
7386
Core.Compiler.unlock_mi_inference(interp::EnzymeInterpreter, mi::MethodInstance) = nothing

0 commit comments

Comments
 (0)