Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for precompilation support #1549

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tell the serializer to not cache code instances originating from Enzyme
vchuravy authored and wsmoses committed Aug 4, 2024
commit 3697135dac208b1bcbeb1ed66f367a261afefb9a
13 changes: 13 additions & 0 deletions src/compiler/interpreter.jl
Original file line number Diff line number Diff line change
@@ -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