Repository navigation
Conversation
|
Tested I built the Vulkan runtime from this head and ran the registered ps_outmods_f16 fixture. Its translated module passed spirv-val. I also checked the raw framebuffer separately: all 4,096 pixels contained exactly 0xaaaa3c00, 0xaaaa3e00, 0xaaaa4400, 0xaaaa3c00 in RGBA order. The low halves encode 1.0 and 1.5 for conversion with clamp and mul:4, then 4.0 and 1.0 for multiply-accumulate with mul:2 and clamp. Every destination retained its 0xaaaa upper half. This measures the checked-in fixture on the PR head; I did not run the base translator or the interpolation opcode. AI-assisted verification. |
|
Tested
No game files were used. |
|
Tested a79139e (merged with main 67204bf, no conflicts) on NVIDIA GeForce RTX 3060, driver 620.73.04, Linux (llvm-mc 23.1.5): pass.
AI-assisted (Claude Code). |
|
Tested a79139e on an AMD Radeon RX 7800 XT (RDNA3), RADV Mesa 26.2.6 (ACO), Vulkan 1.4.354, Fedora 44: pass. This is the first AMD result. Subgroups are 32..64, so the 27 wave64 tests the NVIDIA runs skip all run here.
GCC 16.2.1, LLVM 22.1.8 ( |
a79139e to
36fedee
Compare
|
Tested On the rebased head, the filtered This verifies the conversion and FMAC output modifiers exercised by the checked-in synthetic fixture on the RTX 5090. I ran only that fixture. AI-assisted verification. |
quackottu
left a comment
There was a problem hiding this comment.
Tested a79139e on NVIDIA GeForce RTX 5070 (subgroup 32), driver 621.24, Windows 11 Pro (26300), Vulkan SDK 1.4.363.0, llvm-mc 21.1.8 (built with scripts/build_llvm_mc.ps1), scripts/run_gpu_tests.py:
- native: 65/92 passed, 27 skipped (
main8df277f here: 64/91 passed, 27 skipped, all wave64 tests needing a 64-wide subgroup) LEONIDA_W64_EMULATE=1: 92/92 passed (mainhere: 91/91)python -m unittest discover -s tests/semantic: Ran 899 tests in 219.642s OK
|
Tested 36fedee on RTX 4090 (driver 621.14, 32-wide subgroups), Windows 11 26200: pass
The totals are below No game files used. AI-assisted run (Claude Code). |
|
RDNA2 hardware measurement of the words this PR's description says are not measured: The clamp words are right in every float mode. The output-modifier words hold only in one mode.
The reason is a hardware rule that is not in the translator at all: an output modifier is applied only when IEEE mode is off and the result type's denormals are flushed (f32 denormal field for f32 results, f16/f64 field for f16 results). Otherwise it is ignored. So this PR is right exactly when the shader runs with IEEE off and f16 denormals flushed, and main is the reverse of it on these four words: right on the two modifier words in that mode, wrong on the two clamp words in every mode. Which mode the game's shaders run in is the open question; the translator does not read it. Where the modifier does apply, the order differs from this PR. Hardware scales the f16 result after rounding it; the PR scales before narrowing. Three rows (hardware / this PR): 2^-15 Two more results from the same run, for the neighbouring rows in Not measured: gfx1013 itself, denormal modes 1 and 2, the modifier on ops other than those named. The flushed-denormal runs were wave32 only. AI-assisted (Claude Code). |
|
GPU check of
Same machine on |
|
Tested 36fedee on RTX 5060 Ti (NVIDIA 621.24, Windows 11 26200), llvm-mc 21.1.8, SPIRV-Tools v2026.4, main baseline 067d3e8: native 72 passed/0 failed/27 skipped; LEONIDA_W64_EMULATE=1 99/0/0. The PR's new ps_outmods_f16 test passes in both forms (4096/4096 pixels exact); otherwise the expected skip profile of its base on a 32-wide-subgroup GPU, no new failures vs baseline. No game files. AI-assisted (omp orchestrator). |
IAmNotSiob
left a comment
There was a problem hiding this comment.
heads up: #956 merged the v_fmac_f16 half of this (clamp_mods after fma_f16_odd), so after a rebase make sure it isn't applied twice. the v_cvt_f16_f32 part still looks needed and right, and tests pass on the pr's base. conflicts with main tho :/ AI-assisted review (Claude Code).
…s order Both were dropped. An RX 6800 rounds to f16 first, then scales, then clamps, and with an omod a zero or denormal f16 gives +0 (shelbykb2's measurement on ItsNotRexed#718).
36fedee to
06daeb1
Compare
|
@shelbykb2 thanks, that measurement changed the PR. It now follows your order on |
|
A data point for this PR, from #1722 and #1970 (SHADER-297). On RDNA2 (gfx1036 raw kernels, wave32 and wave64), an omod on an f16 result acts only with IEEE 0 and f16 denormals flushed ( The game's 1.0.2.1 shaders have no omod on any f16-result instruction (0 of 201,864), and only 18 AI-assisted. |
|
Tested Independent Vulkan check of Rebuilt the Vulkan harnesses from this head and ran the synthetic The targeted CPU semantic test AI-assisted verification. |
06daeb1 to
eab2003
Compare
|
@Sanonymous01 thanks, that settles it: in the MODE the translator assumes, the f16 omod does nothing, and #1970 drops it everywhere else. This PR is now the clamp alone for |
|
Tested Follow-up on the clamp-only revision Rebuilt the Vulkan harnesses and ran The new AI-assisted verification. |
622208d applied the omod after the rounding. On RDNA2 an omod acts on an f16 result only with f16 denormals flushed, and the translator keeps them (SHADER-297, measured on an RX 6800 and a gfx1036); the game has none on any f16 result. f16_omod goes with it.
Its six results now expect what RDNA2 gives with f16 denormals kept: the clamp acts (1.5 and 2.0 give 1.0) and mul:2 / mul:4 / div:2 don't. Two words change when the clamp is dropped, three when the omod is applied.
eab2003 to
c33e977
Compare
|
Rebased on f847748. Main already has this PR's second version: 622208d, f2ba783 and 06daeb1 came in through a merge round while the branch was at 06daeb1, so it applies the f16 omod after the rounding. With the two hardware results above, that is what RDNA2 does only with f16 denormals flushed, not in the MODE the translator assumes (SHADER-297). So the three commits here now fix main:
Checked on the RTX 2060 SUPER: |
|
Closing this one. Main went on from its second version: |
Claimed in #374 as: #374 (comment)
What and why
v_cvt_f16_f32_e64writes an f16 that the VOP3 clamp applies to: llvm-mc encodesclampon it, and Mesa ACOdeclares it
dst(F16)inaco_opcodes.py. The translator dropped the clamp, so(half)saturate(x)folded intov_cvt_f16_f32_e64 ... clampcame out unclamped.This is the third version, after two hardware data points on this PR:
On RDNA2 the clamp acts in every float mode. An omod on an f16 result acts only with IEEE off and f16 denormals
flushed. The translator keeps f16 denormals, and for that reason #1970 (SHADER-297) drops the f16 omod everywhere
else. The game has no omod on any of its 201,864 f16-result instructions. So this PR now adds the clamp and leaves
the omod dropped, which is what the hardware does in the translator's MODE. The earlier versions applied the omod.
Commits:
the
v_cvt_f16_f32handler intools/rdna2spirv.pyclamps before the rounding. That gives the same bits asclamping after it, since rounding is monotone and keeps 0 and 1.
runtime/test/shaders/ps_outmods_f16.asm, incheck.py(PIXEL_BITS), inscripts/run_gpu_tests.pyand inthe semantic fixtures, plus
test_cvt_f16_f32_clamp_without_omodwith an independent Python reference. Sixresults:
clamp, keeping the high half;mul:4;mul:2, a kept denormal;div:2;clamp mul:2;clamp mul:2.Two change when the clamp is dropped, three when the omod is applied. The name stays out of
ps_f16_*, whichtests/test_f16_hw_words.pykeeps for words measured as they stand.a "
v_cvt_f16_f32clamp" row indocs/design.mdTested
NVIDIA GeForce RTX 2060 SUPER, Linux, driver 620.70.06, llvm-mc 23.1.5, rebased on 4eb6155.
runtime/test/shaders/build.pyspirv-valruntime/test/shaders/check.pyscripts/run_gpu_tests.pypython -m unittest discover -s tests/semanticpython -m pytest tests --ignore=tests/semantictest_cf_ref.py(2) andtest_docs_design_rows.py(3), the same on mainThe skips are the wave64 tests (32-wide subgroups here) and, in
check.py, the mesh fixturesbuild.pydoesn't build.ps_outmods_f16on the GPUtest_cvt_f16_f32_clamp_without_omodThe runs above are from my own machine.
Checklist
docs/design.md, with how it was confirmed.