Repository navigation
Shader: flush legacy f32 multiply operands and results in default MODE - #3318
pmilewsskiedu-gif wants to merge 3 commits into
Conversation
|
Apple M2 data point. Tested head c82fbe3 on Apple M2 (Mac14,3), macOS 26.4 (25E246), MoltenVK 1.4.2 (direct), subgroup 4..32, llvm-mc 23.1.6, Python 3.13.18.
Build note: full build fails on AppleClang 17 at vk_pipeline_check.cpp:567 (BUILD-822, fixed by open PR #2927); GPU binaries built, so the run above is valid. Head fetched unchanged into a separate worktree; no rebase/edit/push. Synthetic shaders and counts only; no game files. AI-assisted. |
Document f32 denormal flushing and signed-zero VOP3 behavior with synthetic validation references. AI-assisted (GPT-6).
|
Tested
3/3, all translated and spirv-val clean — the legacy f32 multiply flushes its denormal operands and result in the default MODE, exact on this adapter. NVIDIA Blackwell (RTX 50-series) coverage. AI-assisted. |
|
Tested 5e35627 on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The PR's diff applied cleanly to
|
|
Tested
Synthetic tests only; no game data. |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Not a pass — the full semantic suite goes red at Environment: Windows 11 Pro 26200, Python 3.15.2, NVIDIA RTX 3080 (driver 616.92),
The GPU side is fine:
Two ways to close it:
Repro (clean tree at |
|
Addressed the full semantic-suite failure reported in #3318 (comment). Reproduced: on original PR head Fix: commit Upstream integration: I also addressed PR mergeability, preserving original worktree and changes by merging No change to hardware-tested legacy-multiply semantics; prior RTX 4060 Ti and independent AMD RDNA2 GPU tests remain as reported. No new GPU or full 7,000+ test sweep claimed here. Only original test/contract merge, no game data, no DRM bypass, AI-assisted. Thank you for the concrete regression report. |
# Conflicts: # docs/design.md
…lushing both operands (SHADER-771) Since ItsNotRexed#3318 every v_mul_legacy_f32 flushed both operands, the product and the result after the modifiers: about 29 instructions where the multiply used to take 5, and the largest translated compute modules grew by about a fifth (bisected: a 7.2 MiB module +21%, all from that merge). The flushed operands are never needed. flush_f32 makes an operand ±0 exactly when |x| < FLT_MIN, and the legacy rule then gives +0 whatever the other operand is (inf and NaN included); when neither is that small the flush leaves both unchanged. Gen.legacy_zero tests that on the unflushed operands, and the product is taken from them. The flush after the modifiers stays only for div:2, the one omod that can make a normal value subnormal. v_mad_legacy_f32/v_mac_legacy_f32 take the same rewrite for the product; their addend is still flushed. test_valu_mul_legacy_denorm.py's structural count follows (two operand tests and the product, plus one for div:2), and the v_mul_legacy_f32 mutation in test_mutations.py is re-anchored on the new block (it still drops the zero rule). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified on Linux — the v_mul_legacy_f32 denorm flush this PR documents is already on main: the implementation via 533d553 (SHADER-340, flush-in/flush-out, with the semantic tests and ps_mul_legacy_denorm fixtures) and the contract row via 5e35627 (both verified present; main's translator carries flush_f32). Main's test_mutations entry was likewise re-keyed to the flushing code, while this branch's entry still targets the pre-flush source text, so the merge conflicts in tests/semantic/test_mutations.py and docs/design.md at current main. Recommend closing as superseded. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
…lushing both operands (SHADER-771) Since ItsNotRexed#3318 every v_mul_legacy_f32 flushed both operands, the product and the result after the modifiers: about 29 instructions where the multiply used to take 5, and the largest translated compute modules grew by about a fifth (bisected: a 7.2 MiB module +21%, all from that merge). The flushed operands are never needed. flush_f32 makes an operand ±0 exactly when |x| < FLT_MIN, and the legacy rule then gives +0 whatever the other operand is (inf and NaN included); when neither is that small the flush leaves both unchanged. Gen.legacy_zero tests that on the unflushed operands, and the product is taken from them. The flush after the modifiers stays only for div:2, the one omod that can make a normal value subnormal. v_mad_legacy_f32/v_mac_legacy_f32 take the same rewrite for the product; their addend is still flushed. test_valu_mul_legacy_denorm.py's structural count follows (two operand tests and the product, plus one for div:2), and the v_mul_legacy_f32 mutation in test_mutations.py is re-anchored on the new block (it still drops the zero rule). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed in coordination: #3232 (comment).
What and why
Under the inferred RDNA2
MODE.denorm_mode_32=0(IEEE off), DX9-stylev_mul_legacy_f32must flush f32 subnormal operands and results. It previously emitted rawOpFMuland checked only exact zero, permitting incorrect nonzero values on Vulkan drivers that preserve f32 denormals.0 * anything => +0, including an input that became -0).-0 => +0behavior after flushing.tests/semantic/test_valu_mul_legacy_denorm.py, two entirely synthetic GPU fixtures (ps_mul_legacy_denormandps_mul_legacy_denorm_mods), expected words in both GPU harness definitions, and the documented mode assumption.Tested
Windows 11 / NVIDIA RTX 4060 Ti driver 610.88 / Vulkan SDK 1.4.363,
LEONIDA_VK_VALIDATION=1, LLVM AMDGPU toolchain.Before: exact translator generated GPU outputs disagreeing in all four synthetic cases, 4,096/4,096 pixels: f32 subnormal inputs and products survived instead of flushing.
After:
python -B -I tests/semantic/test_valu_mul_legacy_denorm.py -q4/4 tests pass (also rechecked on rebased latest main). Related semantic tests 59 passed.python -I scripts/run_gpu_tests.py --require-pass --filter ps_mul_legacy_denorm ...: 2/2 GPU shaders, 8,192/8,192 pixels exact, 2/2 spirv-val both on initial main and again on rebased current main (c82fbe37).Full GPU suite on original main: 196/196 SPIR-V valid, 144 GPU pass, 46 skipped, 1 failure. The sole failure
ps_sdwa_f16_constis the existing separate FP16 subnormal issue already claimed by #3040 and unrelated to thisv_mul_legacy_f32patch. The unmerged FP16 fallback is not folded into this PR.The implementation models the inferred game f32 MODE, not arbitrary dynamic denormal-preserving or IEEE modes. No native gfx1013 oracle or proprietary shader data is claimed or included; this is synthetic shader correctness, not genuine GTA VI execution. AI-assisted (GPT-6).