Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-131798: JIT: SplitCALL_TYPE_1 into several uops#132419

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
brandtbucher merged 16 commits intopython:mainfromtomasr8:jit-call-type-1
Apr 22, 2025

Conversation

tomasr8
Copy link
Member

@tomasr8tomasr8 commentedApr 11, 2025
edited by bedevere-appbot
Loading

This mostly works now, though the there are now two unused stackref variables inexecutor_cases.c.h (null andcallable) and I'm not sure how to convince the cases generator to remove them. I tried:

  • usingDEAD(x) in the guard uops - does not work because the stack variable also appears in the output of the uop. I also can't easily pop them off the stack since neithernull orcallable is TOS.
  • removingDEAD(x) from_CALL_TYPE_1: not possible, apparently this is needed before I can setres.

I'm out of ideas so if anyone knows how to fix it, I'd love to know :)

sym_set_null(null);
}

op(_GUARD_CALLABLE_TYPE_1, (callable, unused, unused2 -- callable, unused, unused2)) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I am not entirely sure why I cannot do this here:

Suggested change
op(_GUARD_CALLABLE_TYPE_1, (callable,unused,unused2--callable,unused,unused2)) {
op(_GUARD_CALLABLE_TYPE_1, (callable,unused,unused--callable,unused,unused)) {

I getSyntaxError: Duplicate name unused, thoughbytecodes.c allows it 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Weird. Maybeunused isn't a meaningful value here like it is inbytecodes.c (maybe@markshannon knows)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We can leave it like this. I'll create an issue for Mark to update the cases generator and mention this line.

tomasr8 reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ok!

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Appears to be fixed now thanks to#132615, I updated the PR

sym_set_null(null);
}

op(_GUARD_CALLABLE_TYPE_1, (callable, unused, unused2 -- callable, unused, unused2)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Weird. Maybeunused isn't a meaningful value here like it is inbytecodes.c (maybe@markshannon knows)?

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

tomasr8and others added3 commitsApril 11, 2025 22:44
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
tomasr8and others added2 commitsApril 12, 2025 22:54
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
@tomasr8
Copy link
MemberAuthor

Just to update the status:

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

@brandtbucher: please review the changes made to this pull request.

Copy link
Member

@brandtbucherbrandtbucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Up to you if you want to add the additional test. I'll leave this open for a bit longer just in case.

@tomasr8
Copy link
MemberAuthor

I added the test you suggested since it was quite easy to do :)

Also, should we care about the compiler warnings I mentioned in the PR description? There are now two unused variable warnings:

InfileincludedfromPython/ceval.c:1121:Python/executor_cases.c.h:Infunction_PyEval_EvalFrameDefault’:Python/executor_cases.c.h:5142:25:warning:variablecallablesetbutnotused [-Wunused-but-set-variable]5142 |_PyStackRefcallable;      |                         ^~~~~~~~Python/executor_cases.c.h:5141:25:warning:variablenullsetbutnotused [-Wunused-but-set-variable]5141 |_PyStackRefnull;      |                         ^~~~

@brandtbucher
Copy link
Member

Yeah, we should fix those. Can you rename them tounused, and remove the twoDEAD calls, and add anINPUTS_DEAD() call at the very end, after thearg is closed?

@tomasr8
Copy link
MemberAuthor

Yeah, we should fix those. Can you rename them tounused, and remove the twoDEAD calls, and add anINPUTS_DEAD() call at the very end, after thearg is closed?

it's getting a bit late here so maybe I missed something, but I'm gettingSyntaxError: Input 'null' is still live when output 'res' is defined. FTR, this is what I did:

diff --git a/Python/bytecodes.c b/Python/bytecodes.cindex 22bb4097611..129e606bde2 100644--- a/Python/bytecodes.c+++ b/Python/bytecodes.c@@ -3969,15 +3969,14 @@ dummy_func(             DEOPT_IF(callable_o != (PyObject *)&PyType_Type);         }-        op(_CALL_TYPE_1, (callable, null, arg -- res)) {+        op(_CALL_TYPE_1, (unused, unused, arg -- res)) {             PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);              assert(oparg == 1);-            DEAD(null);-            DEAD(callable);             STAT_INC(CALL, hit);             res = PyStackRef_FromPyObjectNew(Py_TYPE(arg_o));             PyStackRef_CLOSE(arg);+            INPUTS_DEAD();         }          macro(CALL_TYPE_1) =

@tomasr8
Copy link
MemberAuthor

How about we add

(void)null;(void)callable;

I've seen it used in some other instructions. Not sure whether it's the best fix but it does get rid of the warnings.

Copy link
Member

@brandtbucherbrandtbucher left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks great! Just one more suggestion (then you should merge inmain andmake regen-cases to fix the conflicts).

Comment on lines 849 to 851
op(_CALL_TYPE_1, (callable, null, arg -- res)) {
(void)callable;
(void)null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should work!

Suggested change
op(_CALL_TYPE_1, (callable,null,arg--res)) {
(void)callable;
(void)null;
op(_CALL_TYPE_1, (unused,unused,arg--res)) {

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm that doesn't help silence the warnings inexecutor_cases.c.h :/ only thing that I found that works is(void)foo like in0925179. Is there a better way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nope, that's fine!

tomasr8 reacted with thumbs up emoji
@brandtbucherbrandtbucher merged commita6a3dbb intopython:mainApr 22, 2025
64 checks passed
@tomasr8tomasr8 deleted the jit-call-type-1 branchApril 22, 2025 17:54
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@brandtbucherbrandtbucherbrandtbucher approved these changes

@Fidget-SpinnerFidget-SpinnerAwaiting requested review from Fidget-SpinnerFidget-Spinner is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@tomasr8@brandtbucher

[8]ページ先頭

©2009-2025 Movatter.jp