Recompiler: preserve zero sign in HLSL f16 multiplies #2183
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2183
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2183"
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?
@luckyteagirl on GitHub · 2026-11-25 08:11 UTC · original
luckyteagirl:codex/f16-mul-signed-zero→main· +53 −2 · 2 files · 1 commits · openFixes the f16 multiplication signed-zero part of #2168 on the default HLSL backend. On the RX 6800M, DXC fast math can turn a negative-zero product into positive zero for
V_MUL_F16andV_PK_MUL_F16; direct DXIL preserves the sign. A global-Gisswitch also changes FMA results on this card, so this patch repairs only the two multiply forms.What is in it
Tested
abcf799a3a08766a62a645f2159a3f9e82e9459conmain6d12f58a229bc73889878a448c64dc3af25eeba0; Windows 11 Home build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.8.2502.11.cargo test --locked -p xcl --lib -j 2 gpu_f16_multiply_preserves_zero_sign -- --test-threads=1 --show-output, withXCL_ADAPTER=6800MandXCL_REQUIRE_GPU=wave64: 1 passed, 0 failed, 0 ignored, 0 SKIPPED withXCL_DIRECT_DXIL=0, and the same counts withXCL_DIRECT_DXIL=1. The two guarded runs did not trigger the memory guard.cargo build --locked --release -p xcl --bins -j 2: passed under the 1 GiB free-commit guard with no trigger on the retry. An earlier attempt was guard-stopped before completion when unrelated jobs exhausted free commit; it produced no build result.git diff --check: clean..\scripts\test.ps1completed with 1,424 passed, 0 failed, 46 ignored, and 25 explicit GPU skips (21 native-wave64, one heap-window, three refused per-lane forms). The focused f16 regression passed. A separate 60-second release title smoke showed 1,563 frames, 15,387 MB peak, and zero crashes/device removals against a same-machinemainbaseline of 1,605 frames and 15,009 MB. These are the independent reporter's results, not runs on our RX 6800M.46b7744: the RX 6800M fuzzer comparison found 26/256V_MUL_F16and 49/256V_PK_MUL_F16HLSL/direct differences before the emitter change, and 0/256 for each after it. Its full workspace run reported 993 passed, 162 failed, 46 ignored; 161 of the failed names matched a prior clean-main run after this old AMD driver suspended the device. These are not current-head suite results.Regression run
The committed release binaries for the tested
mainbase (6d12f58) and this PR ran the same locally owned title on the RX 6800M for five seconds each, with separate data and shader caches. Both exited normally with no crash, device removal, or memory-guard trigger, but neither reached a frame; these runs cover startup only. A separate seven-second main run showed six frames, while the seven-second head attempt hit the unchanged 1 GiB free-commit guard at 713 MB and produced no smoke block. The focused GPU fixture above exercises the changed f16 instructions.Tested
mainbase:This PR:
Not tested
AI use
OpenAI Codex (GPT-6; exact variant unavailable) implemented the fix and regression, rebased the commit, ran the current-head focused GPU checks and guarded release/smoke runs, reviewed logs, and drafted this description.
OpenAI Codex (GPT-6.2 Astra) verified the independent exact-head report and added its linked results to this description.
@Diskuss on GitHub · 2026-11-25 08:22 UTC · original · edited 2026-11-25 09:16 UTC
Tested on AMD Radeon RX 9070 XT (RDNA4) at
46b7744cc9c39eb8f8cf06ea2c95e5164abcdf9bAMD Radeon RX 9070 XT, driver 32.0.32015.7029; Ryzen 7 5700X3D; 32 GB; Windows 11 Pro build 26300.9974; Rust 1.100.0 msvc; DXC 1.9.2602.17; debug build. The head is directly on top of main
568e7db(0 commits behind), tested as is.Tested:
cargo build --workspace: ok.cargo test -p xcl --lib gpu_f16_multiply_preserves_zero_sign -- --test-threads=1: 1 passed, 0 failed.cargo test --workspace --no-fail-fast -- --test-threads=4: 1153 passed, 2 failed, 46 ignored. Failures:fuzz_validate_and_gpu_1andfuzz_validate_and_gpu_3(the known #2115 failures). 0 device removals.568e7dbon this machine: 1152 passed, 2 failed, 46 ignored, same two failures. The +1 passed is the new test.refusedcases citing #1426, the PSO measurement without Developer Mode,heap_window_out_of_memory_falls_back_to_the_switch_form).Not tested: the #2168 cross-backend fuzzer (it is not on main, so I did not check the v_sin/v_cos or ldexp cases before/after), retail title /
scripts/smoke.ps1(no game files), release build.Update: #2169 fuzzer comparison (asked for by DarkPanda69). Base:
main568e7dbplus #2169e792e6b; head:46b7744plus #2169e792e6b. Both local merges, no conflicts, not pushed. Debug build,XCL_FUZZ_OPS=V_MUL_F16,V_PK_MUL_F16,V_LDEXP_F16,V_SIN_F16,V_SIN_F32,V_COS_F32,V_FMA_F16,V_PK_FMA_F16,cargo test -p xcl --lib valu_fuzz_backends_agree -- --ignored --test-threads=1(256 inputs per instruction, default 4 rounds):main+ #2169V_MUL_F16V_PK_MUL_F16V_LDEXP_F16V_SIN_F16V_SIN_F32V_COS_F32V_FMA_F16,V_PK_FMA_F16Instructions with differences: 6 on
main, 4 with the PR. Same numbers for both multiplies as DarkPanda69's RX 9070 run. The ldexp/sin/cos differences are unchanged (out of scope for this PR).Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.
@DavidM1911 on GitHub · 2026-11-25 15:39 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@DarkPanda69 on GitHub · 2026-11-25 08:34 UTC · original · edited 2026-11-25 22:22 UTC
Update for head
abcf799: rerun onmaine1d84b7, with #2169e792e6bfor the fuzzer, same commands and cards. The table below holds at this head: RX 9070 XTV_MUL_F1626 → 0 andV_PK_MUL_F1649 → 0, the other instructions unchanged; RTX 3060 0 differences before and after.gpu_f16_multiply_preserves_zero_signok on both. Wholegpu::filter with this PR: RX 9070 XT 699 passed, 2 failed (the #2115 fuzz seeds), 6 SKIPPED; RTX 3060 701 passed, 0 failed, 24 SKIPPED.The #2169 fuzzer before and after this PR on RDNA4 and on NVIDIA ("other GPU vendors" is listed as untested, and the RDNA4 report above didn't run the fuzzer).
Head
46b7744and #2169e792e6bapplied onmain568e7db, debug,XCL_FUZZ_OPSlimited to the f16/sin/cos instructions of #2168,cargo test -p xcl --lib valu_fuzz_backends_agree -- --ignored --test-threads=1(256 inputs per instruction):mainmainV_MUL_F16V_PK_MUL_F16V_LDEXP_F16,V_SIN_F16,V_SIN_F32,V_COS_F32V_FMA_F16,V_PK_FMA_F16So the fix removes both multiply differences on RDNA4 too, and changes nothing on NVIDIA, where the HLSL path already kept the sign.
gpu_f16_multiply_preserves_zero_signpasses on both cards; wholegpu::filter with this PR: RX 9070 XT (driver 32.0.32029.2010) 585 passed, 2 failed (the #2115 fuzz seeds, same onmain); RTX 3060 (32.0.16.1088) 587 passed, 0 failed.Not tested: a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@ramon-victor on GitHub · 2026-11-25 23:57 UTC · original
Independent NVIDIA (wave32) full-suite + retail smoke test report on exact PR head
abcf799a3a08766a62a645f2159a3f9e82e9459c(clean detached checkout, no local changes).Tested
x86_64-pc-windows-msvc), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0); debug tests, release smoke.cargo test -p xcl --lib gpu_f16_multiply_preserves_zero_sign): 1 passed, 0 failed..\scripts\test.ps1): 1424 passed, 0 failed, 46 ignored (25 GPU skips expected on this wave32 adapter: 21no wave64, 1no heap windows, 3 wave32 per-lane refused for#1426f16/f32 semantics).cargo build --release -p xcl) and 60 s retail smoke run (XCL_NETWORK=0, compared againstmain @ 08db802baseline on the same machine today:1605frames,15009 MBpeak commit,0crashes,0device removals):Regression run
Not tested
XCL_SAMPLE_*tests (unset).AI use
@DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: 1 failure under parallel scheduling; clean on--test-threads=1rerun (1312 passed, 0 failed, 27 ignored, 82s). Intermittent single-test flake — tracked in #1978.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.