diff --git a/src/compiler/interpreter.jl b/src/compiler/interpreter.jl index e1652c5895..cd231abb66 100644 --- a/src/compiler/interpreter.jl +++ b/src/compiler/interpreter.jl @@ -68,6 +68,19 @@ else Core.Compiler.code_cache(interp::EnzymeInterpreter) = WorldView(interp.code_cache, interp.world) end +@static if HAS_INTEGRATED_CACHE + function CC.CodeInstance(interp::EnzymeInterpreter, result::CC.InferenceResult, + valid_worlds::CC.WorldRange) + ci = @invoke CC.CodeInstance(interp::CC.AbstractInterpreter, result::CC.InferenceResult, + valid_worlds::CC.WorldRange) + + # FIXME: Enzyme embeds global pointers and other fun things directly + # So forbid the caching of the results. + ci.relocatability = 0x0 + return ci + end +end + # No need to do any locking since we're not putting our results into the runtime cache Core.Compiler.lock_mi_inference(interp::EnzymeInterpreter, mi::MethodInstance) = nothing Core.Compiler.unlock_mi_inference(interp::EnzymeInterpreter, mi::MethodInstance) = nothing