-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
inference: don't forget to add backedge for effect-free frame #45017
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now our abstract interpretation system caches two separate lattice properties return type and call effects, and the previous optimization to avoid adding backedge for a frame whose return type is `Any` turns out to be insufficient -- now we also need to make sure that the inferred effects don't provide any useful IPO information. Example: ```julia julia> const CONST_DICT = let d = Dict() for c in 'A':'z' push!(d, c => Int(c)) end d end; julia> Base.@assume_effects :total_may_throw getcharid(c) = CONST_DICT[c]; julia> @noinline callf(f, args...) = f(args...); julia> function entry_to_be_invalidated(c) return callf(getcharid, c) end; julia> @test Base.infer_effects((Char,)) do x entry_to_be_invalidated(x) end |> Core.Compiler.is_concrete_eval_eligible Test Passed julia> @test fully_eliminated(; retval=97) do entry_to_be_invalidated('a') end Test Passed julia> getcharid(c) = CONST_DICT[c]; # now this is not eligible for concrete evaluation julia> @test Base.infer_effects((Char,)) do x entry_to_be_invalidated(x) end |> !Core.Compiler.is_concrete_eval_eligible Test Failed at REPL[10]:1 Expression: Base.infer_effects((Char,)) do x entry_to_be_invalidated(x) end |> !(Core.Compiler.is_concrete_eval_eligible) ERROR: There was an error during testing julia> @test !fully_eliminated() do entry_to_be_invalidated('a') end Test Failed at REPL[11]:1 Expression: !(fully_eliminated() do entry_to_be_invalidated('a') end) ERROR: There was an error during testing ```
DilumAluthge
removed
the
merge me
PR is reviewed. Merge when all tests are passing
label
Apr 19, 2022
aviatesk
added a commit
that referenced
this pull request
Apr 19, 2022
Now our abstract interpretation system caches two separate lattice properties return type and call effects, and the previous optimization to avoid adding backedge for a frame whose return type is `Any` turns out to be insufficient -- now we also need to make sure that the inferred effects don't provide any useful IPO information. Example: ```julia julia> const CONST_DICT = let d = Dict() for c in 'A':'z' push!(d, c => Int(c)) end d end; julia> Base.@assume_effects :total_may_throw getcharid(c) = CONST_DICT[c]; julia> @noinline callf(f, args...) = f(args...); julia> function entry_to_be_invalidated(c) return callf(getcharid, c) end; julia> @test Base.infer_effects((Char,)) do x entry_to_be_invalidated(x) end |> Core.Compiler.is_concrete_eval_eligible Test Passed julia> @test fully_eliminated(; retval=97) do entry_to_be_invalidated('a') end Test Passed julia> getcharid(c) = CONST_DICT[c]; # now this is not eligible for concrete evaluation julia> @test Base.infer_effects((Char,)) do x entry_to_be_invalidated(x) end |> !Core.Compiler.is_concrete_eval_eligible Test Failed at REPL[10]:1 Expression: Base.infer_effects((Char,)) do x entry_to_be_invalidated(x) end |> !(Core.Compiler.is_concrete_eval_eligible) ERROR: There was an error during testing julia> @test !fully_eliminated() do entry_to_be_invalidated('a') end Test Failed at REPL[11]:1 Expression: !(fully_eliminated() do entry_to_be_invalidated('a') end) ERROR: There was an error during testing ```
67 tasks
aviatesk
added a commit
to aviatesk/JET.jl
that referenced
this pull request
Apr 19, 2022
aviatesk
added a commit
that referenced
this pull request
Apr 19, 2022
Follows up #45017. We can relax the condition in `add_call_backedges!` for backedge optimization by ignoring the `nonoverlayed` property when the `AbstractInterpreter` doesn't use overlayed method table at all, since the property will never be tainted anyway even if we add a new method later.
aviatesk
added a commit
that referenced
this pull request
Apr 20, 2022
Follows up #45017. We can relax the condition in `add_call_backedges!` for backedge optimization by ignoring the `nonoverlayed` property when the `AbstractInterpreter` doesn't use overlayed method table at all, since the property will never be tainted anyway even if we add a new method later.
aviatesk
added a commit
that referenced
this pull request
Apr 20, 2022
Follows up #45017. We can relax the condition in `add_call_backedges!` for backedge optimization by ignoring the `nonoverlayed` property when the `AbstractInterpreter` doesn't use overlayed method table at all, since the property will never be tainted anyway even if we add a new method later.
aviatesk
added a commit
that referenced
this pull request
Apr 20, 2022
Follows up #45017. We can relax the condition in `add_call_backedges!` for backedge optimization by ignoring the `nonoverlayed` property when the `AbstractInterpreter` doesn't use overlayed method table at all, since the property will never be tainted anyway even if we add a new method later.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now our abstract interpretation system caches two separate lattice
properties return type and call effects, and the previous optimization
to avoid adding backedge for a frame whose return type is
Any
turnsout to be insufficient -- now we also need to make sure that the
inferred effects don't provide any useful IPO information.
Example: