Repository navigation
GPU fixture: f16 denormal operands of v_cvt_f32_f16, v_pk_fma_f16, v_pk_fmac_f16 - #4488
fromthemoonx wants to merge 1 commit into
Conversation
…pk_fmac_f16 9d71037 (ItsNotRexed#3220) widened f16 operands exactly in Gen.f16_in because NVIDIA read an SDWA-selected denormal as 0. v_cvt_f32_f16, v_pk_fma_f16 and v_pk_fmac_f16 still widen with UnpackHalf2x16 directly, and no GPU fixture fed them a denormal. cs_w32_f16_denorm_widen does: denormals from a VGPR, a literal and an SDWA WORD_1 select, as multiplicands, addends and the fmac accumulator, plus a normal control word. Expected words follow from RDNA2 keeping f16 denormals. Registered in check.py and run_gpu_tests.py (wave32 dump), in regen_fixtures.py, and run on the CPU by test_f16_denorm_widen_fixture.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXR27ZYP9qtZtN8SG7QPWW
|
Tested
|
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 0c71f17e on Windows 11: python tests/semantic/test_f16_denorm_widen_fixture.py -> 3 tests, OK; git diff --check clean.
The new cs_w32_f16_denorm_widen fixture covers f16 denormal operands through v_cvt_f32_f16, v_pk_fma_f16 and v_pk_fmac_f16, with the semantic fixture check. I did not build/run the GPU case here; the fixture and its expected words are generated and checked on the CPU. No blocking issue.
|
Apple M2 data point at head 0c71f17 (macOS 26.4, MoltenVK 1.4.2 direct, subgroup 4..32, llvm-mc 23.1.6, clean full build on AppleClang 17).
Adds an Apple/MoltenVK result to the NVIDIA run in the PR body. Head fetched read-only, no rebase/edit/push. Synthetic shaders and counts only; no game files. AI-assisted. |
|
Automated test:
Same machine and setup as my earlier manual reports. AI-assisted (Claude Code). |
|
Tested
No game data. AI-assisted. |
|
A data point on the driver that had #3220's bug. I tested Hardware: AMD Ryzen 5 7600X, Windows 11 Home 26300. GPUs: NVIDIA GeForce RTX 5060 Ti, driver 610.88 (Vulkan 1.4.341, subgroup 32..32); AMD Radeon(TM) Graphics iGPU (RDNA2 gfx1036, subgroup 32..64), AMD Windows driver 24.10.24 (Vulkan driver 2.0.302). MSVC 14.44, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8, Python 3.12.10. Test programs built at the PR head with
All four give
|
Claimed in #4421 as a new TEST item (my
claiming:comment there, no ID assigned yet).What and why
9d71037 (#3220) made
Gen.f16_inwiden f16 operands exactly, because NVIDIA (RTX 5060 Ti, 610.88) read an SDWA-selected f16 denormal as 0. Three ops still widen withUnpackHalf2x16directly, outsidef16_in:v_cvt_f32_f16(tools/rdna2spirv.py:8338),v_pk_fma_f16(the VOP3P f16 path,:7015) andv_pk_fmac_f16(:6987). No GPU fixture fed them a denormal:ps_f32_mods,ps_opsandps_f16_constuse normal values only.runtime/test/shaders/cs_w32_f16_denorm_widen.asmdoes. One wave32 group stores eight words:v_cvt_f32_f16of a denormal from a VGPR (smallest positive, largest negative), from a literal, and from an SDWAWORD_1select (the operand shape of rdna2spirv: widen f16 denormal operands without UnpackHalf2x16 (NVIDIA reads them as 0) #3220)v_pk_fma_f16with denormal multiplicands, then with denormal addendsv_pk_fmac_f16with a denormal accumulatorThe expected words follow from RDNA2's f16 MODE keeping denormals (value m × 2^-24). They're computed from the IEEE half format in the CPU test.
No translator change. On a CPU run with every
UnpackHalf2x16denormal flushed (the mock from #3220's test), all seven denormal words read 0. So these ops do depend on the driver keeping denormals. But an RTX 3060 keeps them in every shape here, including the SDWA conversion (results below), so routing them through exact widening would only add instructions; see #4345 for why module size matters. The fixture makes any GPU or driver that does flush fail loudly. Related: #4296 keepsDenormPreserve 16for modules with half conversions, which this one has.Files:
runtime/test/shaders/cs_w32_f16_denorm_widen.asm: the fixture, with derivations in its headerruntime/test/shaders/check.py,scripts/run_gpu_tests.py: registered as a wave32 dump with the expected wordstests/semantic/regen_fixtures.pyandfixtures/disasm/cs_w32_f16_denorm_widen.s: the generated translator inputtests/semantic/test_f16_denorm_widen_fixture.py: runs the fixture throughspirv_mini_interp, checks the words against the IEEE values, and checks that both GPU runners expect the same wordsTested
vk_compute_testbuilt byscripts\build_runtime.ps1(MSVC, VS 2022 Build Tools).py -3.12 -I scripts\run_gpu_tests.py --filter cs_w32_f16_denorm_widen: PASS natively (32-wide subgroup) and withLEONIDA_W64_EMULATE=1, all 8 words exact.pytest tests/semantic/test_f16_denorm_widen_fixture.py tests/semantic/test_misc_ext_fixture.py tests/test_run_gpu_tests.py tests/test_shader_checks.py: all pass.tests/test_translate.py::test_gpu_samples_translate_and_validate[cs_w32_f16_denorm_widen.asm]passes with llvm-mc 20 and spirv-val 2025.1.regen_fixtures.py --check,compileallandgit diff --checkare clean.AI-assisted (Claude). No game files.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FXR27ZYP9qtZtN8SG7QPWW