Skip to content

w64_graphics: a wave64 vs_/gs_ fixture skips where the stage measured 32-wide (TEST-1968) - #9275

Closed
GustawMatuszewski wants to merge 1 commit into
ProjectLeonida:mainfrom
GustawMatuszewski:fix/w64-graphics-skip-32-wide-vs
Closed

GustawMatuszewski wants to merge 1 commit into
ProjectLeonida:mainfrom
GustawMatuszewski:fix/w64-graphics-skip-32-wide-vs

Conversation

@GustawMatuszewski

Copy link
Copy Markdown
Contributor

Item: TEST-1968 (#9235) — a vs_w64_* fixture reports a failure on a device that cannot run it, instead of skipping.
Claim: #9235 (comment)

What happens today

A vs_w64_*/gs_w64_* fixture's words are derived for 64-lane waves (x = i % 64, y = i // 64), and the two widths come from RADV: wave64 by default, wave32 with RADV_PERFTEST=gewave32. A driver that runs the stage 32-wide and ignores the variable — MoltenVK/Metal, one subgroup size (32) — draws a 32-wide default run, _wave_size() cannot force 64, so draw() keeps only the default run and check() compares it against the 64-lane words. The result is default size: N of M pixels differ from the derived words: the device's wave width reported as a fixture failure.

What this changes

_wave_size() already measures the width with that stage's probe (vs_w64_c_lane_id / gs_w64_c_lane_id: the largest lane id is 32..63 in a wave64 and below 32 in a wave32). The measurement is now recorded (_measured) next to the existing "did the width take effect" flag, and check() uses it:

  • stage measured 32-wide and 64 could not be required → Skip("SKIP (the vertex|geometry stage ran a 32-wide subgroup here and could not be asked for 64 (lane N, measured with <probe>): this fixture's words are derived for 64-lane waves)"), exit 0.
  • stage measured 64-wide → unchanged: the comparison runs exactly as before.
  • probe could not run at all (unsupported: ..., i.e. it measured nothing) → unchanged: the default run is still compared, as test_unsupported_probe_keeps_default_draw requires. An unmeasured width is not evidence of 32.

The decision uses the probe's own measurement rather than matching a driver's error string, so a device that is 32-wide for some other reason is treated the same way, and a real 64-wide mismatch is still a failure. The module docstring says so next to the vs_w64_* paragraph.

Evidence

Stubbed end-to-end through main() with a synthetic vk_harness (a device: ... (subgroup 32..32) device that ignores RADV_PERFTEST, whose fixture words are deliberately wrong so a comparison cannot pass):

before:  vs_w64_a_skip  A  default size: 960 of 960 pixels differ from the derived words, first (0,0): ...   exit 1
after:   vs_w64_a_skip  A  SKIP (the vertex stage ran a 32-wide subgroup here and could not be asked for 64
                           (lane 31, measured with vs_w64_c_lane_id): this fixture's words are derived for
                           64-lane waves)                                                                     exit 0

Tests added in tests/test_w64_graphics_probe.py (the existing mock stubs gain a probe_lane knob):

  • test_a_stage_measured_32_wide_skips_instead_of_failing: a probe that reports lane 31 skips vs_w64_a_skip (vertex) and gs_w64_a_ring (geometry), exit 0, and the output names the stage and does not contain a "differ from the derived words" failure.
  • test_a_stage_measured_64_wide_still_compares: a probe that reports lane 63 still yields ok, so the skip cannot swallow a real result.

Tested

CPU only, Linux, no GPU, no LLVM/SPIR-V tools, no game files:

  • python -I tests/test_w64_graphics_probe.py → 6 tests OK
  • python -I tests/test_w64_graphics_args.py → 3 tests OK
  • python -I tests/test_w64_graphics_reference.py → 1 test OK
  • python -m compileall -q runtime/test/shaders/w64_graphics.py tests/test_w64_graphics_probe.py → clean
  • python -I scripts/check_no_game_data.py runtime/test/shaders/w64_graphics.py tests/test_w64_graphics_probe.py → exit 0

Limit

I have no macOS/MoltenVK host, so I could not reproduce the reported vs_w64_* run itself; the numbers above come from a synthetic harness driving the same code path. The MoltenVK figure for TEST-1968 still needs someone with a Mac — if the maintainer wants that recorded before this lands, this PR can wait and I will re-run on a Mac (or hand the branch to whoever has one).

@Joaco9020

Copy link
Copy Markdown
Contributor

Tested 4a7e65b6a on NVIDIA GeForce RTX 3070 (VS and GS run 32-wide, no size control for those stages), driver 621.01, Windows 11, Vulkan SDK 1.4.363.1, build.py + w64_graphics.py <dir> runtime/build/RelWithDebInfo, with this PR's w64_graphics.py and with the merge base's:

ok SKIP fail
merge base 17 12 0
this PR 12 17 0

The five that move from ok to SKIP are gs_w64_a_ring, vs_w64_a_skip, vs_w64_b_ballot_atomic, vs_w64_b_readlane_uniform and vs_w64_b_waterfall, each now SKIP (the vertex/geometry stage ran a 32-wide subgroup here and could not be asked for 64 …).

So on NVIDIA this trades a real check for a skip: these tier A/B fixtures pass today on a 32-wide VS/GS. Their 32-wide default run matches the 64-lane derived words, which is what tier A/B promise (the output doesn't depend on how the wave is cut), and it's the only NVIDIA/Windows evidence for them (e.g. #7311's vs_w64_a_bpermute was checked this way on the 3070, 5080 and 4060 Ti). The 4 tier C ones were already SKIP here.

Suggestion: keep the new skip for what the MoltenVK case actually needs, e.g. only for tier C, or only when the 32-wide default run differs from the derived words and the fixture isn't tier A/B, so a 32-wide device that agrees with the derived words keeps reporting ok. Happy to re-run a revised head on this card. Synthetic fixtures only, no game files. AI-assisted (Claude).

@singul-oss

Copy link
Copy Markdown

AI-assisted test. Requesting a change: on NVIDIA this turns five passing fixtures into skips.

Tested 4a7e65b6 merged onto main 867d922f on Windows 11 Home 10.0.26200, NVIDIA GeForce RTX 5080 (driver 610.88, subgroup 32..32), Vulkan SDK 1.4.363.0, llvm-mc 23.1.6. Ran runtime/test/shaders/build.py and then w64_graphics.py on the same SPIR-V and tools for both trees.

  • python -I tests/test_w64_graphics_probe.py: 6 tests OK.
  • w64_graphics.py on main: gs_w64_a_ring, vs_w64_a_skip, vs_w64_b_ballot_atomic, vs_w64_b_readlane_uniform and vs_w64_b_waterfall are all ok. The default 32-wide run matches the 64-lane words exactly here.
  • With this PR, those five are SKIP (the vertex stage ran a 32-wide subgroup here ... (lane 29, measured with vs_w64_c_lane_id), and lane 9 for the geometry stage). Every other fixture is unchanged. Three ps_w64 fixtures crashed once while other GPU work was running in parallel, but passed twice on both trees when rerun, so they're unrelated.

So on NVIDIA (32 only, ignores RADV_PERFTEST) the probe's "ran 32-wide" is true, but the tier A/B words still match. Tiers A and B are the partition-invariant ones, so a 32-wide run that matches is real coverage. The skip removes the only check these fixtures get on NVIDIA.

A suggestion that keeps both outcomes: compare the default run first, and turn a mismatch into this skip when the probe measured a 32-wide stage. MoltenVK then skips instead of failing (TEST-1968), and NVIDIA keeps its five passes.

@k-9810

k-9810 commented Nov 23, 2026 •

Copy link
Copy Markdown

tested 4a7e65b6a on apple m4, macos 26 (darwin 25.5), moltenvk 1.4.2 (homebrew; vulkan-loader/headers 1.4.363.0). the 7 vs_w64_* fixtures still fail on moltenvk with this change alone. they skip only with #8885.

tools/vk_subgroup_info.py --stage-caps on this device: subgroup_size 32 (4..32), required_subgroup_size_stages 0, supported_subgroup_stages 50 (0x32 = tessellation control | fragment | compute; no vertex, no geometry).

so on moltenvk the vertex stage has no subgroup operations at all. it is not running 32 wide. spirv-cross rejects the shader (Subgroup builtins are not available in this type of function), and vkCreateGraphicsPipelines returns -3. that happens before _wave_size() can measure a width, so the new "measured 32-wide" skip never fires here.

w64_graphics.py <build> <build>. spir-v was built once with build.py (llvm-mc 23.1.5) from the 29 ps/vs/gs_w64_* fixtures plus vs_ids and ps_live_width. it is byte-identical at all three commits, so only vk_harness and the script differ between runs. vk_harness was built natively on the m4 at each commit:

tree ps_w64 (20) vs_w64 (7) gs_w64 (2) exit
main 6312c057 20 SKIP 7 FAIL (pipeline -3) 2 SKIP 1
#8885 63c80b32 20 SKIP 7 SKIP ("device has none in the vertex stage") 2 SKIP 0
#9275 4a7e65b6 20 SKIP 7 FAIL (pipeline -3, same as main) 2 SKIP 1
#9275 + #8885 (clean local merge) 20 SKIP 7 SKIP 2 SKIP 0

#8885 is what fixes the moltenvk case (TEST-1968's original report). this pr's description says moltenvk/metal runs the stage 32 wide, and that does not hold on this m4. together with the two nvidia checks above (5 fixtures that pass become skips), it looks like this pr's skip only ever fires on devices where those fixtures pass. the two prs merge cleanly, but #9275 adds nothing on moltenvk.

no game files. AI-assisted (local qwen 3.8 27b)

@RAINighty

Copy link
Copy Markdown

Tested 4a7e65b6a merged with main 6312c057f (clean merge) on Windows 11 (10.0.26300), Python 3.13.15 in UTF-8 mode (PYTHONUTF8=1; venv with the pinned tests/requirements.txt), with llvm-mc 21.1.8 (AMDGPU) and SPIRV-Tools v2026.4 on PATH: pass.

  • tests/test_w64_graphics_probe.py with this PR: passes (Ran 6 tests in 0.027s, OK). On main: passes (Ran 4 tests in 0.016s, OK).
  • Negative control: this PR's test with main's version of runtime/test/shaders/w64_graphics.py fails (Ran 6 tests in 0.015s, FAILED (errors=9)), so the new test does catch the problem.
  • Code not reviewed beyond running it. No GPU or game files.

AI-assisted (Claude Code).

@Michele0303

Copy link
Copy Markdown

checked: #9275 at 4a7e65b6 | base: main@5d74c27 | on: macOS 27.0.1 arm64 (Apple M5), MoltenVK 1.4.2, Python 3.13 | result: no change on MoltenVK, w64_graphics.py still exit 1 with the 7 vs_w64_* failing
The probe vs_w64_c_lane_id fails at vkCreateGraphicsPipelines too ("Subgroup builtins are not available in this type of function"), so _measured stays empty and the new skip never fires; gs_w64_* skip here anyway (no geometryShader).
The 7 skip only with #8885's vk_harness (exit 0), from its subgroup-stage check. Python tests: probe 6 OK, args 3 OK, reference 1 OK.
AI-assisted (Claude Code). No game data.

@cooooooto

Copy link
Copy Markdown

Independent Apple M4 / MoltenVK validation of current head 4a7e65b6a against base 6312c057f.

Host: Mac mini (Apple M4), macOS 27.0.1 (26A434), MoltenVK 1.4.2, Vulkan loader/headers/tools 1.4.363.0, Python 3.12.16, AppleClang 21.0.0, CMake 4.5.1, LLVM/llvm-mc 23.1.6, SPIRV-Tools v2026.4. No game files. vk_subgroup_info.py --stage-caps reports subgroup size 32 (range 4..32), supported_subgroup_stages=0x32 (tessellation-control | fragment | compute), and required_subgroup_size_stages=0; vertex and geometry are not supported subgroup stages.

I built base and head in separate directories and translated the same 32 hand-written fixtures for each: 32/32 translated and 32/32 passed spirv-val on both. The PR's unit tests pass (6/6; base is 4/4), as do the args/reference tests, compileall, and check_no_game_data.

The real GPU result is identical on base and head: 22 SKIP, 7 FAIL, exit 1. The 2 GS fixtures skip because MoltenVK has no geometry stage; all 20 PS fixtures skip for the documented subgroup-size reasons. All 7 vs_w64_* fixtures still fail while creating the pipeline with Subgroup builtins are not available in this type of function and vkCreateGraphicsPipelines -> -3. The new measured-32 skip never fires: the vertex probe cannot create a pipeline, therefore no lane is measured and _measured[("vs", 64)] remains None. A compatible positive control (ps_flat --require-pass) passes 1/1 on both builds, so this is not a general harness or MoltenVK failure.

I also ran a synthetic negative control against the unmodified PR module. With a probe reporting lane 31, both correct output and output with the first expected word deliberately corrupted return SKIP, exit 0. With lane 63, the same corruption is detected as 1 of 960 pixels differ, exit 1. The new branch therefore returns before the expected-word comparison and can hide a mismatch on devices that do reach the measured-32 path.

Conclusion: not a pass on Apple M4/MoltenVK. This PR alone does not resolve TEST-1968 on this driver, and its new skip is broader than an unsupported-stage check. This is consistent with the capability problem addressed by #8885, but I did not merge or modify either PR for this validation.

AI-assisted validation; all GPU commands were actually executed on the M4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants