Validation error for shader work group
Koromire opened this issue · 1 comments
Hello,
I'm currently using vulkan 1.3.261.1 in a c++ environnement on Windows 11.
When i use a compute shader without mentionning the size of the workgroup, I get this message:
Validation Performance Warning: [ UNASSIGNED-BestPractices-LocalWorkgroup-Multiple64 ] | MessageID = 0xc064ba5c | [AMD] vkCreateComputePipelines(): compute shader with work group dimensions (1, 1, 1), workgroup size (1), is not a multiple of 64. Make the workgroup size a multiple of 64 to obtain best performance across all AMD GPU generations.
If I've understood correctly, Vulkan tells us that whatever the size of the workgroup below 64, the calculation time will be the same, but performance will increase because I'll be able to do more calculations in the same time window. Great! So I'll add a layout clarification for the workgroup to see if this is what it's all about:
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
And then I get this message :
UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize(WARN / SPEC): msgNum: 2076578180 - Validation Warning: [ UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize ] | MessageID = 0x7bc61184 | vkCreateComputePipelines(): pCreateInfos[ 0] is using the Workgroup built-in which SPIR-V 1.6 deprecated. The VK_KHR_maintenance4 extension exposes a new LocalSizeId execution mode that should be used instead.
I'm missing an extension ? Never mind, i'll just add it :
UNASSIGNED-BestPractices-vkCreateDevice-deprecated-extension(WARN / SPEC): msgNum: 181611958 - Validation Warning: [ UNASSIGNED-BestPractices-vkCreateDevice-deprecated-extension ] Object 0: handle = 0x20cae386a10, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xad32db6 | CreateDevice(): Attempting to enable deprecated extension VK_KHR_maintenance4, but this extension has been promoted to VK_VERSION_1_3.
But this is obsolete. So I'll just refer to the execution mode ("new LocalSizeId execution mode that should be used instead."). So I tried something like this:
uint32_t l_SpecializationValues[3] = { 64, 1, 1 };
vk::SpecializationMapEntry l_SpecializationMapEntry[3];
/// ID constant 0 (x)
l_SpecializationMapEntry[0].constantID = 0;
l_SpecializationMapEntry[0].offset = 0 * sizeof(uint32_t);
l_SpecializationMapEntry[0].size = sizeof(uint32_t);
/// ID constant 1 (y)
l_SpecializationMapEntry[1].constantID = 1;
l_SpecializationMapEntry[1].offset = 1 * sizeof(uint32_t);
l_SpecializationMapEntry[1].size = sizeof(uint32_t);
/// ID constant 2 (z)
l_SpecializationMapEntry[2].constantID = 2;
l_SpecializationMapEntry[2].offset = 2 * sizeof(uint32_t);
l_SpecializationMapEntry[2].size = sizeof(uint32_t);
vk::SpecializationInfo l_SpecializationInfos {};
l_SpecializationInfos.mapEntryCount = 3;
l_SpecializationInfos.pMapEntries = l_SpecializationMapEntry;
l_SpecializationInfos.dataSize = sizeof(l_SpecializationValues);
l_SpecializationInfos.pData = l_SpecializationValues;
vk::PipelineShaderStageCreateInfo l_PipelineShaderStageCreateInfo {};
l_PipelineShaderStageCreateInfo.stage = vk::ShaderStageFlagBits::eCompute;
l_PipelineShaderStageCreateInfo.module = l_ModuleShaderCalcul;
l_PipelineShaderStageCreateInfo.pName = "main";
l_PipelineShaderStageCreateInfo.pSpecializationInfo = &l_SpecializationInfos;
I get the same message (
UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize(WARN / SPEC): msgNum: 2076578180 - Validation Warning: [ UNASSIGNED-BestPractices-SpirvDeprecated_WorkgroupSize ] | MessageID = 0x7bc61184 | vkCreateComputePipelines(): pCreateInfos[ 0] is using the Workgroup built-in which SPIR-V 1.6 deprecated. The VK_KHR_maintenance4 extension exposes a new LocalSizeId execution mode that should be used instead.
) because I didn't delete the layout line, so I get rid of it. Logical, because if I define workgroups dynamically, I don't need to specify them in the shader, do I? But I got the first message again:
Validation Performance Warning: [ UNASSIGNED-BestPractices-LocalWorkgroup-Multiple64 ] | MessageID = 0xc064ba5c | [AMD] vkCreateComputePipelines(): compute shader with work group dimensions (1, 1, 1), workgroup size (1), is not a multiple of 64. Make the workgroup size a multiple of 64 to obtain best performance across all AMD GPU generations.
I may be doing something wrong, but I haven't been able to put my finger on it. Am I doing something wrong? Because I feel like the layers of validation have me stuck in a loop.
Thank you in advance for your time.
Report this issue to the KhronosGroup/Vulkan-ValidationLayers repo instead. This repo doesn't host the validation layers.