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

Fix method table override #2191

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Enzyme"
uuid = "7da242da-08ed-463a-9acd-ee780be4f1d9"
authors = ["William Moses <[email protected]>", "Valentin Churavy <[email protected]>"]
version = "0.13.21"
version = "0.13.22"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
7 changes: 3 additions & 4 deletions src/compiler/interpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ struct EnzymeInterpreter{T} <: AbstractInterpreter
else
code_cache::CodeCache
end
method_table::Union{Nothing,Core.MethodTable}
method_table::Core.Compiler.MethodTableView

# Cache of inference results for this particular interpreter
local_cache::Vector{InferenceResult}
Expand Down Expand Up @@ -201,7 +201,7 @@ function EnzymeInterpreter(

return EnzymeInterpreter(
cache_or_token,
mt,
mt == nothing ? Core.Compiler.InternalMethodTable(world) : Core.Compiler.OverlayMethodTable(world, mt),

# Initially empty cache
Vector{InferenceResult}(),
Expand Down Expand Up @@ -253,8 +253,7 @@ Core.Compiler.may_compress(@nospecialize(::EnzymeInterpreter)) = true
Core.Compiler.may_discard_trees(@nospecialize(::EnzymeInterpreter)) = false
Core.Compiler.verbose_stmt_info(@nospecialize(::EnzymeInterpreter)) = false

Core.Compiler.method_table(@nospecialize(interp::EnzymeInterpreter), sv::InferenceState) =
Core.Compiler.OverlayMethodTable(interp.world, interp.method_table)
Core.Compiler.method_table(@nospecialize(interp::EnzymeInterpreter)) = interp.method_table

function is_alwaysinline_func(@nospecialize(TT))::Bool
isa(TT, DataType) || return false
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ end
end

@inline function has_method(@nospecialize(sig::Type), world::UInt, mt::Core.Compiler.OverlayMethodTable)
return has_method(sig, mt.mt, mt.world) || has_method(sig, nothing, mt.world)
return has_method(sig, mt.world, mt.mt) || has_method(sig, mt.world, nothing)
end

@inline function is_inactive(@nospecialize(tys::Union{Vector{Union{Type,Core.TypeofVararg}}, Core.SimpleVector}), world::UInt, @nospecialize(mt))
Expand Down
Loading