shader: lower gfx1013 v_frexp_mant_f32 and v_ldexp_f32 in pixel_aot #305
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/310"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-21T21:44:26Z.
Change
Lower
v_frexp_mant_f32(in both_e32and_e64encodings) andv_ldexp_f32intools/pixel_aot.py(3 gfx1013 forms).Both lower through explicit IEEE-754 binary32 bit helpers (
frexp_mant32andldexp32) inPREAMBLEso subnormals, signed zero, infinity, NaN, round-to-nearest-even underflow, and extreme exponent deltas do not depend on desktop driver flush-to-zero behavior.v_frexp_mant_f32joins the existingALUpath with source modifiers andclamp;v_ldexp_f32decodessrc0as float (accepting-,|x|,abs(...)), decodessrc1as a signed 32-bit integer (rejecting float modifiers), and supportsclamp.Add control, binary assembly/disassembly, and D3D12 draw fixtures in
tests/pixel_aot_check.py, plus documentation indocs/experiments.md.Verification
Commit
cd1055fon Linux x86_64 (Python 3.14, LLVM 23.1, g++):python3 -B tests/pixel_aot_check.py binary llvm-mc llvm-objcopy libLLVM.so: passed (assembles both new fixtures forgfx1013, extracts, disassembles, lowers, and matches source lowering).g++ -std=c++17 -O2 -Wall -Wextra -Werror) offrexp_mant32andldexp32extracted directly frompixel_aot.PREAMBLEagainststd::frexpandstd::ldexp: 21/21frexp_mant32cases and 588/588ldexp32pairs (including+0,-0, subnormals, normal/subnormal tie boundaries,INT32_MIN/INT32_MAXdeltas,+/-Inf, andNaN) matched bit-for-bit (asuint).main:tools/pixel_aot.py: rejectedv_frexp_mant_f32_e32(Unsupported instruction 20) andv_ldexp_f32(Unsupported instruction 21).python3 -B tests/docs_links_check.py,tests/bidi_controls_check.py,tests/rdna2_tools_check.py(26 ran, 1 skipped withoutLLVM_LIB), and the 5 non-iced_x86checks intests/form_coverage_check.py: all passed.offscreen_check.exeD3D12 draws locally because this environment is Linux without MSVC/DXC/Windows;check_frexp_ldexp_draws()will execute under the Windows CI job.Evidence and follow-up
All fixtures are synthetic AMDGPU assembly programs authored inline in
tests/pixel_aot_check.pyunder the repository's MIT license. Semantics follow the AMD RDNA Shader ISA reference.This shares the
int_operand()helper with #306 and #308; whichever lands later will need a small rebase.Checklist
AI-assisted: yes.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:58:54Z.
At
cd1055fthe merge conflicts are intests/pixel_aot_check.py. Keep both exponent boundary controls and the landed arithmetic cases.Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-21T22:20:17Z.
Rebased onto
main(6ee2406) ina51742b, preserving both exponent boundary fixtures alongside all landed scalar64,v_cvt_f32_f16, andfmaak/fmamkcontrols. Updatedint_operand()to reusescalar_u32()identically to #306 and #308.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T02:56:29Z.
A test merge of
a51742bagainst main conflicts indocs/experiments.md,tests/pixel_aot_check.pyandtools/pixel_aot.py. Reconcile with #306’sint_operandand retain its comparison draws along with your exponent-boundary controls. Please refresh the branch and rerun the relevant fixture and Windows CI.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T04:24:37Z.
I resolved the conflicts with #306 and #308 on your branch at
04790b3. The combined pixel_aot_hardware test passed in 58.50 s and pixel_aot_warp in 11.58 s locally. Hardware is close to its 60 s limit, consistent with the measurements in #448. Auto-merge is enabled while CI tests this head.