Skip to content

vk_compute_test: validate subgroup sizes before Vulkan startup - #7873

Open
coenflict wants to merge 1 commit into
ItsNotRexed:mainfrom
coenflict:fix-vk-compute-subgroup-size
Open

coenflict wants to merge 1 commit into
ItsNotRexed:mainfrom
coenflict:fix-vk-compute-subgroup-size

Conversation

@coenflict

Copy link
Copy Markdown

Claim in coordination issue #7694. Claim comment

vk_compute_test used atoi for VKC_SUBGROUP_SIZE, so 32junk silently requested 32 lanes and a non-power-of-two size could reach Vulkan if it fell within the device's reported range. Parse the entire decimal token before opening the shader or initializing Vulkan, and return exit 2 for invalid values. Zero still selects the device default and --require-wave64 still takes precedence.

AI-assisted (Codex). Tested on Windows 11 with MSVC 19.51, CMake 4.4.3, Ninja 1.13.2, LLVM 21.1.8, Vulkan SDK 1.4.363.0, and an NVIDIA GeForce RTX 5090 on driver 621.24.

  • Red on origin/main at dde82f27e. The new CTest got exit 1 from device selection for 32junk. Using a valid synthetic shader on the RTX 5090, upstream accepted the same value as 32 and exited 0.
  • Green after the fix. The regression passed all eight invalid input cases, and the valid shader with 32junk exited 2. Both nearby pipeline-check CTests also passed.
  • Direct GPU smoke covered automatic and explicit 32-lane selection with matching output. The full-wave64 override returned the expected skip on the RTX 5090.
  • Compute fixtures via run_gpu_tests.py --filter cs_ --require-pass. All 113 translated modules passed spirv-val. The full rerun had 77 passes, 34 skips, and zero failures. cs_dpp_bank failed on the first run, then passed in isolation and in the full rerun.
  • check_no_game_data.py passed on all three changed files. Tests used synthetic inputs.

@MartinIndra02

Copy link
Copy Markdown

AI-assisted review/test.

PASS on commit eab1eba.

  • Environment: Windows 11 x64, MSVC 19.44.35220, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.1, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124 / 621.24).
  • Build: cmake --build --target vk_compute_test (Ninja, RelWithDebInfo) — succeeded cleanly.
  • Test: ctest -R vk_compute --output-on-failure — 1/1 passed (�k_compute_subgroup_cli, 0.52s).

@jacob-rowlands

Copy link
Copy Markdown

Tested eab1ebadf merged onto main d6f8a66fc, Linux (CachyOS), no game files: pass. This adds the case the RTX 5090 can't show, a device whose subgroup range is wider than one size.

On a Ryzen 5 7600X iGPU (RDNA2, RADV, Mesa 26.3.1, subgroup 32..64), vk_compute_test <cs_bounds.spv> 1 dump with a real translated shader:

VKC_SUBGROUP_SIZE main this PR
32 exit 0, compute subgroup size: 32 exit 0, compute subgroup size: 32
48 exit 0, compute subgroup size: 48 exit 2, expected 0 or a decimal power of two, got "48"
32junk exit 0, compute subgroup size: 32 exit 2, same message

So on main, a size that isn't a power of two does reach Vulkan on RADV as requiredSubgroupSize and the dispatch runs. The validation layer isn't installed here, so I can't say whether it would flag it.

Also: vk_compute_subgroup_cli passes (CTest 65/65, main 64/64). run_gpu_tests.py gives the same results as main on the iGPU, the RTX 3080 (NVIDIA 620.73.04) and the RTX 3080 with LEONIDA_W64_EMULATE=1.

AI-assisted (Claude Code).

@Ekabusto

Copy link
Copy Markdown

Tested eab1ebadf on AMD Radeon RX 9070 XT (RDNA4, subgroup 32..64), AMD driver 26.11.2, Windows 11 10.0.26300:
pass. This adds a device that can require both 32 and 64, so it also checks that valid sizes still go through.

AI-assisted: yes (Claude ran the build and tests; results checked by me).

@justrealyme

Copy link
Copy Markdown

Tested eab1eba on NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 build 26300, VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, RelWithDebInfo: pass.

Built vk_compute_test and ran ctest -R ^vk_compute: vk_compute_subgroup_cli Passed (0.7 s).

Synthetic tests only, no game files. AI-assisted (Claude Code).

@gut0to gut0to left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parser rejects malformed, signed, whitespace-padded, hexadecimal, overflowed, and non-power-of-two subgroup values before Vulkan initialization; zero remains the device-selected default, and --require-wave64 keeps its fixed 64 behavior. Built �k_compute_test with MSVC and ran the added CTest on this PR head: 1/1 passed.

@passok

passok commented Nov 23, 2026

Copy link
Copy Markdown

Tested eab1eba on Windows 11 Home build 26300, GeForce RTX 2060 (6 GB), NVIDIA driver 610.88, MSVC 19.44 Release. vk_compute_subgroup_cli passed. scripts/run_gpu_tests.py --filter cs_w32 --require-pass: 17/17 GPU cases passed, and all 17 shaders translated and passed spirv-val (LLVM 23.1.6, SPIRV-Tools 2026.4). Synthetic input only. No game files used. AI-assisted.

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.

7 participants