-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-128563: A new tail-calling interpreter #128718
Conversation
|
When you're done making the requested changes, leave the comment: |
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
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.
Looks good.
The dispatching mechanism is now distinct from the actions, even in the generated code, which is nice.
Just one quibble, but that can be done in another PR if you want.
Do we have up to date performance numbers?
No need to do that before merging, but it would be good to have the performance impact on record.
Lib/test/test_generated_cases.py
Outdated
| @@ -304,6 +304,10 @@ def test_inst_no_args(self): | |||
| """ | |||
| output = """ | |||
| TARGET(OP) { | |||
| int opcode = OP; | |||
| (void)(opcode); | |||
| _Py_CODEUNIT* const this_instr = next_instr; | |||
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.
The generated sequence
_Py_CODEUNIT* const this_instr = next_instr;
(void)this_instr;
frame->instr_ptr = next_instr;would be neater as:
_Py_CODEUNIT* const this_instr = next_instr;
frame->instr_ptr = this_instr;
No, but the benchmarking infra can't benchmark this anyways. Because it's opt-in. @mdboom perhaps we could add the configure option now? |
|
@markshannon we can't do the |
|
Great work on this, @Fidget-Spinner! |
Co-authored-by: Garrett Gu <garrettgu777@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Garrett Gu <garrettgu777@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
do these performance improvements affect only eval() or any execution of pyc code? |
The pyc code uses the interpreter too. So any pyc code. |
|
will it be available for Windows users in coming Python-3.14.0a5 ? alphas are for breaking things |
I will add a Windows build option in a follow-up PR, but not in time for a5 I believe. Also, you'd need the clang-cl backend in MSBuild instead of MSVC to get this working. I am currently trying to persuade CPython to move over to clang-cl as it seems there should be no ABI breakage and better performance. faster-cpython/ideas#690 (comment) |


Features:
Preliminary benchmark results here https://github.com/faster-cpython/benchmarking-public/tree/main/results/bm-20250107-3.14.0a3+-f1d3190-CLANG
TLDR (all results are pyperformance, clang-19, with PGO + ThinLTO unless stated otherwise):
More recent benchmark results:
https://github.com/faster-cpython/benchmarking-public/tree/main/results/bm-20250116-3.14.0a4+-df5d01c-CLANG
This initial implementation focuses on correctness. There's still room to improve performance even further. I've detailed performance plans in the original issue.
Changset:
configure.acto auto-detect when we can do this.opcodein the call arguments because it might be modified by instrumented instructions.Credits also to Brandt and Savannah for the JIT workflow file.