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 minimum adjustments to JuliaLang/julia#52233 #612

Merged
merged 1 commit into from
Feb 13, 2024
Merged
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
6 changes: 6 additions & 0 deletions src/abstractinterpret/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ end
# global
# ------

@static if VERSION ≥ v"1.11.0-DEV.1552"
CC.cache_owner(analyzer::AbstractAnalyzer) = AnalysisCache(analyzer)

Choose a reason for hiding this comment

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

I am still not sure if AnalysisCache is the right object here. What needs to be captured is information that changes inference behaviour. See https://github.com/JuliaGPU/GPUCompiler.jl/blob/8d7d9836447c067973a2c90aa4b274a09e7b2b20/src/interface.jl#L223 as an alternative idea.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Actually, AnalysisCache(analyzer) is unique, kind of like how GPUCompilerCacheToken is. The reason is each analyzer computes unique hash based on analysis settings, creating different AnalysisCache objects for different settings:

analysis_cache = get!(AnalysisCache, JET_ANALYZER_CACHE, cache_key)

end

function CC.code_cache(analyzer::AbstractAnalyzer)
view = AbstractAnalyzerView(analyzer)
worlds = WorldRange(get_inference_world(analyzer))
Expand Down Expand Up @@ -225,7 +229,9 @@ end

function CC.setindex!(wvc::WorldView{<:AbstractAnalyzerView}, codeinst::CodeInstance, mi::MethodInstance)
analysis_cache = AnalysisCache(wvc)
@static if VERSION < v"1.11.0-DEV.1552"
add_jet_callback!(mi, analysis_cache)
end
return analysis_cache[mi] = codeinst
end

Expand Down
Loading