GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-148211: decompose `[_POP_TWO/_INSERT_2]_LOAD_CONST_INLINE_BORROW` in JIT by NekoAsakura · Pull Request #148357 · python/cpython

Conversation

@NekoAsakura

@NekoAsakura NekoAsakura commented Apr 10, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Refactor the JIT uops #148211

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@NekoAsakura
pythongh-148211: decompose `[_POP_TWO/_INSERT_2]_LOAD_CONST_INLINE_BO…
3997442
…RROW` in JIT
@NekoAsakura
NekoAsakura requested review from Fidget-Spinner, markshannon, savannahostrowski and tomasr8 as code owners April 10, 2026 17:46
@bedevere-app bedevere-app Bot added the awaiting review label Apr 10, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Apr 10, 2026
Refactor the JIT uops #148211
Closed
@Fidget-Spinner Fidget-Spinner added the skip news label Apr 10, 2026
@NekoAsakura

NekoAsakura commented Apr 10, 2026

Copy link
Copy Markdown
Member Author

Conflicts already 😲 JIT is moving so fast.
Next PR would be: _POP_CALL(_ONE/_TWO)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner approved these changes Apr 10, 2026
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

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.

Awesome, another nice simplification. Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Apr 10, 2026
@Fidget-Spinner

Fidget-Spinner commented Apr 10, 2026

Copy link
Copy Markdown
Member

Conflicts already 😲 JIT is moving so fast. Next PR would be: _POP_CALL(_ONE/_TWO)

Yeah there're like 5 active contributors sending stuff to the JIT almost daily. It's a happy problem :).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner

Fidget-Spinner commented Apr 10, 2026

Copy link
Copy Markdown
Member

@NekoAsakura I would like to add you to the contributors in the What's New page. Would you be alright with that and do you mind if I use your Neko Asakura handle?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NekoAsakura
Merge branch 'main' into pythongh-148211/decompose-pop-two-insert-2
ba23f01
@NekoAsakura

NekoAsakura commented Apr 10, 2026

Copy link
Copy Markdown
Member Author

@NekoAsakura I would like to add you to the contributors in the What's New page. Would you be alright with that and do you mind if I use your Neko Asakura handle?

That'd be lovely, thanks! Would it be alright to use a different name though?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner

Fidget-Spinner commented Apr 10, 2026

Copy link
Copy Markdown
Member

That'd be lovely, thanks! Would it be alright to use a different name though?

Yeah of course.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner

Fidget-Spinner commented Apr 10, 2026

Copy link
Copy Markdown
Member

I'll open the PR to add new JIT contributors. Give me a moment. Will tag you in it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner reviewed Apr 10, 2026
View reviewed changes
Comment thread Tools/cases_generator/optimizer_generator.py
Comment on lines +260 to +261
("_SWAP", "3, 0"),
("_SWAP", "2, 0")],

@Fidget-Spinner Fidget-Spinner Apr 10, 2026

Copy link
Copy Markdown
Member

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.

This seems a little inefficient, but I think it should be fine as it's just a register to register move with stack caching in the JIT.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@NekoAsakura NekoAsakura Apr 10, 2026

Copy link
Copy Markdown
Member Author

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.

Are there any better practices for this?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Fidget-Spinner Fidget-Spinner Apr 10, 2026

Copy link
Copy Markdown
Member

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.

don't think so: no matter what you do, you probably have to shuffle the register anyways. We can remove some movs, but I doubt that will speed up things by that much on modern CPUs considering register renaming is a thing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@NekoAsakura NekoAsakura Apr 10, 2026

Copy link
Copy Markdown
Member Author

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.

Sound about right.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@NekoAsakura
Merge branch 'main' into pythongh-148211/decompose-pop-two-insert-2
ff00c93
@Fidget-Spinner

Fidget-Spinner commented Apr 11, 2026

Copy link
Copy Markdown
Member

I verified that for the following:

def constant():
    for _ in range(4096):
        a = 1
        b = 2
        c = a + b

constant()

We emit the following:

  25 OPTIMIZED: _LOAD_CONST_INLINE_BORROW_r23 (0, target=21, operand0=0x5fdb9ad03c88, operand1=0)
  26 OPTIMIZED: _SWAP_3_r33 (3, target=21, operand0=0, operand1=0)
  27 OPTIMIZED: _SWAP_2_r33 (2, target=21, operand0=0, operand1=0)

Which means everything is in registers. So that's great.

NekoAsakura reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NekoAsakura

NekoAsakura commented Apr 11, 2026

Copy link
Copy Markdown
Member Author

Next PR would be: _POP_CALL(_ONE/_TWO)

Would you like me to decompose _POP_TWO as well? I see op_without_pop already peels it during refcount elimination, so we'd just be making that explicit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner

Fidget-Spinner commented Apr 11, 2026

Copy link
Copy Markdown
Member

Next PR would be: _POP_CALL(_ONE/_TWO)

Would you like me to decompose _POP_TWO as well? I see op_without_pop already peels it during refcount elimination, so we'd just be making that explicit.

Yes please, the op elimination pass should be as simple as possible. We want this so any optimizations we do in the future are easier and more effective.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fidget-Spinner
Fidget-Spinner merged commit 72006a7 into python:main Apr 11, 2026
83 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 11, 2026
@NekoAsakura
NekoAsakura deleted the gh-148211/decompose-pop-two-insert-2 branch April 11, 2026 10:28
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@NekoAsakura @ljfp
pythongh-148211: decompose `[_POP_TWO/_INSERT_2]_LOAD_CONST_INLINE_BO…
ee7689d
…RROW` in JIT (pythonGH-148357)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@NekoAsakura @Fidget-Spinner
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.