Repository navigation
Shader: return the RDNA2 v_fract_f16 infinity word - #3032
Conversation
Both infinity signs produce a negative quiet NaN on gfx1036. A shader can inspect that sign as integer data and use it to choose a color. Select the measured result explicitly and handle its DX10 clamp before FClamp.
|
Tested Independent Linux Vulkan check of
Reverting only the translator hunk and repeating the 1.5 control produced AI-assisted verification. |
|
Tested
gfx1151 is RDNA 3.5, not RDNA2: this shows the translated SPIR-V gives the modelled words on a real driver, not that RDNA2 hardware does. AI-assisted (Claude Code). |
|
Tested
The GPU side is fine: AI-assisted (Claude Code). |
The semantic CI job discovers tests with unittest. Run the numerical fixture there and retain compiled shader validation in the tool-backed pytest job.
|
I reproduced the Windows |
|
Tested 1. Native hardware. AMD Radeon iGPU (Ryzen 9 9950X3D,
So it's 2. On the GPU, with a run-time operand. A hand-written compute shader (not part of this PR) takes the half from
So before the change the result depended on the driver: NVIDIA gave Also: |
Kam471
left a comment
There was a problem hiding this comment.
The fix itself is correct: main fails (0x13577E00 != 0x1357FE00), the 0xfe00 infinity word matches the gfx1036 measurement / f16 invalid-result rule, and both mutations are caught (0xFFC00000 -> 0x7FC00000 fails; removing the clamp special-case fails). But the test wiring is broken in the suite it was added to:
tests/semantic/test_fract_f16_infinity.pyis pytest-only in a directory CI runs withunittest discover;python -m unittest discover -s tests/semanticraisesModuleNotFoundError: No module named 'conftest'.@requires_toolsalso needsllvm-mc, which the semantic CI job does not have.
Please either move the test to the pytest-set files (PYTEST_FILE_MARKERS) or rewrite it as a stdlib unittest module that assembles/translates without requiring conftest, and gate the LLVM dependency explicitly so the semantic job runs it rather than erroring. The code change can stay as-is.
Keep the targeted regression and the intervening upstream changes together for review.
|
Tested
The new fixture is a CPU (interpreter) fixture, so the changed lowering was not run on hardware here. This run shows it breaks nothing else on AMD. AI-assisted (Claude Code). No game files. |
|
Tested
A testing note worth its own paragraph for other GPU testers: my first run of this branch showed a baffling AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine. |
Claimed in the coordination issue as the v_fract_f16 infinity result.
What and why
A pixel shader can treat a half-precision result as integer bits. The fixture extracts the sign of
v_fract_f16(+inf)and converts it to an MRT channel. Upstream's CPU output was 0.0. The result word on gfx1036 is0xfe00for either infinity, giving a channel of 1.0. With DX10 clamp enabled the clamped result is positive zero. The translator now selects those results explicitly. The reference comes from the published RDNA2 exhaustive measurement.Tested
0x7e00and the derived color channel was 0.0. The updated translator returned0xfe00twice and the channel became 1.0. The test also checks the preserved upper halves, clamped positive and negative infinity, and a finite control (1.5 gives 0.5).Checklist
docs/design.md, with how it was confirmed.AI-assisted with Codex.