Repository navigation
Conversation
|
Independent CPU verification on Linux (Python 3.13.5 +
Looks clean and solid. |
Kam471
left a comment
There was a problem hiding this comment.
Head df5bf13. Gen.src_f_flushed folds flush_f32 for imm/fimm operands; checked it is byte-for-byte what src_u would emit for those operands (shader_ir.py gives imm for integer/hex literals, fimm for decimal floats), and each of the six call sites previously did flush_f32(src_f(...)) on the same operand order, so only the redundant FAbs/compare/select goes away.
Commands and results (Python 3.13, Windows 11):
python tests/semantic/test_flush_constant_operands.py # Ran 8 tests ... OK
python tests/semantic/test_valu_fma_mix.py # 15 OK
python tests/semantic/test_valu_mul_legacy_denorm.py # 4 OK
python tests/semantic/test_valu_mad_lit.py # 15 OK
python tests/semantic/test_fma_exact.py # 9 OK
python tests/semantic/test_fma_khr.py # 9 OK
python tests/semantic/test_valu_dot2_f16.py # 66 OK
python tests/semantic/test_alu_dot_pk_fmac.py # 14 OK
python tests/semantic/test_valu_f32_min3_max3_mad.py # 22 OK
Mutation check reproduced the PR's claim: with tools/rdna2spirv.py from main 3faac55 the new test fails 5 (structural FAbs counts at 5 != 4), values still pass.
git diff --check clean. Verdict: pass; no blocker. (Not re-run: full semantic suite and the GPU corpus run.)
|
Tested
|
|
New head |
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Clean translation-time constant FTZ in Gen.src_f_flushed: properly guards imm/fimm without abs/neg/sdwa_sel/sext, preserves -0.0 (0x80000000) and NaN payloads via bits &= 0x80000000 + self.tof(self.cu(bits)), and routes all six denormal-flushing sites (v_fma_mix_* f32 inputs, v_dot2_f32_f16 acc, v_mul_legacy_f32, v_mad_legacy_f32/v_mac_legacy_f32, v_mad_f32/v_mac_f32) cleanly without touching f16 operands. Tested locally: tests/semantic/test_flush_constant_operands.py 8/8 passed, git diff --check clean. No game files. AI-assisted review (Gemini).
|
Tested 54e5d2d on AMD Radeon RX 7800 XT (RDNA 3, subgroup 32..64), AMD proprietary driver 26.11.2 (LLPC), Vulkan 1.4.359, Windows 11 x64: pass
No game files. |
|
Tested
No game files used. AI-assisted (Claude Code). |
|
Tested 54e5d2d on an AMD Radeon Graphics (Ryzen 9000 iGPU, RDNA2, subgroup 32..64), AMD driver 25.10.30.02, and an NVIDIA RTX 5080 (32-wide only), driver 616.64. Windows 11 Pro 26200, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8. Merged onto
No game files. AI-assisted (Claude Code). |
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted CPU integration review at 54e5d2d with #5347 e3934c0. Selected the first eight filename-sorted, previously validated cached shaders containing v_mad_f32 with both immediate and register operands. All 24 binaries across three builds passed Vulkan 1.2 spirv-val. Totals were 12,552,188 bytes on #5263, 12,278,432 on #5347 and 12,147,468 in the private combination. The combination retained #5263's immediate folding and used #5347's runtime flush implementations. Each build passed 16 independent exact-word CPU cases covering signed zero and the subnormal/normal boundaries. Size measurements apply to this selected slice.
flush_f32 tests |x| < FLT_MIN at run time on every operand of v_mad_f32, v_mac_f32, the legacy multiplies, the f32 operands of v_fma_mix_* and the accumulator of v_dot2_f32_f16. For an inline constant or a literal the bits are known here, so Gen.src_f_flushed writes the flushed value itself: the constant, or a zero of its sign when it is subnormal. An operand with a source modifier or an SDWA select still goes through flush_f32. tests/semantic/test_flush_constant_operands.py checks the values with the constant in each slot, and that a constant operand gets no run-time flush (main still emits one). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A flush is an FAbs and a compare with FLT_MIN today, and one exponent-field mask if flush_f32 tests the bits (the follow-up SHADER item); count both so the structural checks hold with or without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#5263 (head 54e5d2d, open)Tested 54e5d2d on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: pass
AI-assisted (Claude Code). |
|
Rebased onto Both suites against a
AI-assisted (Claude Code). |
54e5d2d to
9cabfcf
Compare
|
Tested
AI-assisted (Claude Code). |
New SHADER item. Claim: #5156 (comment)
Gen.flush_f32emulates the f32 denormal flush ofv_mad_f32,v_mac_f32,v_mul_legacy_f32,v_mad_legacy_f32/v_mac_legacy_f32, the f32 operands ofv_fma_mix_*and the accumulator ofv_dot2_f32_f16at run time:FAbs, a compare with FLT_MIN, the sign mask, a bitcast and a select per operand. It did that for inline constants and literals too (v_mad_f32 v0, v1, 0.5, v2), whose bits are known when the shader is translated.Change
Gen.src_f_flushed(a)isflush_f32(src_f(a)), worked out in the translator whenais animmorfimmoperand:That is exactly what
flush_f32computes at run time (NaN and inf compare false and pass through, a zero keeps its sign). An operand withabs/neg, an SDWA select orsextstill goes throughflush_f32. The six call sites that flushedsrc_f(...)use it. The flushes of products, sums and omod results are unchanged.Tests
tests/semantic/test_flush_constant_operands.py(translator +spirv_mini_interp, hand-written programs):v_mad_f32with a subnormal (1,0x807fffff),-0,0.5or another literal in each of the three slots, against a flushed reference;v_mac_f32with a constant multiplicand;v_fma_mix_f32with64and0.5;v_dot2_f32_f16with a constant accumulator;v_mul_legacy_f32/v_mad_legacy_f32with a subnormal constant times inf (+0 by the legacy rule) and as the addend;v_mad_f32,v_dot2_f32_f16andv_fma_mix_f32gets no run-time flush, while a modified one (|v2|) still does.With
tools/rdna2spirv.pyfrommainthe five structural checks fail and the value checks pass.pytest tests/semantic -n 10: 6,251 passed, 5 failed, the same 5test_loop_ballot_barriersubtests asmain3faac557.pytest tests --ignore=tests/semantic -n 10: the same failures asmain3faac557(none of them in the translator).scripts/run_gpu_tests.pyon Intel UHD Graphics 750 (Windows 11,LEONIDA_VK_DEVICE=Intel,LEONIDA_W64_EMULATE=1, test programs built from98fa503f, which this PR's C++-free change doesn't touch): 180/217 passed, 37 skipped, every test with the same result asmain3faac557on the same run setup.Measured on my own 1.0.2.1 corpus (shard 0/40, counts only)
main3faac557against this PR, same machine,tools/rdna2spirv.py --shard 0/40:mainspirv-val.spvbytesFAbsOther PRs
z), so whichever lands second needs a small rebase; I'll do it.main, rdna2spirv: f32 constants are module-scope OpConstants, not a bitcast at each use (-2.4% SPIR-V) #4391, rdna2spirv: a multi-dword MUBUF access builds each bounds check once #4477, rdna2spirv: a bitcast back to a value's original type is the original id (-1.4% SPIR-V) #4510, rdna2spirv: the heap base is built once in the entry block, not at every memory access (SHADER-822, -1.9% SPIR-V) #4633 and rdna2spirv: v_madak_f32 and v_madmk_f32 flush f32 denormals like v_mad_f32 #4189 (v_madak/v_madmk, which could use the helper once both land).AI-assisted (Claude Code). No game files.
🤖 Generated with Claude Code