-
Notifications
You must be signed in to change notification settings - Fork 19
Two JIT admission gates that answered wider than their evidence #1295
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
24 commits
Select commit
Hold shift + click to select a range
a1ab82a
jit: admit the bound-method folds at an inline depth whose guards res…
youknowone b6e8255
jit: inline the receiver type's __getattr__ hook for a missing attribute
youknowone 56a9aec
type call inline: admit the call_fn spelling's PY_NULL receiver slot
youknowone 16872aa
inline diag: list the scanned callee body beside a replay-dirty verdict
youknowone 54d71dd
_abc: port the positive/negative subclass caches
youknowone 325218c
type-call diag: report the fold that gets rewound
youknowone 77aefd2
abort resume: restrict the residual-operand stack image to CALL-famil…
youknowone 2c59d76
getattr hook inline: test the descriptor type exactly and guard w_fun…
youknowone eb21dc4
getattr_hook_fast_path: decline a devolved receiver
youknowone a9403ff
property: take the accessor shortcut only for the exact type
youknowone 6b94842
property: implement the `w_fget?` / `w_fset?` quasi-immutable declara…
youknowone 6152f1d
reconstructed_all_ref_call_stack: drop `call_kw` from the whitelist
youknowone fd5ea02
jit: pin `code?` on the inline arm that emits no value guard
youknowone 8681735
parity: cover the property-accessor and __getattr__-hook callees in t…
youknowone 93b06da
blackhole: mark each multi-frame level's frame finished as it returns
youknowone be73d90
jit: build the loop region from the exception table instead of a pc i…
youknowone 921a655
cranelift: skip the LABEL demoted-ref reload when no later LABEL read…
youknowone d74cb29
Drop the equal-value skip from `w_property_reinit`; propagate _abc ca…
youknowone 1643b38
_abc: hold the registry and both caches in SimpleWeakSet
youknowone d3b521e
jit: admit a type call whose metaclass leaves __call__ alone
youknowone cf19b58
inline diag: name the decline site and the deferred-admit term that r…
youknowone 052b763
_abc: read _get_dump's three `.data` values back from their root slots
youknowone 07ca447
getattr hook inline: cut the trace back when the callee sub-walk decl…
youknowone 7e0240f
Fold three spellings of PYRE_FBW_INLINE_DIAG into the cached gate; fi…
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
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/property_accessor_invalidation.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=0 | ||
| 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=6 | ||
| internal_compile_panics=0 | ||
| loops_aborted=0 | ||
| loops_compiled=6 | ||
| retraces_compiled=0 |
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/property_accessor_invalidation.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=0 | ||
| 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=6 | ||
| internal_compile_panics=0 | ||
| loops_aborted=0 | ||
| loops_compiled=6 | ||
| 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,93 @@ | ||
| # pyre-check: no-cpython | ||
| # `descriptor.py:175 W_Property._immutable_fields_ = ["w_fget?", "w_fset?", | ||
| # "w_fdel?"]`. The `?` is what lets a tracer bake the accessor and equally what | ||
| # registers the invalidation an assignment to the slot owes, so re-initialising | ||
| # an installed property revokes every loop that folded it. | ||
| # | ||
| # CPython is not an oracle for this: its `LOAD_ATTR_PROPERTY` specialization | ||
| # caches `fget` under the receiver type's version alone, and `property.__init__` | ||
| # on an installed descriptor bumps no type's version, so a specialized read | ||
| # keeps answering with the previous getter. Cold, CPython sees the new one — | ||
| # the divergence is the specialization's, and pyre follows pypy's `?` instead. | ||
| # | ||
| # Each rebind happens INSIDE its loop: a read after the loop is interpreted and | ||
| # would not consult what the trace baked. The accessor bodies are residual-free | ||
| # so the folds stand rather than aborting. | ||
| N = 400000 | ||
| SWITCH = N // 2 | ||
|
|
||
|
|
||
| def first_getter(self): | ||
| return 1 | ||
|
|
||
|
|
||
| def second_getter(self): | ||
| return 2 | ||
|
|
||
|
|
||
| def first_setter(self, value): | ||
| self.slot = 1 | ||
|
|
||
|
|
||
| def second_setter(self, value): | ||
| self.slot = 2 | ||
|
|
||
|
|
||
| class Getter: | ||
| x = property(first_getter) | ||
|
|
||
|
|
||
| class Setter: | ||
| slot = 0 | ||
| y = property(None, first_setter) | ||
|
|
||
|
|
||
| def rebind_getter(): | ||
| obj = Getter() | ||
| descr = Getter.__dict__['x'] | ||
| total = 0 | ||
| i = 0 | ||
| while i < N: | ||
| total += obj.x | ||
| if i == SWITCH: | ||
| descr.__init__(second_getter) | ||
| i += 1 | ||
| # SWITCH+1 reads of 1, then N-SWITCH-1 reads of 2. | ||
| print('getter', total) | ||
|
|
||
|
|
||
| def rebind_setter(): | ||
| obj = Setter() | ||
| descr = Setter.__dict__['y'] | ||
| total = 0 | ||
| i = 0 | ||
| while i < N: | ||
| obj.y = i | ||
| total += obj.slot | ||
| if i == SWITCH: | ||
| descr.__init__(None, second_setter) | ||
| i += 1 | ||
| print('setter', total) | ||
|
|
||
|
|
||
| def drop_getter(): | ||
| # The sharper case: the re-init leaves no getter at all, and `W_Property.get` | ||
| # (descriptor.py:224-225) raises rather than calling the old function. | ||
| obj = Getter() | ||
| descr = Getter.__dict__['x'] | ||
| raised = 0 | ||
| i = 0 | ||
| while i < N: | ||
| try: | ||
| obj.x | ||
| except AttributeError: | ||
| raised += 1 | ||
| if i == SWITCH: | ||
| descr.__init__(None) | ||
| i += 1 | ||
| print('dropped', raised) | ||
|
|
||
|
|
||
| rebind_getter() | ||
| rebind_setter() | ||
| drop_getter() |
15 changes: 15 additions & 0 deletions
15
pyre/bench/synth/property_accessor_invalidation.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=0 | ||
| 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=6 | ||
| internal_compile_panics=0 | ||
| loops_aborted=0 | ||
| loops_compiled=6 | ||
| 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
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 50372
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 2713
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 1973
🌐 Web query:
site:github.com/youknowone/pyre "range_ctor_in_loop" "22.2x"💡 Result:
The term "range_ctor_in_loop 22.2x" refers to a specific performance benchmark result observed in the pyre project (a Python JIT implementation) [1]. Specifically, CodSpeed continuous performance benchmarks for the pyre project identified a "nested_loop" workload that achieved a speedup or performance metric associated with the value 22.1–22.2x (often cited in internal tracking or benchmark reports) [1]. In the context of the pyre JIT codebase, research confirms that the project uses benchmarks to measure the impact of JIT optimizations on various loop structures [1][2]. While "range_ctor_in_loop" may appear as a shorthand for a benchmark evaluating the overhead of range object construction within a loop, the primary documentation refers to categorized benchmarks such as "int_loop," "fib_loop," "nested_loop," and "float_loop," which are used to measure JIT efficiency against CPython and PyPy [1][2]. The pyre project has consistently worked on optimizing loop-related performance, including broadening the allow-list for FOR_ITER bodies to include more complex operations [3][4][5].
Citations:
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 15745
🏁 Script executed:
Repository: youknowone/pyre
Length of output: 25023
Align the dynasm benchmark ratio.
Update
23.2xto22.2xsorange_ctor_in_loop.pymatches the benchmark objective for the same gate metric.🤖 Prompt for AI Agents