aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2015-07-22 22:23:47 +0000
committerGil Pitney <gil.pitney@linaro.org>2015-07-22 22:23:47 +0000
commitec33599fdc863027998ff60ec23a0666f204ae45 (patch)
tree24faf042b1c5fd1b56a2b2f8988d3f649dfa3929
parent791ca3d2e8745e1abe2c2c66db41a20ec51bd6ea (diff)
Ensure CL_DEVICE_MAX_MEM_ALLOC_SIZE info function returns 1/4 of global mem
Per the v1.2 spec, minimum size for maximum memory allocatable must be 1/4 the size of CL_DEVICE_GLOBAL_MEM_SIZE. This enables the Khronos test % test_api min_max_mem_alloc_size to PASS. Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--src/core/cpu/device.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/cpu/device.cpp b/src/core/cpu/device.cpp
index d8f4ed3..3d16100 100644
--- a/src/core/cpu/device.cpp
+++ b/src/core/cpu/device.cpp
@@ -599,9 +599,16 @@ cl_int CPUDevice::info(cl_device_info param_name,
break;
case CL_DEVICE_MAX_MEM_ALLOC_SIZE:
+ {
+ // Minimum size must be 1/4 the size of CL_DEVICE_GLOBAL_MEM_SIZE:
+ unsigned long global_size_bytes = parse_file_line_value("/proc/meminfo",
+ "MemTotal:", 512*1024) * 1024;
+ SIMPLE_ASSIGN(cl_ulong, global_size_bytes >> 2);
+ }
+ break;
+
case CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE:
// TODO: 1 Gio seems to be enough for software acceleration
-
#if defined(__arm__)
SIMPLE_ASSIGN(cl_ulong, HALF_GIGABYTE);
#else