mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:15:52 +01:00
[PR #148] subgroup_size: reject half-zero and invalid subgroup size ranges in decide_subgroup_size #201
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#201
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/148
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9881📝 Commits (1)
136e1d1subgroup_size: reject half-zero and invalid subgroup size ranges in decide_subgroup_size📊 Changes
2 files changed (+75 additions, -4 deletions)
View changed files
📝
runtime/src/subgroup_size.h(+8 -4)📝
runtime/test/subgroup_size_test.cpp(+67 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116742311
(Resubmission of
#9245, which was previously approved by@abnalstlll-bytewith 4 additional cross-platform passes on MSVC, Linux GCC, and clang-cl/Wine before being closed during the repo transfer cleanup; cleanly rebased ontoProjectLeonida/Leonidamain7e39a81eaand re-verified.)Summary
decide_subgroup_size()inruntime/src/subgroup_size.hcheckscaps.min_size &&before treating[min_size, max_size]asdevice_fixed, but omits a validity check on[min_size, max_size]forrequirableandunknown_device:min_size == 0, max_size > 0):r.wanted >= caps.min_size && r.wanted <= caps.max_sizeevaluates32 >= 0 && 32 <= 64(and64 >= 0 && 64 <= 64) astrue, returningSubgroupOutcome::requiredand chainingVkPipelineShaderStageRequiredSubgroupSizeCreateInfo(plusVK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BITfor compute) even thoughminSubgroupSizewas not reported (VUID-VkPipelineShaderStageRequiredSubgroupSizeCreateInfo-requiredSubgroupSize-02761).unknown_devicecheck:(default_size == 0, min_size == 32, max_size == 0)returnsSubgroupOutcome::unknown_device, whereas(default_size == 0, min_size == 0, max_size == 64)bypassed!caps.default_size && !caps.max_sizeand returnedSubgroupOutcome::required.VkPhysicalDeviceSubgroupSizeControlPropertiesrequires power-of-two bounds with1 <= minSubgroupSize <= maxSubgroupSize; malformed bounds such asmin_size = 24, max_size = 64ormin_size = max_size = 48could previously satisfyrequirableordevice_fixed.Changes
runtime/src/subgroup_size.h:valid_range = subgroup_is_power_of_two(caps.min_size) && subgroup_is_power_of_two(caps.max_size) && caps.min_size <= caps.max_size.unknown_deviceon!caps.default_size && !valid_range, and requirevalid_rangefor bothfixedandrequirable.default_size == 0) behave identically to before; invalid/half-zero ranges with a non-zerodefault_sizecleanly fall back todevice_defaultorunavailablewithsize == 0andflags == 0.runtime/test/subgroup_size_test.cpp:0..64withdefault_size64, 32, and 0), mirror half-zero (32..0), inverted ranges (64..32), non-power-of-two bounds (24..64,48..48), and the valid-rangedefault_size == 0control.Verification (rebased onto
7e39a81ea)Vulkan-Headers6802bb47(SHA256=9044fbb356160e43201dc2094acb44c8a906722a63a35f48fc0f051579db9bb6), CPU only (no GPU, no game files).main):subgroup_size_testfailed atline 218: r.outcome == SubgroupOutcome::device_default && r.size == 0 && r.flags == 0.7e39a81ea):cmake --build runtime/build --config Release --target subgroup_size_test-> clean build.ctest --test-dir runtime/build -C Release -R ^subgroup_size$ --output-on-failure -V-> 1/1 passed (0.04 sec)./std:c++20 /W4 /WX /permissive- /utf-8-> 0 warnings, 0 errors.python -I scripts/check_no_game_data.py runtime/src/subgroup_size.h runtime/test/subgroup_size_test.cpp-> exit0.git diff origin/main..HEAD --check-> exit0;0CR (\r) bytes.Clean-room & disclosure
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.