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

Cache inference #2141

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Cache inference #2141

wants to merge 2 commits into from

Conversation

wsmoses
Copy link
Member

@wsmoses wsmoses commented Nov 29, 2024

No description provided.

Copy link
Contributor

github-actions bot commented Nov 29, 2024

Benchmark Results

main 3180acd... main/3180acd4ac61e7...
basics/overhead 4.34 ± 0.001 ns 4.34 ± 0.01 ns 1
time_to_load 1.09 ± 0.006 s 1.09 ± 0.071 s 1

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@wsmoses wsmoses requested a review from vchuravy November 29, 2024 07:33
@@ -55,7 +74,8 @@ function EnzymeInterpreter(
reverse_rules::Bool,
deferred_lower::Bool = true,
broadcast_rewrite::Bool = true,
handler = nothing
handler = nothing,
local_cache = get_or_create_inference_cache(world, forward_rules, reverse_rules, deferred_lower, broadcast_rewrite, handler)
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, the local_cache ought to be ephermal and can't be shared across multiple abstract interpreter instances.

cc: @aviatesk

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah but in this case we actually are effectively caching the absint itself (since all data about it is in the key)

Copy link
Member

Choose a reason for hiding this comment

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

All caches that ought to survive the absint go into the global cache?

sv::AbsIntState,
max_methods::Int,
)
ret = Core.invoke(Core.Compiler.abstract_call_gf_by_type, Tuple{AbstractInterpreter, Any, ArgInfo, StmtInfo, Any, AbsIntState, Int}, interp, f, arginfo, si, atype, sv, max_methods)
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

We were spending a huge amount of runtime on that function (which appears to compile as jl_invoke). Tried playing around with to fix to no avail

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this change doesn't do anything.

Copy link
Member

@vchuravy vchuravy left a comment

Choose a reason for hiding this comment

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

Unsure that this is correct.

@wsmoses
Copy link
Member Author

wsmoses commented Nov 30, 2024

I spoke with @aviatesk and I think this is fine, but also sadly this did not resolve the issue”we spend like 50 mins in absint” problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants