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-133171: Re-enable JUMP_BACKWARD to free-threading build by corona10 · Pull Request #137800 · python/cpython

Conversation

@corona10

@corona10 corona10 commented Aug 15, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Make the JIT thread-safe #133171

Sorry, something went wrong.

Uh oh!

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

All reactions
@corona10
corona10 requested a review from markshannon as a code owner August 15, 2025 05:53
@bedevere-app bedevere-app Bot added the awaiting core review label Aug 15, 2025
@corona10 corona10 added the skip news label Aug 15, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Aug 15, 2025
Make the JIT thread-safe #133171
Open
1 of 7 tasks
@corona10
corona10 requested review from Fidget-Spinner, brandtbucher, diegorusso and savannahostrowski and removed request for markshannon August 15, 2025 05:53
@corona10

corona10 commented Aug 15, 2025

Copy link
Copy Markdown
Member Author

@savannahostrowski @diegorusso @Fidget-Spinner @brandtbucher

To the JIT team — I’m not sure who’s currently working on this, but it might be a good starting point to add JIT support. My next goal will be to make the tier-two instructions thread-safe.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner

Fidget-Spinner commented Aug 15, 2025

Copy link
Copy Markdown
Member

I think we should start by running the tests in CI for JIT+FT current build and see what passes/fails before doing this

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

@corona10

corona10 commented Aug 15, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

I think we should start by running the tests in CI for JIT+FT current build and see what passes/fails before doing this

We disabled FT + JIT build from #133179 do you think that we have to listing the current status?
Could we separate this task into making the tier 2 interpreter thread-safe (with optimizer disabled) and the optimizer thread-safe?

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner

Fidget-Spinner commented Aug 15, 2025

Copy link
Copy Markdown
Member

Could we separate this task into making the tier 2 interpreter thread-safe (with optimizer disabled) and the optimizer thread-safe?

This makes sense but actually the default build's JIT can't even run with the optimizer turned off! There's some segfaults when we turn off the optimizer lol.

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

@corona10

corona10 commented Aug 15, 2025

Copy link
Copy Markdown
Member Author

This makes sense but actually the default build's JIT can't even run with the optimizer turned off! There's some segfaults when we turn off the optimizer lol.

How can I trigger this?

All reactions

Sorry, something went wrong.

Uh oh!

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

@Fidget-Spinner

Fidget-Spinner commented Aug 15, 2025

Copy link
Copy Markdown
Member

This makes sense but actually the default build's JIT can't even run with the optimizer turned off! There's some segfaults when we turn off the optimizer lol.

How can I trigger this?

Run the test suite with PYTHON_UOPS_OPTIMIZE=0 env var.

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

@corona10

corona10 commented Aug 15, 2025

Copy link
Copy Markdown
Member Author

Run the test suite with PYTHON_UOPS_OPTIMIZE=0 env var.

Just for the record at default build:
PYTHON_UOPS_OPTIMIZE=0 ./python.exe -m test -j8

39 tests failed:
    test.test_asyncio.test_pep492
    test.test_multiprocessing_forkserver.test_processes
    test.test_multiprocessing_spawn.test_processes test_array test_bdb
    test_buffer test_code test_codecmaps_cn test_codecmaps_hk
    test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw
    test_collections test_complex test_datetime test_embed test_float
    test_htmlparser test_idle test_import test_json test_long
    test_math test_patma test_peepholer test_pickle test_pow
    test_random test_scope test_slice test_ssl test_struct
    test_sys_settrace test_tarfile test_threading test_time test_trace
    test_zipimport_support test_zoneinfo
All reactions

Sorry, something went wrong.

Uh oh!

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

@corona10

This comment has been minimized.

Sign in to view
@corona10

corona10 commented Aug 15, 2025

Copy link
Copy Markdown
Member Author

Ah never mind, it need to be transformed tier 2 code first.

All reactions

Sorry, something went wrong.

Uh oh!

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

@corona10 corona10 mentioned this pull request Aug 15, 2025
Make no-opt JIT to pass whole unit test. #137838
Closed
corona10 added a commit to corona10/cpython that referenced this pull request Aug 27, 2025
@corona10
pythongh-137800: Fix JIT trace buffer overrun by pre-reserving exit s…
77e04ea
…tub space
corona10 added a commit to corona10/cpython that referenced this pull request Aug 27, 2025
@corona10
pythongh-137800: Fix JIT trace buffer overrun by pre-reserving exit s…
214be19
…tub space
@corona10
pythongh-133171: Re-enable JUMP_BACKWARD to free-threading build
d470ce9
@corona10
corona10 force-pushed the gh-133171-JUMP_BACKWARD branch from d855944 to d470ce9 Compare September 18, 2025 08:51
corona10 added 2 commits September 18, 2025 11:23
@corona10
Revive free-threaded build to be built.
cfcd9fe
@corona10
Revive CI again
644b306
@corona10
corona10 requested review from AA-Turner, emmatyping, erlend-aasland, ezio-melotti and hugovk as code owners September 18, 2025 10:23
@corona10
nit
79d9226
@corona10

