Repository navigation
SHADER-187: canonicalize f32 negative zero before VOP3 omod - #1281
55jnj5wrgc-create wants to merge 9 commits into
Conversation
Add test for canonicalizing negative zero in F32ValuTests.
|
I rebuilt the independent pixel probe from the gfx1036 report against the parent 6961598 and this PR at 053783c. Both mixed-input draws now match the native active-omod/flush profile bit for bit on RTX 5080 (616.92) and AMD Radeon Graphics gfx1036 (32.0.21045.16010). Each 64×64 image contains +0, −0, and two signed finite inputs, one per quadrant. The four raw channels return the unmodified result, mul:2, mul:4 and div:2. With ±1 as the finite inputs, the parent disagreed on exactly 1,024 pixels in each modified channel and zero in the plain channel. This head matched all 4,096 pixels in all four channels on each GPU. In the second image I changed only the finite magnitude to All three source-built modules translated and passed spirv-val on each revision. All eight draws completed with Khronos validation enabled and no VUID. The native comparison uses active omod with FP32 denormal flush; the previously reported IEEE/keep modes suppress the modifier. AI-assisted. |
|
Complementary CPU-side check of
I also checked the shared helper's scope: every f16 call site passes |
|
Tested 053783c on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass.
|
Sync upstream main into the SHADER-187 branch
Handle negative zero case in float conversion.
|
RDNA2 measurement of the f64 and f16 side: on gfx1036, output modifiers behave as @AlxcBTW measured on gfx1150, and each width follows its own denormal mode. The f32 rows agree with @Vonsek's gfx1036 run on #1248. Hardware: the integrated GPU of a Ryzen 9 7950X3D (Raphael, RDNA2, gfx1036), Linux, natively through the hardware oracle's Linux launcher (#1265). One thread per kernel; inputs −0 and 1 + 1 (for
So the f32 rule this PR implements holds on RDNA2. For f64 and f16, scaling unconditionally is right only when f16/f64 denormals are flushed, as on gfx1150. AI-assisted (Claude Code, Claude Fable 5.2). |
|
Tested c624ee4 on NVIDIA GeForce RTX 5090, driver 621.24, Windows 11 Pro 10.0.26300 (Vulkan SDK 1.4.363.0, MSVC 14.51): pass.
A note for other testers: on Mesa llvmpipe (LLVM 20.1.2, Linux) the fixture can't tell them apart. Base and this PR both read Not run on the 5090: the full AI-assisted: Claude Code set up and ran these checks, on this machine and in a Linux container. No game files. |
|
This branch has conflicts with The good news: it resolves with no manual work. I merged current git fetch origin
git merge origin/main # clean; no conflicts to resolve
python -I -m unittest discover -s tests/semantic
git pushOn the merged tree I checked (Windows, CPU only, no game files): the semantic suite ran 1221 tests, OK, plus Two practical notes:
No change requested to the code itself from me — the hardware reports already on this PR cover it. (AI-assisted review.) |
|
This branch has conflicts with Against the current tip, the PR head git fetch origin
git merge origin/main # 3 hunks in tools/rdna2spirv.py
python -I -m unittest discover -s tests/semantic
git pushOnce merged, it stays clean for a while: a tree with After merging Two practical notes:
No change requested to the code itself from me — the hardware reports already on this PR cover it. (AI-assisted review.) |
…st with the measured words 572 distinct forms with clamp/omod/op_sel/neg (1,270,932 instructions in the 26,503 listings), 542 swept natively on gfx1036 through tools/hw_oracle in the game's MODE, 64,802 cases: 51,761 give the translator's word; the rest are differences already on record (NaN payload, f32 denormals SHADER-377, omod -0 -> +0 #1281, rcp/log/sin ulps, FClamp of NaN #2437). The test replays 1,616 words and fails without clamp (326) or omod (237). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What and why
SHADER-187 (coordination claim). Under the translator’s existing active-omod assumption, normalize the exact f32 negative-zero word before
mul:2,mul:4, anddiv:2. Keep the unmodified path and the f16/f64 behavior. The integer bit comparison avoids classifying subnormals as zero.This follows the gfx1150 hardware finding in #1248 and LLVM AMDGPU’s signed-zero restriction when folding omod. #1248 is a source of evidence; this change builds independently. The GPU check below executes the translated SPIR-V, and the native console GFX10.1 behavior was not independently measured.
Validation
80000000in all four components on426023a. With this change it reads00000000, 00000000, 00000000, 80000000; the fourth component is the no-omod control.spirv-val.AI-assisted implementation and validation. All inputs were synthetic.