Repository navigation
Conversation
v_div_fixup_f32 stopped translation. The rule is measured natively on RDNA2 gfx1036 with tools/hw_oracle (5,072 operand triples with modifiers) in the game's MODE with f32 denormals flushed. S0 is not flushed, and a NaN quotient gives a signed inf. Translated with integer operations. Adds the cs_div_fixup_f32 GPU compute dump (20 cases, words derived by hand), a semantic test with a plain-Python reference and the docs/design.md contract row. AI-assisted.
# Conflicts: # docs/design.md # tools/rdna2spirv.py
|
Tested b2d3f51 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: pass.
Build note: the full build fails on AppleClang 17 at vk_pipeline_check.cpp (the floating-point AI-assisted. |
|
Code read of
AI-assisted review (Claude Code). |
|
Independent f32 division fixup draw ( Synthetic inputs only. AI-assisted (Codex). |
Desamodeth
left a comment
There was a problem hiding this comment.
Tested b2d3f51f merged locally with b8259d91 on Windows, CPU only. The base translator rejected v_div_fixup_f32 as unsupported. I ran a synthetic wave32 program with the destination sharing each source register in turn, first with even lanes active, then with odd lanes active. All 192 output words matched bit for bit. Inactive lanes retained the original destination, including NaN payloads, and the input and guard memory stayed intact.
The semantic suite passed (4,136 passed, 3 skipped without SPIRV-Tools), as did all 69 shader-runner unit tests and the fixture regeneration check.
AI-assisted review (Codex Astra 6.2 High).
|
Rechecked in real wave64 with the hw_oracle fix in #2961: same words. AI-assisted. |
|
Tested b2d3f51 on Steam Deck LCD (Van Gogh, RADV Mesa 26.2.0-devel, SteamOS 3.9.5, kernel 7.2.7-valve2-2-neptune-72-g31504582a073): pass. Commands run (from the PR worktree, against the existing
The 14 skips are the expected D3D12-owned fixtures and AI-assisted (OpenCode). |
|
Tested
Translator: 1 shader translated, spirv-val clean. Adds NVIDIA Blackwell coverage for this rule (prior checks were Apple M2, Mesa llvmpipe, and AMD RADV / Steam Deck). AI-assisted. |
|
Tested
The 5,072-program gfx1036 measurement's rule (sign from S1 xor S2, S0 not flushed) holds bit-for-bit through the translated SPIR-V on NVIDIA silicon too — a clean cross-vendor confirmation. AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine. |
|
Coordination note, since #2858 implements the same instruction:
#2858 is already recorded as the dependency of #3011 (the TEST-545 rewrite), and it agrees with the existing "output modifiers on hardware" row. Suggest landing #2858 first and rebasing this one to add its GPU fixture and AI-assisted, no game files, no GPU. |
The first measurements used the oracle's default kernels, which run with IEEE on. All cases were run again as raw kernels with IEEE off, DX10_CLAMP on and f32 denormals flushed (the game's MODE): there omod scales the result before clamp (a zero or denormal result becomes +0, a NaN is kept), and a signalling NaN is not quieted. Translation, fixture, reference words and the design.md row follow that. AI-assisted.
|
Tested b2d3f51 merged onto main 1628210 on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:
AI-assisted (Claude Code). |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): No problems found. ctest on the RTX 4080 SUPER: 129/129 passed. Intel UHD 770 ctest: only the two known base failures, d3d12_descriptor (fixed by #2948) and d3d12_subgroup (fixed by #2934). |
docs/design.md tests/test_shader_checks.py AI-assisted.
runtime/test/shaders/check.py tests/semantic/regen_fixtures.py tests/test_shader_checks.py tools/rdna2spirv.py AI-assisted.
|
Tested
AI-assisted (Claude Code). Synthetic shaders only, no game files. |
|
Tested The submitted
Only the two input literals changed between runs. This checks the translated shader on this Vulkan device. AI-assisted (Codex). AI-assisted verification. |
|
Tested Ran AI-assisted verification with synthetic inputs. |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-F32-DIV-FIXUP (claim comment)
Update: the first measurements used the oracle's default kernels, which run with IEEE on. I re-ran all cases as raw kernels in the game's MODE (IEEE off, DX10_CLAMP on, f32 denormals flushed). There
omodscales the result beforeclamp(a zero or denormal result becomes +0, a NaN is kept), and a signalling NaN passes unchanged. The translation, fixture words, reference and design.md row now follow the game's MODE, and they match all re-measured cases in the interpreter (0 mismatches). GPU tests were re-run: 64/64 on both the RTX 5080 and the Radeon. With IEEE on, omod is ignored and sNaNs are quieted; that mode is documented, not translated.What and why
v_div_fixup_f32stopped translation withUnsupported. It is the last step of LLVM's IEEE float division, afterv_div_scale_f32(#2777) andv_div_fmas_f32(#2441). #2477 implements the f16 and f64 forms, but not f32. #2096 only adds a standalone interpreter test.The rule comes from native RDNA2 measurements (
tools/hw_oracleon the gfx1036 iGPU, 5,072 operand triples includingabs/neg/clamp/omod, plus the fixture cases in wave32 and wave64). They were taken in the game's MODE, with f32 denormals flushed. S0 is the quotient, S1 the denominator and S2 the numerator.abs/negact on the sign bits first. A denormal S1 or S2 reads as a zero of its sign, but S0 is not flushed. With s = sign(S1) xor sign(S2), the first match wins:clampgives +0 for NaN, zeros and negatives, and 1.0 from 1.0 up.omodscales the result beforeclamp(IEEE off; ignored with IEEE on). The translation uses integer operations only. v_div_fmas_f32 is left to #2441.runtime/test/shaders/cs_div_fixup_f32.asm: compute dump of 20 cases, with each expected word derived by hand in the header. It covers every row of the table, the -150 boundary from both sides, the denormal numerator and quotient,abs/neg,clampandmul:2(applied: IEEE off).tests/semantic/test_value_semantics.pyDivFixupF32: a plain-Python reference gives the 20 words, and the translated fixture produces them in the interpreter.docs/design.md: a contract row.Tested
tests/semantic/spirv_mini_interp.py: 0 mismatches against hardware. The 20 fixture cases gave the same words on the oracle in wave32 and wave64.scripts/run_gpu_tests.py --filter div_fixup:cs_div_fixup_f32gives 64/64 dumped words exact and passesspirv-val, on NVIDIA GeForce RTX 5080 (driver 616.92) and AMD Radeon RDNA2 iGPU (Ryzen 9 9950X3D, driver 26.10.1), Windows 11.Unsupported: v_div_fixup_f32.word 13: expected 0xff800000, got 0x80000000) and inDivFixupF32. Reverted.python -m unittest discover -s tests/semantic,python tests/semantic/regen_fixtures.py --check,python -I tests/test_shader_checks.py,compileall: OK. This PR and rdna2spirv: translate v_div_scale_f64 from RDNA2 measurements #2703 / rdna2spirv: translate v_div_scale_f32 from RDNA2 measurements #2777 each changeTOTALintests/test_shader_checks.pyfrom 11 to 12, so the later ones need it raised.AI-assisted.
Checklist
docs/design.md, with how it was confirmed.