corona10 commented Sep 18, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

@Fidget-Spinner @brandtbucher I noticed that JIT x FT still doesn’t build even with the entire optimizer path disabled, so fix it temporarily. I’ve added a direct fallback to Tier 1; it’s slow, but fine for now. Let’s re-enable _PyOptimizer_Optimize step by step. To do that, we also need to re-enable CI (just for build testing)

All reactions

Sorry, something went wrong.

Uh oh!

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

@corona10
corona10 requested a review from colesbury September 18, 2025 10:28
corona10 added 2 commits September 18, 2025 11:45
@corona10
fix lint
2aa295a
@corona10
Merge remote-tracking branch 'upstream/main' into pythongh-133171-JUM…
fc2a93b
…P_BACKWARD
@corona10

corona10 commented Sep 18, 2025

Copy link
Copy Markdown
Member Author

cc @savannahostrowski Once this PR is merged, others can start collaborating on the full FT x JIT work separately.

savannahostrowski reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

colesbury
colesbury reviewed Sep 18, 2025
View reviewed changes
Comment thread Include/internal/pycore_stackref.h
static inline int
PyStackRef_RefcountOnObject(_PyStackRef ref)
{
return (ref.bits & Py_TAG_REFCNT) == 0;

@colesbury colesbury Sep 18, 2025

Copy link
Copy Markdown
Contributor

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.

I think this implementation is fine, but I'm not 100% sure

Sorry, something went wrong.

Uh oh!

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

corona10 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@corona10 corona10 added the topic-JIT label Sep 18, 2025
@corona10

corona10 commented Sep 18, 2025

Copy link
Copy Markdown
Member Author

If there are no major objections to this PR, I am going to merge this PR (maybe next week)

All reactions

Sorry, something went wrong.

Uh oh!

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

Zheaoli
Zheaoli reviewed Sep 18, 2025
View reviewed changes
Comment thread Include/internal/pycore_stackref.h
}

static inline int
PyStackRef_RefcountOnObject(_PyStackRef ref)

@Zheaoli Zheaoli Sep 18, 2025

Copy link
Copy Markdown
Contributor

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.

Just personal interest, correct me if I'm wrong.

It seems we don;t call this function yet right? Is this prepared for a future hook?

This function seems be trigger at

  1. PyStackRef_XCLOSE
  2. PyStackRef_CLOSE_SPECIALIZED
  3. PyStackRef_CLOSE
  4. PyStackRef_DUP

Sorry, something went wrong.

Uh oh!

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

All reactions

@corona10 corona10 Sep 18, 2025

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.

It seems we don;t call this function yet right? Is this prepared for a future hook?

Yeah correct, but we can't build if this function is not added. That's all at this moment.

Sorry, something went wrong.

Uh oh!

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

All reactions
@corona10 corona10 added the topic-free-threading label Sep 19, 2025
@corona10
corona10 merged commit c4f21d7 into python:main Sep 24, 2025
@bedevere-app bedevere-app Bot removed the awaiting core review label Sep 24, 2025
@corona10
corona10 deleted the gh-133171-JUMP_BACKWARD branch October 4, 2025 07:25
@hroncok hroncok mentioned this pull request Nov 25, 2025
--disable-gil --enable-experimental-jit=yes-off: test_jit_is_active fails #141956
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@colesbury colesbury colesbury left review comments
@brandtbucher brandtbucher Awaiting requested review from brandtbucher
@diegorusso diegorusso Awaiting requested review from diegorusso
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@emmatyping emmatyping Awaiting requested review from emmatyping emmatyping is a code owner
@ezio-melotti ezio-melotti Awaiting requested review from ezio-melotti ezio-melotti is a code owner
@hugovk hugovk Awaiting requested review from hugovk hugovk is a code owner
+1 more reviewer
@Zheaoli Zheaoli Zheaoli left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

skip news topic-free-threading 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.

4 participants

@corona10 @Fidget-Spinner @colesbury @Zheaoli
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.