-
Notifications
You must be signed in to change notification settings - Fork 29
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
use AbstractInterpreter interface #4
Merged
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
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
from
August 4, 2020 17:35
16a6e23
to
d431350
Compare
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
from
August 5, 2020 00:48
2cc2cc5
to
89f7c9f
Compare
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
from
August 5, 2020 13:42
588b195
to
9eae440
Compare
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
2 times, most recently
from
August 6, 2020 12:37
00da6f5
to
67ad8cb
Compare
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
from
August 6, 2020 12:40
67ad8cb
to
eeb83f5
Compare
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
from
August 6, 2020 18:03
eeb83f5
to
47fbbc9
Compare
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
3 times, most recently
from
August 6, 2020 18:25
de449da
to
a2e121e
Compare
Backedges shouldn't be used for abstract call stack traversal -- it turns out |
use `InferenceState.parent` instead of `MethodInstances.backedges` for abstract call stack traversal
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
from
August 7, 2020 16:43
a2e121e
to
41e479c
Compare
aviatesk
force-pushed
the
avi/newcompilerinterface
branch
from
August 7, 2020 16:52
41e479c
to
4197131
Compare
aviatesk
added a commit
that referenced
this pull request
May 4, 2021
WIP because I found this is better to be generalized to a control flow analysis that checks for "never reaching exit points". For As an example, `sum(a for a in NeverTeminate(::Int))` will come down to `Base._fold_impl`, which directly uses `iterate(::NeverTeminate, [state])`, against which the current implementation based on the iteration protocol can't report an error. > Adapated from https://github.com/JuliaLang/julia/blob/24d9eab45632bdb3120c9e664503745eb58aa2d6/base/reduce.jl#L53-L65 ```julia function _foldl_impl(op::OP, init, itr) where {OP} # Unroll the while loop once; if init is known, the call to op may # be evaluated at compile time y = iterate(itr) y === nothing && return init v = op(init, y[1]) while true y = iterate(itr, y[2]) y === nothing && break v = op(v, y[1]) end return v end ``` > In a lowered representation ```julia CodeInfo( 1 ─ Core.NewvarNode(:(v)) │ y = Base.iterate(itr) │ %3 = y === Base.nothing └── goto #3 if not %3 2 ─ return init 3 ─ %6 = Base.getindex(y, 1) └── v = (op)(init, %6) 4 ┄ goto #8 if not true 5 ─ %9 = Base.getindex(y, 2) │ y = Base.iterate(itr, %9) │ %11 = y === Base.nothing └── goto #7 if not %11 6 ─ goto #8 7 ─ %14 = v │ %15 = Base.getindex(y, 1) │ v = (op)(%14, %15) └── goto #4 8 ┄ return v ) ``` We can report infinite iteration by checking both `goto #3 if not %3` and `goto #7 if not %11` never happens and thus this function never returns. --- - closes #135 - closes #179
aviatesk
added a commit
that referenced
this pull request
May 6, 2021
WIP because I found this is better to be generalized to a control flow analysis that checks for "never reaching exit points". For As an example, `sum(a for a in NeverTeminate(::Int))` will come down to `Base._fold_impl`, which directly uses `iterate(::NeverTeminate, [state])`, against which the current implementation based on the iteration protocol can't report an error. > Adapated from https://github.com/JuliaLang/julia/blob/24d9eab45632bdb3120c9e664503745eb58aa2d6/base/reduce.jl#L53-L65 ```julia function _foldl_impl(op::OP, init, itr) where {OP} # Unroll the while loop once; if init is known, the call to op may # be evaluated at compile time y = iterate(itr) y === nothing && return init v = op(init, y[1]) while true y = iterate(itr, y[2]) y === nothing && break v = op(v, y[1]) end return v end ``` > In a lowered representation ```julia CodeInfo( 1 ─ Core.NewvarNode(:(v)) │ y = Base.iterate(itr) │ %3 = y === Base.nothing └── goto #3 if not %3 2 ─ return init 3 ─ %6 = Base.getindex(y, 1) └── v = (op)(init, %6) 4 ┄ goto #8 if not true 5 ─ %9 = Base.getindex(y, 2) │ y = Base.iterate(itr, %9) │ %11 = y === Base.nothing └── goto #7 if not %11 6 ─ goto #8 7 ─ %14 = v │ %15 = Base.getindex(y, 1) │ v = (op)(%14, %15) └── goto #4 8 ┄ return v ) ``` We can report infinite iteration by checking both `goto #3 if not %3` and `goto #7 if not %11` never happens and thus this function never returns. --- - closes #135 - closes #179
aviatesk
added a commit
that referenced
this pull request
May 10, 2021
WIP because I found this is better to be generalized to a control flow analysis that checks for "never reaching exit points". For As an example, `sum(a for a in NeverTeminate(::Int))` will come down to `Base._fold_impl`, which directly uses `iterate(::NeverTeminate, [state])`, against which the current implementation based on the iteration protocol can't report an error. > Adapated from https://github.com/JuliaLang/julia/blob/24d9eab45632bdb3120c9e664503745eb58aa2d6/base/reduce.jl#L53-L65 ```julia function _foldl_impl(op::OP, init, itr) where {OP} # Unroll the while loop once; if init is known, the call to op may # be evaluated at compile time y = iterate(itr) y === nothing && return init v = op(init, y[1]) while true y = iterate(itr, y[2]) y === nothing && break v = op(v, y[1]) end return v end ``` > In a lowered representation ```julia CodeInfo( 1 ─ Core.NewvarNode(:(v)) │ y = Base.iterate(itr) │ %3 = y === Base.nothing └── goto #3 if not %3 2 ─ return init 3 ─ %6 = Base.getindex(y, 1) └── v = (op)(init, %6) 4 ┄ goto #8 if not true 5 ─ %9 = Base.getindex(y, 2) │ y = Base.iterate(itr, %9) │ %11 = y === Base.nothing └── goto #7 if not %11 6 ─ goto #8 7 ─ %14 = v │ %15 = Base.getindex(y, 1) │ v = (op)(%14, %15) └── goto #4 8 ┄ return v ) ``` We can report infinite iteration by checking both `goto #3 if not %3` and `goto #7 if not %11` never happens and thus this function never returns. --- - closes #135 - closes #179
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.
The final object of this PR is to allow TP to profile even when there are abstract inferred types in profiling.