From 0eccb8b5a4d00f714a0806c30ed3bdc595aedfa0 Mon Sep 17 00:00:00 2001 From: Arkadiusz Sarwa Date: Wed, 17 Nov 2021 16:43:24 +0100 Subject: [PATCH] Fix allocation of system memory. Allocation of system memory which have been used as reference data can fail. VK-GL-CTS issue: 3319 Components: Vulkan Affects: dEQP-VK.reconvergence.* Change-Id: Icf9e6a2ad15912109aee2b6ea693a17650579087 --- .../vulkan/reconvergence/vktReconvergenceTests.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/external/vulkancts/modules/vulkan/reconvergence/vktReconvergenceTests.cpp b/external/vulkancts/modules/vulkan/reconvergence/vktReconvergenceTests.cpp index 0b409c6..34dd15c 100644 --- a/external/vulkancts/modules/vulkan/reconvergence/vktReconvergenceTests.cpp +++ b/external/vulkancts/modules/vulkan/reconvergence/vktReconvergenceTests.cpp @@ -1873,9 +1873,18 @@ tcu::TestStatus ReconvergenceTestInstance::iterate (void) qpTestResult res = QP_TEST_RESULT_PASS; // Simulate execution on the CPU, and compare against the GPU result - deUint64 *ref = new deUint64 [maxLoc]; - deMemset(ref, 0, maxLoc*sizeof(deUint64)); - program.simulate(false, subgroupSize, invocationStride, ref); + std::vector ref; + try + { + ref.resize(maxLoc, 0ull); + } + catch (const std::bad_alloc&) + { + // Allocation size is unpredictable and can be too large for some systems. Don't treat allocation failure as a test failure. + return tcu::TestStatus(QP_TEST_RESULT_NOT_SUPPORTED, "Failed system memory allocation " + de::toString(maxLoc * sizeof(deUint64)) + " bytes"); + } + + program.simulate(false, subgroupSize, invocationStride, &ref[0]); const deUint64 *result = (const deUint64 *)ptrs[1]; @@ -1958,8 +1967,6 @@ tcu::TestStatus ReconvergenceTestInstance::iterate (void) } } - delete []ref; - return tcu::TestStatus(res, qpGetTestResultName(res)); } -- 2.7.4