From d631cc1858865bfb3f2c67e1e21aec163d2b4d62 Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko <35483345+gwawiork@users.noreply.github.com> Date: Mon, 18 Mar 2019 11:03:57 +0100 Subject: [PATCH] Khronos Bug 15347 fixed code review issues + fix for a similar issue in basic constant test (#75) --- test_conformance/basic/test_constant.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test_conformance/basic/test_constant.c b/test_conformance/basic/test_constant.c index eb156e49..ddc9e016 100644 --- a/test_conformance/basic/test_constant.c +++ b/test_conformance/basic/test_constant.c @@ -100,7 +100,7 @@ test_constant(cl_device_id device, cl_context context, cl_command_queue queue, i size_t global_threads[3]; int err; unsigned int i; - cl_ulong maxSize; + cl_ulong maxSize, maxGlobalSize, maxAllocSize; size_t num_floats, num_ints, constant_values; MTdata d; RoundingMode oldRoundMode; @@ -111,6 +111,14 @@ test_constant(cl_device_id device, cl_context context, cl_command_queue queue, i test_error( err, "Unable to get max constant buffer size" ); log_info("Device reports CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE %llu bytes.\n", maxSize); + err = clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(maxGlobalSize), &maxGlobalSize, 0); + test_error(err, "Unable to get CL_DEVICE_GLOBAL_MEM_SIZE"); + if (maxSize > maxGlobalSize / 4) + maxSize = maxGlobalSize / 4; + err = clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE , sizeof(maxAllocSize), &maxAllocSize, 0); + test_error(err, "Unable to get CL_DEVICE_MAX_MEM_ALLOC_SIZE "); + if (maxSize > maxAllocSize) + maxSize = maxAllocSize; maxSize/=4; num_ints = (size_t)maxSize/sizeof(cl_int); num_floats = (size_t)maxSize/sizeof(cl_float);