Fix overflow in VK_EXT_subgroup_size_control tests.
authorBas Nieuwenhuizen <basni@google.com>
Mon, 18 May 2020 01:28:21 +0000 (03:28 +0200)
committerBas Nieuwenhuizen <basni@google.com>
Thu, 28 May 2020 14:54:57 +0000 (16:54 +0200)
Hit this with maxComputeWorkgroupSubgroups = UINT32_MAX. The overflow
combined with the signed min result in some very large workgroups.

Affected tests:

  dEQP-VK.subgroups.size_control.*.required_subgroup_size_*

Components: Vulkan
VK-GL-CTS issue: 2369

Change-Id: I0abd69331c8f9b93c7717f253b618293bc223b12

external/vulkancts/modules/vulkan/subgroups/vktSubgroupsSizeControlTests.cpp

index 71433dc..29b799d 100755 (executable)
@@ -838,7 +838,8 @@ tcu::TestStatus testRequireSubgroupSize (Context& context, const CaseDefinition
 
                deUint32 requiredSubgroupSize = getRequiredSubgroupSizeFromMode(context, caseDef, subgroupSizeControlProperties);
 
-               const deUint32 maxTotalLocalSize = deMin32(requiredSubgroupSize * subgroupSizeControlProperties.maxComputeWorkgroupSubgroups, physicalDeviceProperties.limits.maxComputeWorkGroupInvocations);
+               const deUint64 maxSubgroupLimitSize = (deUint64)requiredSubgroupSize * subgroupSizeControlProperties.maxComputeWorkgroupSubgroups;
+               const deUint32 maxTotalLocalSize = (deUint32)std::min<deUint64>(maxSubgroupLimitSize, physicalDeviceProperties.limits.maxComputeWorkGroupInvocations);
                deUint32 localSizeX, localSizeY, localSizeZ;
                getLocalSizes(physicalDeviceProperties, maxTotalLocalSize, localSizeX, localSizeY, localSizeZ);