AOT: native double widen for float locals — mandelbrot 248k→121k IR (#36407) - #36428
Merged
Conversation
Untyped locals promoted on float assign used heap __value__ boxes, forcing every float op in mandelbrot through JitValueNumeric dispatch (~248k IR, 1.66× Zend). Promote to TYPE_NATIVE_DOUBLE when the assign is a native double or a compile-time float literal; keep __value__ for other types. Verified: float_widen_mul_escape.phpt green; mandelbrot IR 121k (−51%); bench-gate mandelbrot 0.0096s ratio 0.17; aot-smoke 9/9. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #36407.
Untyped locals widened on float assign were promoted to heap
__value__boxes (#23471), forcing every float op inmandelbrot()throughJitValueNumericdispatch. This caused ~248k LLVM IR lines, runtime thrashing (>60s timeout on Sep 2), and a 1.66× Zend ratio.When the widening assign is
TYPE_NATIVE_DOUBLEor a compile-time float literal, promote toTYPE_NATIVE_DOUBLE(double alloca) instead. Non-numericTYPE_VALUEassigns still use the full value box.Verification
Not covered this run: full
script/differential-sweep.sh --aot --repeat 3(CI lock held by parallel workspace run).php-src reference
Zend keeps
IS_LONGon the fast path and only materialisesIS_DOUBLEon overflow (Zend/zend_operators.hfast_long_add_function). This change mirrors that for untyped locals: stay native double once widened, box only when the assign requires full polymorphism.Made with Cursor