GeezerVison is showing github.com — Widen specialized int fast paths to full int64 range · Issue #150424 · python/cpython
Widen specialized int fast paths to full int64 range #150424DescriptionThis work widens the interpreter’s specialized int fast paths (tier-2 / uop execution) from the compact-only range to the full int64_t range.
It also fixes follow-up correctness issues in the widened specialized paths for non-compact exact PyLongObjects and on 15-bit builds.
Scope:
- widen specialized integer add/subtract/multiply fast paths to operate across the full
int64_t range
- accept exact
int operands that fit in int64_t, including non-compact PyLongObjects
- keep specialized in-place mutation compact-only and fall back safely for non-compact inputs
- handle widened integer compare without compact-only assumptions
- construct widened arithmetic results with
PyLong_FromInt64() so 15-bit builds do not narrow through stwodigits
- add regression coverage for widened operations, non-compact exact ints, boundary cases, and overflow fallback
- add benchmark scripts for measuring widened specialized integer fast-path performance
Linked PRs
Activitychanged the title [-]Specialized widened JIT int paths still assume compact PyLongs[/-] [+]Widen JIT int fast paths to full int64 range[/+] on May 25, 2026picnixz commented on May 25, 2026 Do we support 15-bit builds actually? picnixz commented on May 25, 2026 markshannon commented on May 26, 2026 If you want to improve int performance then take a look at #101291 KRRT7 commented on May 28, 2026 @markshannon Thanks! I had looked for something like that issue but hadn't found it for whatever reason, probably because cpython has so many issues.
the work I'm doing #150425, is based off of work already being done in another project I'm involved in, as I had tried to explain (and show) in that other PR, gh-150424 was a draft and still a WIP so what was being seen, was not the completed version.
right now it's in a much better state and has benchmarks, I've had some guidance from @Fidget-Spinner whilst working on this and plan to do some more benchmarking and correctness testing locally before reopening. KRRT7 commented on May 28, 2026 KRRT7 commented on May 28, 2026 I just did a deep search thru issues and PRs and i found these prior arts where i feel that my current work builds on top off of:
Fidget-Spinner commented on May 28, 2026 @markshannon I think changing the int layout is potentially more disruptive to the C API. This change purportedly introduces a speedup without any layout changes. So we should consider it as-is. KRRT7 commented on May 28, 2026 After a short conversation with @Fidget-Spinner , I’ve updated the wording here (and in the linked PR) to avoid calling this “the JIT”.
I had been mentally grouping the specializing interpreter / tier-2 uop machinery under “JIT”, but the change itself is to the
interpreter’s specialized execution paths changed the title [-]Widen JIT int fast paths to full int64 range[/-] [+]Widen specialized int fast paths to full int64 range[/+] on May 28, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|