Fix out of memory error on 32bit driver builds
authorMarcin Kantoch <marcin.kantoch@amd.com>
Wed, 3 Feb 2021 18:47:17 +0000 (19:47 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 19 Feb 2021 07:58:37 +0000 (07:58 +0000)
Limit the ammount of RT invocations on 32 bit
driver builds, so that the result buffer does
not exceed 2GB.

Components: Vulkan

VK-GL-CTS issue: 2716

Affects:
dEQP-VK.ray_tracing_pipeline.misc.maxrtinvocations_*

Change-Id: I73711e45c5bc589c1d5e5e742da817c11b3215fa

external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingMiscTests.cpp

index caab036..87cf2c3 100644 (file)
@@ -3111,14 +3111,18 @@ class MAXRTInvocationsSupportedTest :   public TestBase,
                                RayTracingProperties*   rtPropertiesPtr) final
        {
                /* NOTE: In order to avoid running into a situation where the test attempts to create a buffer of size larger than permitted by Vulkan,
-                *       we limit the maximum number of testable invocations to 2^29. */
+                *       we limit the maximum number of testable invocations to 2^29 on 64bit CTS build and driver or to 2^27 on 32bit */
                const auto              maxComputeWorkGroupCount                = context.getDeviceProperties().limits.maxComputeWorkGroupCount;
                const auto              maxComputeWorkGroupSize                 = context.getDeviceProperties().limits.maxComputeWorkGroupSize;
                const deUint64  maxGlobalRTWorkGroupSize[3]             = {     static_cast<deUint64>(maxComputeWorkGroupCount[0]) * static_cast<deUint64>(maxComputeWorkGroupSize[0]),
                                                                                                                        static_cast<deUint64>(maxComputeWorkGroupCount[1]) * static_cast<deUint64>(maxComputeWorkGroupSize[1]),
                                                                                                                        static_cast<deUint64>(maxComputeWorkGroupCount[2]) * static_cast<deUint64>(maxComputeWorkGroupSize[2]) };
                const auto              maxRayDispatchInvocationCount   = de::min(      static_cast<deUint64>(rtPropertiesPtr->getMaxRayDispatchInvocationCount() ),
+#if (DE_PTR_SIZE == 4)
+                                                                                                                                       static_cast<deUint64>(1ULL << 27) );
+#else
                                                                                                                                        static_cast<deUint64>(1ULL << 29) );
+#endif
 
                m_gridSizeXYZ[0] = de::max(     1u,
                                                                        static_cast<deUint32>((maxRayDispatchInvocationCount)                                                                           % maxGlobalRTWorkGroupSize[0]) );