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
|
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
|
|
Thanks, everyone. A summary of the checks, all at 0c71f17. The fixture gives the same eight words everywhere:
The gfx1036 row matters most: it's the console's GPU family, so the hand-derived expected words are now measured on RDNA2 rather than derived only. And with no driver flushing these shapes, leaving the translator alone holds up. If any future driver flushes, this fixture is what will catch it. AI-assisted (Claude). |
|
Merges cleanly into main 3faac55. discover gives 3/3 (the direct python -I ModuleNotFoundError reproduces identically for main's own fixture suites — documented discover-mode, not your bug), the three sibling fixture suites and the registry guard pass, compileall clean. Best-constructed test of the lot: reference pins, interpreter checks, and the third test parses check.py and run_gpu_tests.py so the GPU runners cannot drift — and all eight words match my independent binary16 re-derivation. The premise checks out in code: v_cvt_f32_f16 (rdna2spirv.py:8916) and the VOP3P block (:7424) emit UnpackHalf2x16 directly without f16_in()'s denormal fix-up. Two fixes: regen_fixtures.py now has the orphaned "VOPC f32 NaN..." comment fragment sharing a line with your new entry, and this branch CONFLICTS with open #4491 in check.py and run_gpu_tests.py (verified), so whichever lands second rebases. The branch reports no CI checks. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
0c71f17 to
13d7126
Compare
|
@memorypressure, thanks for the review. Both points are fixed in 13d7126:
Re-checked on Linux after the rebase: A correction to my summary table above: I mixed up who ran what. It should read: RX 7800 XT (RADV): mrbean56; Radeon 8060S (RADV), whole suite: CaravelaLabs; Apple M2 (MoltenVK): bobcatchris; Windows 11 CPU check: Kam471; RDNA2 iGPU and RTX 5060 Ti: smowlyy. Sorry for the mix-up. AI-assisted (Claude), no game files. |
|
Tested The stock native wave32 fixture matched all eight expected words after the rebase. I also checked the subnormal-to-normal boundary for both halves of Word 6 returned AI-assisted verification. |
|
Tested
This adds a native AMD/RDNA2 result; no game files were used. |
13d7126 to
472c770
Compare
|
Rebased again onto main 2dbcb88 (472c770): main added |
|
Tested
Xbox 1.0.2.1 coverage: 9,267 of 26,503 local |
…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
472c770 to
95742c0
Compare
|
Rebased onto main 6adeaf0 (95742c0). #6680 replaced regen_fixtures.py's SHADERS list with a marker line in each source, so the fixture's .asm now carries |
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