Skip to content

Commit

Permalink
Fix method table override (#2191)
Browse files Browse the repository at this point in the history
* Fix method table override

* fix

* fix

---------

Co-authored-by: William Moses <wsmoses@cyclops.juliacomputing.io>
  • Loading branch information
wsmoses and William Moses authored Dec 10, 2024
1 parent 1d3b801 commit 7c0823f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
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 <wmoses@mit.edu>", "Valentin Churavy <vchuravy@mit.edu>"]
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

2 comments on commit 7c0823f

@wsmoses
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/121145

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.13.22 -m "<description of version>" 7c0823fa64426a745dae8fc7a50980be0a0a8dc8
git push origin v0.13.22

Please sign in to comment.