Repository navigation
rdna2spirv: v_cmp_class_f16 and v_cmpx_class_f16, measured on RDNA2 - #2254
evilclanker9000 wants to merge 5 commits into
Conversation
Both raised Unsupported. They test the ten class bits of v_cmp_class_f32 on the binary16 word of the source's low half: high half and mask bits above 9 ignored, an inline float constant is the f16 value, neg/abs act on bit 15, f16 denormals are denormals. Measured natively on gfx1036 (raw kernels through tools/hw_oracle, wave32 = wave64). cmp_class gets an f16 mode; the f32 path is unchanged. GPU test cs_w32_cmp_class_f16 (rejected on main), semantic fixture and test, design.md row with the measurement. AI-assisted.
|
Tested on Windows 11 with two GPUs on one machine (MSVC 14.51, llvm-mc 23.1.6): pass. |
|
Tested llvm-mc 21.1.8, Vulkan SDK 1.4.363.0. Test programs built with
No game data involved. AI-assisted (Claude Code): it ran everything above on this machine. |
|
Tested ba71b6c on AMD Radeon RX 9070 XT (RADV GFX1201) and on the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass.
No game files. AI-assisted. |
|
Tested ba71b6c on NVIDIA GeForce RTX 4070 (subgroup 32..32), driver 617.42, Windows 11 (26300): pass. |
|
Read ba71b6c (translator rule and tests). No translator bug found; two gaps in the new tests:
AI-assisted: the review was done by Codex (gpt-6.2-sol); both points were checked against the code. |
|
Tested ba71b6c on Windows 11 Home 26300: pass, on an RDNA2 iGPU with an older driver (24.10.24) and an RTX 5060 Ti. AI-assisted (Claude Code). Hardware: AMD Ryzen 5 7600X; iGPU AMD Radeon(TM) Graphics (RDNA2, subgroup 32..64), AMD driver 24.10.24 (Vulkan driver 2.0.302); NVIDIA GeForce RTX 5060 Ti, driver 610.88 (subgroup 32..32). MSVC 14.44, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8, Python 3.12.10. Test programs built at ba71b6c. Implicit layers off. No game files.
Whole suite (
Most of the Radeon skips are its 128-byte push-constant limit (#2048 isn't in this base).
|
|
Rechecked in real wave64 with the hw_oracle fix in #2961: same words. AI-assisted. |
Conflicts: docs/design.md runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py tools/rdna2spirv.py (cmp_class: the f16 path from this PR, main's raw-bit abs/neg for both widths) AI-assisted.
|
Rechecked in game MODE (IEEE off, DX10_CLAMP on, f32 denorm flush): same words. AI-assisted. |
docs/design.md AI-assisted.
docs/design.md tools/rdna2spirv.py runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py main translates v_cmp_class_f16 now; this branch keeps the GPU fixture cs_w32_cmp_class_f16 and its semantic test, which pass against main. AI-assisted.
|
Merged main. Main now translates v_cmp_class_f16 / v_cmpx_class_f16 (and f64), so I took main's tools/rdna2spirv.py and design.md. What is left is the GPU fixture cs_w32_cmp_class_f16 and tests/semantic/test_cmp_class_f16.py; both pass against main's translation (fixture on the Radeon iGPU, gfx1036). AI-assisted. |
|
Tested Confirmed @pwu2775-dev’s absolute-value coverage finding on the rebased head
Changing the fixture input from AI-assisted verification. |
|
Tested
One note on the description: after the rebase this PR no longer changes No game files. AI-assisted (Claude Code). |
|
Tested
Not run: AI-assisted (Claude Code). |
runtime/test/shaders/check.py scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py AI-assisted.
|
Tested 0fdebfa on Intel UHD Graphics 630 (CFL GT2), Mesa ANV: run_gpu_tests.py --filter cs_w32_cmp_class_f16 prints "PASS cs_w32_cmp_class_f16 1 2 4 16 32 128 8 256" and "1/1 passed". With LEONIDA_VK_DEVICE=NoSuchDevice it fails with "no Vulkan physical device matches". test_cmp_class_f16 runs 3 tests OK, tests/test_shader_checks.py runs 86 tests OK and regen_fixtures.py --check exits 0. I did not run main or the PR's exponent-edit control on this GPU. AI-assisted. |
|
Tested The absolute-value coverage gap persists at
Changing the fixture input from AI-assisted verification. AI-assisted verification. |
|
Tested |
|
Tested 0fdebfa on two Vulkan devices, Windows 11, Vulkan SDK 1.4.363, MSVC 14.50, llvm-mc 23.1.6 (AMDGPU, LLVM-MinGW build):
AI-assisted. No game files. |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-HW-CMP-CLASS-F16 (claim)
What and why
v_cmp_class_f16andv_cmpx_class_f16had no translator rule (Unsupported: v_cmp_class_f16). They are the f16 form ofv_cmp_class_f32, which the translator already handles.Measured natively on an RDNA2 iGPU (gfx1036, AMD driver 26.10.1) with raw kernels through
tools/hw_oracle, wave32 and wave64 identical:0x3c007c00is +inf and0x00010000is +0.0xfffffd00against 1.0 matches through bit 8).1.0is +normal, and-0.5is -normal.negandabsact on bit 15:-vof 1.0 is -normal,|v|of 0x8001 is +denormal, and-|v|of -inf is -inf.denorm_mode_16_64 = 3, the kernel default and the MODE the translator assumes.v_cmpx_class_f16(e32 and e64) keeps or clears the lane.The full sweep covers all ten bits for ±0, ±denormal, ±normal (including 0x0400 and 0x7bff), ±inf, and quiet and signalling NaNs of both signs.
The fix gives
cmp_classan f16 mode with 1/5/10-bit fields. The operand is read throughsrc_h(an f16 inline constant), and the modifiers are applied as bit operations. The f32 path is unchanged.runtime/test/shaders/cs_w32_cmp_class_f16.asm: seven values. Each one is tested against its own class bit (must be true) and against the other nine bits (must be false). One word covers the e32 form with VCC and a constant, and the test also runs a falsev_cmpx_class_f16(EXEC restored afterwards) and a true one before the stores. The expected words are derived by hand in the header.tests/semantic/test_cmp_class_f16.py(+ fixture) runs it on the CPU against a Python classifier.docs/design.md: the "Floating-point class compare" row now has the f16 ops and the measurement.Tested
python -I scripts/run_gpu_tests.py --filter cs_w32_cmp_class_f16: PASS 8/8 words (1 2 4 16 32 128 8 256) on an NVIDIA GeForce RTX 5080 (driver 616.92) and on the AMD Radeon RDNA2 iGPU (Ryzen 9 9950X3D, driver 26.10.1).vk_compute_testreports the devices asNVIDIA GeForce RTX 5080 (subgroup 32..32)andAMD Radeon(TM) Graphics (subgroup 32..64).mainthe test fails withmissing .spv (translation failed)(v_cmp_class_f16), and the semantic test errors withUnsupported.v_cmpx_class_f16 +inf, 0x200turns lane 0 off and no word is stored. It also fails the semantic test.v_cmpx_class_f16) match the hardware's in both wave sizes.python -m unittest discover -s tests/semanticpasses,regen_fixtures.py --checkis clean, andtests/test_shader_checks.pypasses.tests/test_docs_design_rows.pyhas the same 3 failures as onmain(repeated topics already there).AI-assisted.
Checklist
docs/design.md, with how it was confirmed.