-
Notifications
You must be signed in to change notification settings - Fork 19
jit: widen the walker CALL_ASSEMBLER fold past four pyre-local declines #1266
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6cafee0
jit: widen the walker CALL_ASSEMBLER fold past four pyre-local declines
youknowone 08f8a14
bench/synth: add a recursion past the unroll bound driven from a loop…
youknowone b4533f9
comments: correct three claims about upstream's recursive-call path
youknowone 0ec1c97
pyjitpl: record why should_inline is kept without callers
youknowone 7c87228
jit: emit the top-level frame's traceback node into the trace
youknowone 26f2983
bench/synth: re-record three improved wasm jit-stats baselines
youknowone 98e4be2
jit: emit the exit-frame traceback node after the vable store-back
youknowone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/recursion_past_unroll_bound_from_loop.cranelift.jitstats
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bridges_compiled=4 | ||
| descr_set_absent=0 | ||
| descr_set_ambiguous=0 | ||
| descr_set_stale_absent=0 | ||
| fbw_blackhole_adopted_multi_frame=0 | ||
| fbw_blackhole_adopted_single_frame=0 | ||
| fbw_rolled_back_with_effects=0 | ||
| fbw_store_journal_rollback_failed=0 | ||
| field_pos_attached_misplaced=0 | ||
| field_pos_spec_misplaced=0 | ||
| guard_failures=651 | ||
| internal_compile_panics=0 | ||
| loops_aborted=0 | ||
| loops_compiled=2 | ||
| retraces_compiled=0 |
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/recursion_past_unroll_bound_from_loop.dynasm.jitstats
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bridges_compiled=4 | ||
| descr_set_absent=0 | ||
| descr_set_ambiguous=0 | ||
| descr_set_stale_absent=0 | ||
| fbw_blackhole_adopted_multi_frame=0 | ||
| fbw_blackhole_adopted_single_frame=0 | ||
| fbw_rolled_back_with_effects=0 | ||
| fbw_store_journal_rollback_failed=0 | ||
| field_pos_attached_misplaced=0 | ||
| field_pos_spec_misplaced=0 | ||
| guard_failures=651 | ||
| internal_compile_panics=0 | ||
| loops_aborted=0 | ||
| loops_compiled=2 | ||
| retraces_compiled=0 |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # pyre-check: max-pypy-ratio=6 | ||
| # A recursion deeper than the inline unroll bound, driven from a loop body. | ||
| # | ||
| # `step` recurses nine frames deep, two past `FBW_MAX_INLINE_RECURSION`, so the | ||
| # walker stops unrolling it and the call has to leave the inline route. What | ||
| # makes this shape distinct from every other recursion fixture is where the | ||
| # call sits: the driver is a `while` body that keeps `total` — a loop-carried | ||
| # operand — on the value stack underneath it. | ||
| # | ||
| # `fib_recursive` and `selfrec_bridge_nontail_promote` do not cover this. There | ||
| # the recursion is itself the hot thing, so the callee owns a compiled loop | ||
| # before any non-inline decision is taken. Here the hot thing is the caller's | ||
| # loop, and the recursion is a callee it reaches; that ordering is what used to | ||
| # leave the call as an interpreter residual for the rest of the run, one frame | ||
| # build and one entry bridge per recursive call. `recursive_call_frame_relocation` | ||
| # holds the neighbouring case, a recursion under a `FOR_ITER` iterator, which | ||
| # stays on the residual path deliberately. | ||
| # | ||
| # `step` carries the accumulator down rather than returning into an addition, so | ||
| # the recursion is a tail call and the caller's stack under it holds only | ||
| # `total`. Arguments stay exact machine integers and the modulus keeps the | ||
| # result in range, so nothing here promotes to a long. | ||
| MOD = 1000003 | ||
|
|
||
|
|
||
| def step(n, acc): | ||
| if n <= 0: | ||
| return acc | ||
| return step(n - 1, acc + n) | ||
|
|
||
|
|
||
| def main(): | ||
| total = 0 | ||
| i = 0 | ||
| while i < 300000: | ||
| total = (total + step(8, i)) % MOD | ||
| i += 1 | ||
| print("recursion_from_loop", total) | ||
|
|
||
|
|
||
| main() | ||
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/recursion_past_unroll_bound_from_loop.wasm.jitstats
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bridges_compiled=4 | ||
| descr_set_absent=0 | ||
| descr_set_ambiguous=0 | ||
| descr_set_stale_absent=0 | ||
| fbw_blackhole_adopted_multi_frame=0 | ||
| fbw_blackhole_adopted_single_frame=0 | ||
| fbw_rolled_back_with_effects=0 | ||
| fbw_store_journal_rollback_failed=0 | ||
| field_pos_attached_misplaced=0 | ||
| field_pos_spec_misplaced=0 | ||
| guard_failures=651 | ||
| internal_compile_panics=0 | ||
| loops_aborted=0 | ||
| loops_compiled=2 | ||
| retraces_compiled=0 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 153
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 49517
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 50374
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 50374
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 46496
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 50371
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 12397
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 50372
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 17208
Add a direct assertion for the recursion-bound transition.
FBW_MAX_INLINE_RECURSIONis 7.step(8, i)creates nine active calls, and the FBW counter excludes the root. The call fromn == 1ton == 0therefore reaches the bound. The aggregate stats do not prove that this call usedCALL_ASSEMBLER; add a bound-hit orCALL_ASSEMBLERcounter to the snapshot gate.🤖 Prompt for AI Agents