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: Split CALL_TUPLE_1 into several uops#132851

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 6 commits intopython:mainfromtomasr8:jit-call-tuple-1
Apr 24, 2025

Conversation

tomasr8
Copy link
Member

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

CALL_TUPLE_1 is equivalent totuple(...).

Very similar to previous work on splitting upCALL_TYPE_1:#132419
This splits the instruction into a smaller instruction + 2 guards which can be optimized away. This also sets the return type totuple.

Comment on lines +961 to +964
if (sym_matches_type(arg, &PyTuple_Type)) {
// e.g. tuple((1, 2)) or tuple(foo) where foo is known to be a tuple
res = arg;
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Same optimization as in#132849 (comment)

x = 0
for _ in range(n):
y = tuple((1, 2)) # tuple argument
a, _ = y # _UNPACK_SEQUENCE_TWO_TUPLE
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I needed to useUNPACK_SEQUENCE(_TWO)_TUPLE here since it is currently the only uop that propagates the tuple items to the result.

Copy link
Member

Choose a reason for hiding this comment

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

Nice observation. Seems like_BINARY_OP_SUBSCR_TUPLE_INT could be taught how to do this pretty easily for a constant RHS. Want to add that to your queue?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's already in the queue 😄

@brandtbucherbrandtbucher merged commit08e3389 intopython:mainApr 24, 2025
68 checks passed
@tomasr8tomasr8 deleted the jit-call-tuple-1 branchApril 25, 2025 05:55
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@brandtbucherbrandtbucherbrandtbucher left review comments

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

@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.

3 participants
@tomasr8@Fidget-Spinner@brandtbucher

[8]ページ先頭

©2009-2025 Movatter.jp