Skip to content

Commit

Permalink
tell the serializer to not cache code instances originating from Enzyme
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored and wsmoses committed Aug 4, 2024
1 parent 493b50a commit 3697135
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/compiler/interpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3697135

Please sign in to comment.