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-131798: Narrow types more aggressively in the JIT by brandtbucher · Pull Request #134373 · python/cpython

Conversation

@brandtbucher

@brandtbucher brandtbucher commented May 20, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

When setting the type version, we should also set the type (if possible). We can use this to narrow unknown classes to constants in uops like _CHECK_ATTR_CLASS.

(Also, fix a couple of cases where we were incorrectly detecting contradictions when updating some symbols.)

  • Issue: Better uop coverage in the JIT optimizer #131798

Sorry, something went wrong.

Uh oh!

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

All reactions
brandtbucher added 2 commits May 20, 2025 13:21
@brandtbucher
Also set the type when setting the type version
1a958a8
@brandtbucher
blurb add
1cd663f
@brandtbucher
brandtbucher requested a review from tomasr8 May 20, 2025 18:14
@brandtbucher brandtbucher self-assigned this May 20, 2025
@brandtbucher
brandtbucher requested review from Fidget-Spinner and markshannon as code owners May 20, 2025 18:14
@brandtbucher brandtbucher added performance Performance or resource usage interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-JIT labels May 20, 2025
@bedevere-app bedevere-app Bot mentioned this pull request May 20, 2025
Better uop coverage in the JIT optimizer #131798
Open
@bedevere-app bedevere-app Bot added the awaiting core review label May 20, 2025
brandtbucher added 3 commits May 20, 2025 15:58
@brandtbucher
Feedback from code review
d097c86
@brandtbucher
Feedback from code review
2f8dad9
@brandtbucher
Make the peephole pass way simpler
f483964
tomasr8
tomasr8 reviewed May 20, 2025
View reviewed changes
Comment thread Python/optimizer_analysis.c
Comment on lines -568 to -592
case _POP_TOP_LOAD_CONST_INLINE:
case _POP_TOP_LOAD_CONST_INLINE_BORROW:
last->opcode = _NOP;
goto optimize_pop_top_again;
case _COPY:
case _LOAD_CONST_INLINE:
case _LOAD_CONST_INLINE_BORROW:
case _LOAD_FAST:
case _LOAD_FAST_BORROW:
case _LOAD_SMALL_INT:
last->opcode = _NOP;
if (opcode == _POP_TOP) {
opcode = buffer[pc].opcode = _NOP;
}
else if (opcode == _POP_TOP_LOAD_CONST_INLINE) {
opcode = buffer[pc].opcode = _LOAD_CONST_INLINE;
}
else if (opcode == _POP_TOP_LOAD_CONST_INLINE_BORROW) {
opcode = buffer[pc].opcode = _LOAD_CONST_INLINE_BORROW;
}
else {
assert(opcode == _POP_TWO_LOAD_CONST_INLINE_BORROW);
opcode = buffer[pc].opcode = _POP_TOP_LOAD_CONST_INLINE_BORROW;
goto optimize_pop_top_again;
}

@tomasr8 tomasr8 May 20, 2025

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.

feels good 🤩

Sorry, something went wrong.

Uh oh!

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

brandtbucher reacted with hooray emoji
All reactions
  • 🎉 1 reaction
brandtbucher added 2 commits May 20, 2025 17:06
@brandtbucher
Naming
101955f
@brandtbucher
Fix the crashes
0974ec9
@brandtbucher
brandtbucher merged commit 2f0570c into python:main May 20, 2025
@bedevere-app bedevere-app Bot removed the awaiting core review label May 20, 2025
@tomasr8 tomasr8 mentioned this pull request May 21, 2025
gh-131798: JIT: Optimize _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW #134369
Merged
lkollar pushed a commit to lkollar/cpython that referenced this pull request May 26, 2025
@brandtbucher @lkollar
pythonGH-131798: Narrow types more aggressively in the JIT (pythonGH-…
463516e
…134373)
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@brandtbucher @Pranjal095
pythonGH-131798: Narrow types more aggressively in the JIT (pythonGH-…
81af4f3
…134373)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@brandtbucher @taegyunkim
pythonGH-131798: Narrow types more aggressively in the JIT (pythonGH-…
93a2a80
…134373)
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
@brandtbucher @gostak-dd
pythonGH-131798: Narrow types more aggressively in the JIT (pythonGH-…
3d66658
…134373)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tomasr8 tomasr8 tomasr8 left review comments
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

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

Assignees

@brandtbucher brandtbucher

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage topic-JIT

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

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