Skip to content

gh-143158: Hot cold code splitting for JIT compiler - #149292

Open
waterlens wants to merge 6 commits into
python:mainfrom
waterlens:hot-cold-splitting
Open

gh-143158: Hot cold code splitting for JIT compiler#149292
waterlens wants to merge 6 commits into
python:mainfrom
waterlens:hot-cold-splitting

Conversation

@waterlens

@waterlenswaterlens commented May 2, 2026

Copy link
Copy Markdown

Issue: gh-143158

This PR implements trace-level hot/cold code splitting for the JIT.

Previously, each uop stencil was emitted as one contiguous code block, so hot fast-path code and rarely executed cold/error-path code were interleaved
throughout the compiled trace:

[uop0 hot+cold][uop1 hot+cold][uop2 hot+cold]...

This change separates each stencil into hot and cold code and emits the trace as:

[uop0 hot][uop1 hot][uop2 hot]...[uop0 cold][uop1 cold][uop2 cold]...

Plan:

  • Move cold code after _JIT_CONTINUE and introduce _JIT_COLD_START for positioning.
  • Split cold / hot code when emitting stencils

@bedevere-app

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.

@python-cla-bot

python-cla-botBot commented May 2, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

read-the-docs-communityBot commented May 2, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32638145 | 📁 Comparing d6ce2a1 against main (3a1df78)

🔍 Preview build

79 files changed · ± 78 modified · - 1 deleted

±Modified

-Deleted

@bedevere-app

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.

@waterlens
waterlensforce-pushed the hot-cold-splitting branch from d6ce2a1 to c180cc0CompareMay 11, 2026 15:31
@bedevere-app

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.

@waterlens
waterlensforce-pushed the hot-cold-splitting branch from c180cc0 to f56e969CompareMay 18, 2026 14:40
@bedevere-app

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.

`replace` didn't preserve relocation;
root block should be at the start of the block list;
fix the pc-relative addressing of branching between hot and cold sections
@bedevere-app

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.

@bedevere-app

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.

@bedevere-app

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.

@waterlens

Copy link
Copy Markdown
Author

@Fidget-Spinner would you mind helping me mark this PR with skip news? I think there is no news for JIT internals changes.

@waterlens
waterlens marked this pull request as ready for review May 23, 2026 04:44
@markshannon

Copy link
Copy Markdown
Member

I think we need to do hot/cold splitting in the code generator.
#143158 (comment)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@waterlens@markshannon@eendebakpt