shader: lower gfx1013 FREXP exponent instructions #468
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/474"
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 venetanji on 2026-11-22T05:49:30Z.
Change
Add e32 and e64 lowering for
v_frexp_exp_i32_f32, the exponent counterpart to the mantissa lowering in #310. Keep the signed result in the destination register as raw bits. Decode the exponent from the binary32 representation, including subnormals and zero for infinities and NaNs. The e64 float source modifiers leave the magnitude unchanged. Eliding the sign operations preserves subnormal bits on desktop hardware.The binary fixture assembles both encodings. The draw compares signed integers before export for 12 inputs and checks that an exponent one too high on the smallest subnormal fails.
Verification
Tested commit
3b366ec5cf1be53e8790bb913103093dda24b672against upstream base796304302ae9427a9e4d046a69045e61131f55a2. On Linux x86-64, with Python 3.12.12 and Debian LLVM 15.0.6:All passed. The unmodified lowering rejected the fixture at
v_frexp_exp_i32_f32_e32 v18, s44.DXC 1.9.2609.5 compiled the fixture to DXIL and Vulkan 1.2 SPIR-V.
I also used a local VkRunner
3f73c7cwrapper to draw the SPIR-V with the same six constant buffers. All six passed on the RTX 3080 Ti and RTX 3090, both on driver 615.78.08. Each adapter caught the wrong subnormal exponent at pixel (0,0). The red channel read 0 with 1 expected. There were no skips.GitHub Actions passed all four jobs, including
pixel_aot_warponwindows-2025in dev (8.31 s) and /O2 (10.48 s). That test runs the six reference cases and requires the wrong subnormal exponent to producepixel_mismatch. CI runEvidence and follow-up
The fixture uses original assembly and synthetic constant buffers under the repository's MIT license. Windows physical GPU readback and direct Scarlett behavior remain unverified. The following command selects the WARP check from a Python-enabled dev build.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T05:51:30Z.
The 12 input words and the smallest-subnormal negative control cover the exponent change. One integration issue remains: check_render adds seven renderer launches to the shared pixel_aot_hardware test. That test already took 58.50 s of its 60 s budget on #310 and timed out on the RTX 4060 in #457. Please register the new exponent draw as its own hardware and WARP CTest, keeping return 77 as a hardware capability skip. Keep the LLVM binary fixture and all seven draws, including the mismatch control. This lets CI and local users run the exponent regression independently.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-22T05:49:39Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
3b366ecℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T19:09:15Z.
Windows 10 timing and draw result on current head
82efaaa1390fe488755dd20f2d802d0794c70f1c. Windows 10 22H2 build19045.6466, MSVC19.44.35230, Windows SDK10.0.26100.0, DXC1.8.2502.11, Debug with/MTd. D3D12 debug layer unavailable on both adapters.10de:2414), driver621.24(32.0.16.2124via DXGI).pixel_aot_hardwarepassed in 54.57 s against the configured 60 s timeout, leaving 5.43 s on this run.1414:008c), driver10.0.19041.5794.pixel_aot_warppassed in 8.77 s.I also called
check_frexp_exp_drawsdirectly. All six positive draws matched all 4,096 pixels each on both adapters. Changing the smallest-subnormal reference exponent from-148to-147produced the expectedpixel_mismatchat(0, 0)on both adapters: red expected1, read0, exit 1. The isolated fixture took 2.33 s on the RTX and 0.46 s on WARP, including DXC and all seven renderer launches. The base translator (a8e2d39) rejected the same program atv_frexp_exp_i32_f32_e32before rendering.AI-assisted. All reported tests ran locally.
Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T20:29:37Z.
I tested the standalone CTest split requested above. This patch applies to
82efaaa1390fe488755dd20f2d802d0794c70f1c. It moves the existing six positive draws and the smallest-subnormal negative control intopixel_aot_frexp_exp_{hardware,warp}, preserves form coverage records, and keeps renderer exit 77 as a hardware capability skip. The LLVM fixture is preserved in the source. I did not rerun the LLVM round-trip locally.On the same RTX 3060 Ti and Windows 10 setup, all four tests passed. The exponent tests took 2.40 s on hardware and 0.67 s on in-box WARP. The shared hardware test took 49.31 s against its 60 s limit. Both exponent encodings appeared in the coverage records.
Save the diff as a
.patchfile and rungit apply <file>from the PR checkout.git apply --checkpassed.AI-assisted. All reported tests ran locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T03:30:04Z.
Merged as
003d85dafter the normal and /O2 Windows jobs and both Linux jobs passed onf083fdc. Thanks, @rwZephyr, for the tested CTest split. I adapted it to the current test driver and kept the six draws, smallest-subnormal mismatch and LLVM binary fixture. The dedicated WARP draw also passed locally.