-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AbstractInterpreter
: enable selective pure/concrete eval for extern…
…al `AbstractInterpreter` with overlayed method table Built on top of #44511 and #44561, and solves <JuliaGPU/GPUCompiler.jl#309>. This commit allows external `AbstractInterpreter` to selectively use pure/concrete evals even if it uses an overlayed method table. More specifically, such `AbstractInterpreter` can use pure/concrete evals as far as any callees used in a call in question doesn't come from the overlayed method table: ```julia @test Base.return_types((), MTOverlayInterp()) do isbitstype(Int) ? nothing : missing end == Any[Nothing] Base.@assume_effects :terminates_globally function issue41694(x) res = 1 1 < x < 20 || throw("bad") while x > 1 res *= x x -= 1 end return res end @test Base.return_types((), MTOverlayInterp()) do issue41694(3) == 6 ? nothing : missing end == Any[Nothing] ``` In order to check if a call is tainted by any overlayed call, our effect system now additionally tracks `overlayed::Bool` property. This effect property is required to prevents concrete-eval in the following kind of situation: ```julia strangesin(x) = sin(x) @overlay OverlayedMT strangesin(x::Float64) = iszero(x) ? nothing : cos(x) Base.@assume_effects :total totalcall(f, args...) = f(args...) @test Base.return_types(; interp=MTOverlayInterp()) do # we need to disable partial pure/concrete evaluation when tainted by any overlayed call if totalcall(strangesin, 1.0) == cos(1.0) return nothing else return missing end end |> only === Nothing ```
- Loading branch information
Showing
6 changed files
with
145 additions
and
85 deletions.
There are no files selected for viewing
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
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
Oops, something went wrong.