-
-
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: backward constraint propagation from call signatures #55229
Conversation
Closes #55115 |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
da15892
to
0b253e9
Compare
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
ed79684
to
b618a9a
Compare
@nanosoldier |
Ok, I fixed all inference performance regressions, and this should be ready to go now. |
This PR implements another (limited) backward analysis pass in abstract interpretation; it exploits signatures of matching methods and refines types of slots. Here are couple of examples where these changes will improve the accuracy: > generic function example ```julia addint(a::Int, b::Int) = a + b @test Base.infer_return_type((Any,Any,)) do a, b c = addint(a, b) return a, b, c # now the compiler understands `a::Int`, `b::Int` end == Tuple{Int,Int,Int} ``` > `typeassert` example ```julia @test Base.infer_return_type((Any,)) do a a::Int return a # now the compiler understands `a::Int` end == Int ``` Unlike `Conditional` constrained type propagation, this type refinement information isn't encoded within any lattice element, but rather they are propagated within the newly added field `frame.curr_stmt_change` of `frame::InferenceState`. For now this commit exploits refinement information available from call signatures of generic functions and `typeassert`.
b618a9a
to
4f25149
Compare
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
Going to merge. Post reviews would be very welcomed, but at the same time we don't need to wait for reviews before merging. |
This doesn't seem like it's been completely effective yet: #55278 |
…aLang#55229) This PR implements another (limited) backward analysis pass in abstract interpretation; it exploits signatures of matching methods and refines types of slots. Here are couple of examples where these changes will improve the accuracy: > generic function example ```julia addint(a::Int, b::Int) = a + b @test Base.infer_return_type((Any,Any,)) do a, b c = addint(a, b) return a, b, c # now the compiler understands `a::Int`, `b::Int` end == Tuple{Int,Int,Int} ``` > `typeassert` example ```julia @test Base.infer_return_type((Any,)) do a a::Int return a # now the compiler understands `a::Int` end == Int ``` Unlike `Conditional` constrained type propagation, this type refinement information isn't encoded within any lattice element, but rather they are propagated within the newly added field `frame.curr_stmt_change` of `frame::InferenceState`. For now this commit exploits refinement information available from call signatures of generic functions and `typeassert`. --- - closes JuliaLang#37866 - fixes JuliaLang#38274 - closes JuliaLang#55115
This PR implements another (limited) backward analysis pass in abstract interpretation; it exploits signatures of matching methods and refines types of slots.
Here are couple of examples where these changes will improve the accuracy:
Unlike
Conditional
constrained type propagation, this type refinement information isn't encoded within any lattice element, but rather they are propagated within the newly added fieldframe.curr_stmt_change
offrame::InferenceState
.For now this commit exploits refinement information available from call signatures of generic functions and
typeassert
.