Skip to content

gh-149335: Exit JIT trace early when the uop buffer is nearly full#149633

Open
cocolato wants to merge 1 commit intopython:mainfrom
cocolato:fix-gh-149335
Open

gh-149335: Exit JIT trace early when the uop buffer is nearly full#149633
cocolato wants to merge 1 commit intopython:mainfrom
cocolato:fix-gh-149335

Conversation

@cocolato
Copy link
Copy Markdown
Member

@cocolato cocolato commented May 10, 2026

This PR adds a runtime buffer capacity guard to the JIT's trace translation path to prevent traces from continuing to expand when they approach the uop buffer limit, which would ultimately trigger a buffer space assertion in _PyJit_translate_single_bytecode_to_trace():

assert(uop_buffer_remaining_space(trace) > space_needed)

@cocolato
Copy link
Copy Markdown
Member Author

Benchmark result:

All benchmarks:
===============

+----------------+----------+------------------------+
| Benchmark      | base     | opt4                   |
+================+==========+========================+
| deltablue      | 19.1 ms  | 18.6 ms: 1.03x faster  |
+----------------+----------+------------------------+
| json_loads     | 99.0 us  | 96.7 us: 1.02x faster  |
+----------------+----------+------------------------+
| richards       | 231 ms   | 227 ms: 1.01x faster   |
+----------------+----------+------------------------+
| float          | 303 ms   | 299 ms: 1.01x faster   |
+----------------+----------+------------------------+
| pyflate        | 2.22 sec | 2.20 sec: 1.01x faster |
+----------------+----------+------------------------+
| fannkuch       | 1.58 sec | 1.57 sec: 1.01x faster |
+----------------+----------+------------------------+
| nbody          | 490 ms   | 500 ms: 1.02x slower   |
+----------------+----------+------------------------+
| Geometric mean | (ref)    | 1.01x faster           |
+----------------+----------+------------------------+

Benchmark hidden because not significant (11): go, regex_compile, unpickle_pure_python, spectral_norm, json_dumps, pidigits, raytrace, chaos, regex_effbot, telco, pickle_pure_python

Sign up for free to 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.

1 participant