mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 16:08:37 +00:00
MoltenVK reports subgroups 4..32 and requiredSubgroupSizeStages 0, so VKC_SUBGROUP_SIZE=32 printed "not available" and the 32-lane compute tests skipped. The translator emits SPIR-V 1.5, where varying subgroup sizes are not allowed, so Vulkan fixes SubgroupSize at the device's subgroupSize (32 there). vk_compute_test now runs a probe shader (cs_wave_probe.comp, embedded) with the test's local size and flags first, checks every invocation's lane, subgroup number and ballot width, and runs the test if they match. If they don't, the test fails (exit 1) instead of being skipped. Full subgroups are requested where local size X is a multiple of maxSubgroupSize. Devices whose default isn't the requested size keep printing "not available".
32 lines
1.5 KiB
Plaintext
32 lines
1.5 KiB
Plaintext
#version 450
|
|
// vk_compute_test's subgroup probe (cs_wave_probe_spv.h). Where the device can't pin a compute subgroup size
|
|
// (MoltenVK: requiredSubgroupSizeStages is 0), vk_compute_test runs this first, with the test shader's local size
|
|
// and pipeline flags, and checks what each invocation reports: its subgroup's size, its lane and subgroup number,
|
|
// and how many lanes a ballot of the whole subgroup counts. The ballot is the real width: MoltenVK's MSL declares
|
|
// SubgroupSize as the constant 32, while the lane, the subgroup number and simd_ballot come from the hardware.
|
|
// Four words per invocation at base + 16 * gl_LocalInvocationIndex, the buffer address in the first push-constant
|
|
// words (s0, s1), so the probe fits the 128-byte push-constant layout of --pc-tail-ubo as well as the 144-byte one.
|
|
#extension GL_EXT_buffer_reference : require
|
|
#extension GL_EXT_buffer_reference_uvec2 : require
|
|
#extension GL_KHR_shader_subgroup_basic : require
|
|
#extension GL_KHR_shader_subgroup_ballot : require
|
|
|
|
layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;
|
|
|
|
layout(buffer_reference, std430, buffer_reference_align = 4) buffer Words {
|
|
uint w[];
|
|
};
|
|
|
|
layout(push_constant) uniform UserData {
|
|
uvec2 base;
|
|
} pc;
|
|
|
|
void main() {
|
|
Words o = Words(pc.base);
|
|
const uint i = gl_LocalInvocationIndex * 4u;
|
|
o.w[i + 0u] = gl_SubgroupSize;
|
|
o.w[i + 1u] = gl_SubgroupInvocationID;
|
|
o.w[i + 2u] = gl_SubgroupID;
|
|
o.w[i + 3u] = subgroupBallotBitCount(subgroupBallot(true));
|
|
}
|