subgroup_size: reject malformed device size ranges #2216

Closed
whoalin1 wants to merge 1 commit from upstream-pr/2216 into main
whoalin1 commented 2026-11-26 06:33:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-26T06:33:12Z.


Summary

  • treat half-zero, inverted, or non-power-of-two subgroup min/max ranges as malformed instead of trusting them for requiredSubgroupSize
  • keep device_default / unknown_device fallbacks when a default size is or is not available
  • add synthetic regressions for half-zero, mirror half-zero, inverted, non-power-of-two, and valid control ranges

Item: SUBGROUP-MALFORMED-CAPS

This carries forward the still-uncarried fix in old-pr/9881, originally written by Andretuta, reapplied and verified on current main.

Tests

Under the local machine coordination lock:

  • control: patched subgroup_size_test against the unpatched header fails at the first half-zero-range expectation
  • fixed: the same test compiles and exits 0: subgroup size decision: AMD-like, NVIDIA-like, old RADV, limits, create-info chain and query OK
  • git diff --cached --check — pass

A full CMake configure is not possible in this shell because it does not initialize the Windows SDK environment; the test was instead compiled directly with the same MSVC 14.44 toolset and Vulkan SDK include path used by the existing configured build. No game files or GPU.

AI-assisted with Devin.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5505223844 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2216). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-26T06:33:12Z. --- ## Summary - treat half-zero, inverted, or non-power-of-two subgroup min/max ranges as malformed instead of trusting them for `requiredSubgroupSize` - keep `device_default` / `unknown_device` fallbacks when a default size is or is not available - add synthetic regressions for half-zero, mirror half-zero, inverted, non-power-of-two, and valid control ranges Item: SUBGROUP-MALFORMED-CAPS This carries forward the still-uncarried fix in old-pr/9881, originally written by Andretuta, reapplied and verified on current main. ## Tests Under the local machine coordination lock: - control: patched `subgroup_size_test` against the unpatched header fails at the first half-zero-range expectation - fixed: the same test compiles and exits 0: `subgroup size decision: AMD-like, NVIDIA-like, old RADV, limits, create-info chain and query OK` - `git diff --cached --check` — pass A full CMake configure is not possible in this shell because it does not initialize the Windows SDK environment; the test was instead compiled directly with the same MSVC 14.44 toolset and Vulkan SDK include path used by the existing configured build. No game files or GPU. AI-assisted with Devin.
lixonik commented 2026-11-26 08:47:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T08:47:46Z.

Review: COMMENTED


The native Windows CMake build and subgroup_size CTest passed. I also compiled a separate 1,458-case CPU matrix over minimum, maximum and default properties, wave32/wave64 requests, and compute, mesh and fragment stages. The expected outcomes used power-of-two bounds checked with std::has_single_bit. The base had 414 mismatches and the PR had zero. No GPU or game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6070941886 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2216#pullrequestreview-6070941886). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T08:47:46Z. **Review:** COMMENTED --- The native Windows CMake build and `subgroup_size` CTest passed. I also compiled a separate 1,458-case CPU matrix over minimum, maximum and default properties, wave32/wave64 requests, and compute, mesh and fragment stages. The expected outcomes used power-of-two bounds checked with `std::has_single_bit`. The base had 414 mismatches and the PR had zero. No GPU or game files. AI-assisted.
real-rusher commented 2026-11-26 10:06:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T10:06:20Z.


Verified on main a73a57e1 (Ubuntu 24.04 x86-64, GCC 13, Ninja, no GPU). Merges cleanly. ctest -R '^subgroup_size$' passes with this PR. The PR's runtime/test/subgroup_size_test.cpp built against main's runtime/src/subgroup_size.h fails, so the new cases fail on main and pass with the fix.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7188913691 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2216#issuecomment-7188913691). Originally posted by [real-rusher](https://github.com/real-rusher) on 2026-11-26T10:06:20Z. --- Verified on main a73a57e1 (Ubuntu 24.04 x86-64, GCC 13, Ninja, no GPU). Merges cleanly. ctest -R '^subgroup_size$' passes with this PR. The PR's runtime/test/subgroup_size_test.cpp built against main's runtime/src/subgroup_size.h fails, so the new cases fail on main and pass with the fix. AI-assisted: yes (Claude Code)
Tauwni commented 2026-11-26 12:55:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T12:55:04Z.


Tested a286c4898 on an Apple M3 (macOS 26.5.1), with the test programs built from this branch.

  • subgroup_size_test builds with Apple clang and passes: "subgroup size decision: AMD-like, NVIDIA-like, old RADV, limits, create-info chain and query OK" (main passes too).
  • The real ranges of the three Mac drivers are all valid powers of two, and the new checks keep them: MoltenVK 1.4.2 4..32, KosmicKrisp (Mesa 26.3.1) 32..32, llvmpipe 4..4.
  • scripts/run_gpu_tests.py gives the same results as main a73a57e13 on every driver: MoltenVK 195 pass / 70 skip (229 / 36 with LEONIDA_W64_EMULATE=1), KosmicKrisp 190 / 73, llvmpipe 177 / 90 (212 / 55 emulated). The failures are the known ones (#1724, #1518, #1774 on MoltenVK, #2229's on KosmicKrisp), none new.

AI-assisted (Claude Code). No game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7192629987 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2216#issuecomment-7192629987). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T12:55:04Z. --- Tested `a286c4898` on an Apple M3 (macOS 26.5.1), with the test programs built from this branch. - `subgroup_size_test` builds with Apple clang and passes: "subgroup size decision: AMD-like, NVIDIA-like, old RADV, limits, create-info chain and query OK" (`main` passes too). - The real ranges of the three Mac drivers are all valid powers of two, and the new checks keep them: MoltenVK 1.4.2 `4..32`, KosmicKrisp (Mesa 26.3.1) `32..32`, llvmpipe `4..4`. - `scripts/run_gpu_tests.py` gives the same results as `main` `a73a57e13` on every driver: MoltenVK 195 pass / 70 skip (229 / 36 with `LEONIDA_W64_EMULATE=1`), KosmicKrisp 190 / 73, llvmpipe 177 / 90 (212 / 55 emulated). The failures are the known ones (#1724, #1518, #1774 on MoltenVK, #2229's on KosmicKrisp), none new. AI-assisted (Claude Code). No game data.
DadaCap commented 2026-11-28 07:38:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T07:38:07Z.


Thanks for this! Closing it as a duplicate of #1651 after a maintainer check that compared the two diffs commit by commit, not just the titles.

This pull request is an exact copy of #1651 (the same diff, line for line), which is older. Keeping #1651 so the fix lands once.

If you think something here is not covered by #1651, say so and we'll reopen it.

AI-assisted (Claude Code), posted for DadaCap (maintainer).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236066093 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2216#issuecomment-7236066093). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T07:38:07Z. --- Thanks for this! Closing it as a duplicate of #1651 after a maintainer check that compared the two diffs commit by commit, not just the titles. This pull request is an exact copy of #1651 (the same diff, line for line), which is older. Keeping #1651 so the fix lands once. If you think something here is not covered by #1651, say so and we'll reopen it. _AI-assisted (Claude Code), posted for DadaCap (maintainer)._

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2216
No description provided.