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-148285: Allow recording uops after specializing uops by adityakrmishra · Pull Request #148367 · python/cpython

Conversation

@adityakrmishra

@adityakrmishra adityakrmishra commented Apr 11, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
  • Fixes Allow recording uops after specializing uops #148285

The Issue:
Currently, analyzer.py uses a strict positional first = True check when validating macro structures. This strictly forces any uop with records_value == True to be at index 0, which prevents Tier 2 recording uops from safely trailing Tier 1 specializing uops.

The Fix:
Replaced the boolean first check with a state tracker (valid_recording_pos) in add_macro().

  • valid_recording_pos starts as True.
  • It remains True if the parsed part is a specializing uop (uop.properties.tier == 1).
  • It ignores CacheEffect and flush parts.
  • It flips to False for any other instruction, properly closing the gate.

This safely allows structures like:
macro(X) = _SPECIALIZE_X + _RECORD_TOS_TYPE + unused/1 + _X;

  • Issue: Allow recording uops after specializing uops #148285

Sorry, something went wrong.

Uh oh!

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

All reactions
@adityakrmishra
adityakrmishra requested a review from markshannon as a code owner April 11, 2026 05:48
@python-cla-bot

python-cla-bot Bot commented Apr 11, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot added the awaiting review label Apr 11, 2026
@bedevere-app

bedevere-app Bot commented Apr 11, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot mentioned this pull request Apr 11, 2026
Allow recording uops after specializing uops #148285
Closed
@bedevere-app

bedevere-app Bot commented Apr 11, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Sacul0457

Sacul0457 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Hmm, while this does allow _RECORD uops to come after _SPECIALIZE uops, it also:

  • Allows _RECORD uops to come after non _SPECIALIZE uops since not all tier-1 uops are specializing.
  • No longer ensures both recording and specializing uops comes first

Example that violates both:

macro(LOAD_SUPER_ATTR) =
    _LOAD_SUPER_ATTR + // tier1 uop
    _RECORD_TOS_TYPE + 
    _SPECIALIZE_LOAD_SUPER_ATTR +
    _PUSH_NULL_CONDITIONAL;

BUT, you should wait for a core dev to review this as I may have misunderstood something.

All reactions

Sorry, something went wrong.

Uh oh!

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

@adityakrmishra adityakrmishra closed this Apr 11, 2026
@adityakrmishra
adityakrmishra force-pushed the fix-uop-recording-148285 branch from e35d157 to 639f218 Compare April 11, 2026 09:45
@bedevere-app

bedevere-app Bot commented Apr 11, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@adityakrmishra adityakrmishra mentioned this pull request Apr 11, 2026
gh-148285: Allow recording uops after specializing uops #148373
Closed
@adityakrmishra

adityakrmishra commented Apr 11, 2026

Copy link
Copy Markdown
Author

@Sacul0457 Good catch! You are entirely correct—my previous logic conflated all tier1 uops with specializing uops, which was too permissive. I also tangled up the Git history on this branch, so I have closed this PR and opened a clean one with a much stricter positional index check that specifically guards for SPECIALIZE prefixes.

The new PR is here: #148373
Thanks for the review

Sacul0457 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon Awaiting requested review from markshannon

Uh oh!

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

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Allow recording uops after specializing uops

Uh oh!

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

2 participants

@adityakrmishra @Sacul0457
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 01402520 — 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.