Repository navigation
GPU tests: skip a draw when any stage needs OpFmaKHR the device lacks - #4262
Conversation
docs/testing.md says a module that needs OpFmaKHR exits 77 (a SKIP) on a device without VK_KHR_shader_fma, but only the fragment module was checked in vk_harness, and vk_texture_test, vk_sampler_test and vk_bindless_test never refused the vertex module (vs_ids carries FMAKHR). Under LEONIDA_FMA=khr such a pair failed vkCreateGraphicsPipelines with -13 and run_gpu_tests.py reported a FAIL. ShaderFma::accepts_file() checks one module file. vk_harness (vertex module, VKH_MESH_COMPUTE module), vk_texture_test, vk_sampler_test and vk_bindless_test use it for every stage; vk_sampler_test also enables the feature when the device has it, like the others. judge_cs_dump treats exit 77 with an "unsupported:" line as a skip for the non-wave64 dumps too (cs_w32_new_ops). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015z45kpL5aWzXuYTbhn6b52
Kam471
left a comment
There was a problem hiding this comment.
Ran this at b9a8aca1 on Windows 11, RTX 5070 Ti:
pytest tests/test_run_gpu_tests.py -q-> 41 passed, 49 subtests passed.- Built
vk_sampler_test,vk_texture_test,vk_bindless_test,vk_harness,vk_compute_test,vk_store_test. scripts/run_gpu_tests.py --filter fma-> 3/3 passed:cs_fma_fused8/8 fused exact (GLSL Fma),ps_fma_literal4096/4096 pixels exact,ps_fmac_f16_mods4096/4096 pixels exact; translator 3/3spirv-val.
This device reports the FMA extension, so the skip branch is not taken here; the normal path and the shared vk_shader_fma.h check compile and run unchanged. No blocking issue.
|
Tested b9a8aca on Windows 11 with AMD Radeon(TM) Graphics (driver 32.0.21043.5001) and NVIDIA GeForce RTX 4090 (driver 32.0.16.2101), MSVC 14.51.
I found one case that this pull request does not correct. On a GPU with 64-wide subgroups, the runner reports the wrong missing feature. Run this script from the repository root, with the path of import os, pathlib, struct, subprocess, sys, tempfile
sys.path[:0] = ["scripts", "tools"]
import run_gpu_tests as runner
import spirv_asm
assembly = """OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 64 1 1
%void = OpTypeVoid
%func = OpTypeFunction %void
%main = OpFunction %void None %func
%entry = OpLabel
OpReturn
OpFunctionEnd"""
base = spirv_asm.assemble(assembly)
ext = struct.pack("<3I", 0x20011, 6030, 0x4000a) + b"SPV_KHR_fma\0"
with tempfile.TemporaryDirectory() as temp:
for label, data in (("plain", base), ("fma", base[:28] + ext + base[28:])):
path = pathlib.Path(temp) / (label + ".spv")
path.write_bytes(data)
p = subprocess.run([sys.argv[1], str(path), "1", "dump", "--require-wave64"],
env=dict(os.environ, LEONIDA_VK_DEVICE="Radeon"),
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
print(p.returncode, p.stdout, runner.judge_cs_dump(p.returncode, p.stdout, [0xeeeeeeee],
wave64=True, partial=False, emulated=False))Actual result for the FMA module: exit 77, the output names AI-assisted. |
|
Automated test:
Same machine and setup as my earlier manual reports. AI-assisted (Claude Code). |
|
Tested b9a8aca on RTX 2070 (Turing, subgroup 32..32), NVIDIA 620.73.04, Vulkan 1.4.357, CachyOS Linux (kernel 7.3.5), llvm-mc 23.1.5. Native Linux build at this head, no game files.
Caveat: this GPU has VK_KHR_shader_fma, so I could not exercise the new skip path (a device lacking the extension); that is covered by your AMD Windows run and the pytest. This adds a Linux Turing data point for the with-extension path. AI-assisted (Tacit). |
For a whole-wave dump a missing OpFmaKHR was reported as "no 64-wide compute subgroup" on a device that does have one, because the wave64 rule ran before the reason the program printed. Read the "unsupported:" line first; without one the old text stays. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015z45kpL5aWzXuYTbhn6b52
|
Thanks @shdann, @Kam471 and @CaravelaLabs for the checks. @shdann's case is real and is fixed in the new commit: Rechecked on AMD Radeon RX 6750 XT (AMD proprietary driver 26.11.2, 64-wide subgroups), Windows 11:
AI-assisted (Claude Code). |
Flyander
left a comment
There was a problem hiding this comment.
The FMA capability gate now checks every shader stage used by the test pipelines and preserves an explicit unsupported reason before generic wave64 skip handling. Current head includes the reported 64-wide skip-reason correction; CPU tests and independent GPU runs cover both supported and unsupported devices. No blocking issue found.
|
Tested 87da932 on NVIDIA RTX 4080, driver 610.88, Windows 11: pass This is the case the description lists as untested: a device that has
So on a device with the extension nothing changes: no new failures, the same skips. Review: no findings in the new commit. The AI-assisted. |
|
RADV check on a device that has Setup: CachyOS Linux, Ryzen 7 7700X iGPU (RADV RAPHAEL_MENDOCINO, Mesa 26.3.1,
Under No game files. AI-assisted (Claude-Opus). |
TinkerBell-90
left a comment
There was a problem hiding this comment.
Tested 87da9327 merged onto main 3faac557 on NVIDIA GeForce RTX 3070 (driver 595.99.02, Vulkan 1.4.329, 32-wide subgroups), Ubuntu 26.04 (Kubuntu), native build of the runtime test programs from this tree, llvm-mc 21. No game files. I read the whole diff first (four C++ test programs, the vk_shader_fma.h header, scripts/run_gpu_tests.py and its test; nothing else is touched).
Unit tests
python3 -I tests/test_run_gpu_tests.py: 43 OK.git diff --check: clean.- This PR's tests against
main'srun_gpu_tests.py: 4 failures (the new cases). - Negative control: this PR with the new
if rc == 77:block removed: the same 4 failures.
GPU, device that has VK_KHR_shader_fma (the 3070 does)
python3 -I scripts/run_gpu_tests.py, main vs this PR; every test has the same status in both:
| run | main | this PR |
|---|---|---|
| default | 170/217 passed, 47 skipped, 0 failed | same |
LEONIDA_W64_EMULATE=1 |
201/217, 16 skipped, 0 failed | same |
shaderFloat64 hidden by a test-only Vulkan layer |
167/217, 50 skipped, 0 failed | same |
same, with LEONIDA_W64_EMULATE=1 |
198/217, 19 skipped, 0 failed | same |
I did not run LEONIDA_FMA=khr on the 3070; the runs above from throny and kmorales13 cover a device with the extension.
The skip path, on a Linux device without the extension
Mesa llvmpipe (LEONIDA_VK_DEVICE=llvmpipe, LEONIDA_FMA=khr, whole suite):
main: 113/217 passed, 74 skipped, 30 failed- this PR: 113/217 passed, 104 skipped, 0 failed
The same 113 pass; the 30 failures (cs_w32_new_ops and the vkCreateGraphicsPipelines -> -13 draws) are all SKIP now and none became PASS. 24 of the 30 quote the OpFmaKHR line. llvmpipe is a CPU device, so this checks the skip logic, not a GPU driver.
The judge with real harness output
vk_compute_test on cs_f64_add with shaderFloat64 hidden exits 77 with an unsupported: ... uses Float64 ... line. Through judge_cs_dump: main gives FAIL; this PR gives SKIP quoting that line, also with emulated=True. With --require-wave64 and output that names Float64, main says "no 64-wide compute subgroup" and this PR keeps the Float64 reason (the 3070 is 32-wide, so I built that text from the harness's own lines). A bare 77, an exit 1 that prints an unsupported: line, and the 3070's own "full 64-wide compute subgroups unavailable" 77 behave as before.
Finding
runtime/test/shaders/check.py:1503(clip_test): every 77 fromvk_harnessis reported as "SKIP (shaderClipDistance unavailable)". With the new vertex-module check,vs_clip,vs_clip_param4andvs_clip_undeclaredon llvmpipe underLEONIDA_FMA=khrskip with that text, while the harness printedvs_clip.spv needs OpFmaKHR. The verdict is right and the reason is wrong; quoting theunsupported:line asunsupported_skipdoes would fix it. Not a blocker.
Other PRs on the same lines
- #4718 changes the same part of
judge_cs_dump, forshaderFloat64only and with a fixed message. This PR'sunsupported:rule also covers that 77 (above), and FMA, and any otherunsupported:reason; #4718's tests pin an unrelatedunsupported:77 as a FAIL, so the two choices differ. They conflict injudge_cs_dump, so only one can land as is. - #2647 at
71067997addscompute_unsupportedtojudge_cs_dump. Merging this PR onto it conflicts in that one hunk; the C++ files merge cleanly. Taking #2647's side of the hunk leaves 4 of this PR's new tests failing, only because #2647 words the skipSKIP (unsupported: cs_x.spv needs ...)where these tests expectSKIP (cs_x.spv needs ...). The vertex-stage FMA checks in the C++ programs are not in #2647.
AI-assisted.
Claimed in the coordination issue as: new TEST item, claim
What and why
docs/testing.md(Fused multiply-add section) says a module that needsOpFmaKHRmakes the test program exit 77 (a SKIP) on a device withoutVK_KHR_shader_fma. That only held for the module under test invk_compute_test,vk_store_testand for the fragment module invk_harness. A draw also loads a vertex module, andvs_idsis translated withFMAKHRunderLEONIDA_FMA=khr;vk_texture_test,vk_sampler_testandvk_bindless_testnever refused it either. On such a devicevkCreateGraphicsPipelinesreturned -13 andrun_gpu_tests.pyreported FAIL, so a tester withLEONIDA_FMA=khrand a driver without the extension (AMD Windows 26.11.2 here) got 27 failures that are not bugs.ShaderFma::accepts_file(path)(runtime/test/vk_shader_fma.h) runs the existingaccepts()on one module file; an unreadable file is left to the caller's own error.vk_harnesschecks the vertex module (argv[1]) and theVKH_MESH_COMPUTEmodule as well as the fragment one;vk_texture_test,vk_sampler_testandvk_bindless_testcheck both stages and exit 77.vk_sampler_testalso enables the feature when the device has it, as the other programs already do.judge_cs_dump(scripts/run_gpu_tests.py): exit 77 with anunsupported:line is a SKIP for the non-wave64 dumps too (cs_w32_new_opsprinted the FMAKHR reason and was still a FAIL). A bare 77 stays a failure. New case intests/test_run_gpu_tests.py.No change with the default
--fma glsl, and none on a device that has the extension (the same pairs run).Tested
AMD Radeon RX 6750 XT (RDNA2), AMD proprietary driver 26.11.2 (Windows driver 32.0.21045.29003), Vulkan 1.4.315, Windows 11 Pro 10.0.26300, MSVC 14.44.35207, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0,
llvm-mc21.1.8 fromscripts/build_llvm_mc.ps1. This device does not listVK_KHR_shader_fma. Basemainaa2988c.python -I scripts/run_gpu_tests.py --build runtime/buildmainaa2988c)--fma glslLEONIDA_FMA=khrvkCreateGraphicsPipelines ... -> -13, pluscs_w32_new_ops)ctest --test-dir runtime/build --timeout 300 -j 4: 153/153 passed.python -I tests/test_run_gpu_tests.py(41 tests) andpython -I tests/test_shader_checks.py(75 tests): OK;python -m compileall -q make_game.py tools tests scripts: OK.VK_KHR_shader_fma(NVIDIA, Mesa RADV). The only new behaviour there is thatvk_sampler_testnow enables the extension and feature likevk_texture_testandvk_bindless_testdo; a run on such a GPU withLEONIDA_FMA=khrwould confirm those pairs now pass instead of failing.No game files used. AI-assisted (Claude Code).
Checklist
docs/design.mdrow is needed.🤖 Generated with Claude Code
https://claude.ai/code/session_015z45kpL5aWzXuYTbhn6b52