aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2015-06-05 23:17:12 +0000
committerGil Pitney <gil.pitney@linaro.org>2015-06-05 23:24:47 +0000
commitda4508f56fdb4dc5b0a10382a165eefc96a2f7d1 (patch)
tree0fc1a00bc30db218bf2b4a2fe9e2fa2a714e77c0
parentdff2da92de7f00d899954180562e71e8ff7b370b (diff)
clCreateSubDevices(): Return CL_DEVICE_PARTITION_FAILED if numCPUs() == 1
If a sub-device cannot be further sub-divided, the v1.2 spec allows the implementation to return CL_DEVICE_PARTITION_FAILED, or CL_INVALID_VALUE depending on one's interpretation. The Khronos v1.2 device_partition test fails in either case (which appears to be a bug). The Khronos v2.0 device_partition test was modified to accept the return value of CL_DEVICE_PARTITION_FAILED, which is a logical fix. This patch allows a similarly modified (fixed) Khronos v1.2 test to pass the test subroutine code which recursively subdivides devices. Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--src/core/cpu/device.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/cpu/device.cpp b/src/core/cpu/device.cpp
index 5f02f4f..a2bc507 100644
--- a/src/core/cpu/device.cpp
+++ b/src/core/cpu/device.cpp
@@ -339,16 +339,19 @@ cl_int CPUDevice::createSubDevices(
if (properties) {
// We support CL_DEVICE_PARTITION_EQUALLY and CL_DEVICE_PARTITION_BY_COUNTS
if (properties[0] == CL_DEVICE_PARTITION_EQUALLY) {
- partition_size = properties[1];
- if (properties[2] != 0) {
- retval = CL_INVALID_VALUE;
- }
+ partition_size = properties[1];
+ if (properties[2] != 0) {
+ retval = CL_INVALID_VALUE;
+ }
+ else if (numCPUs() == 1) {
+ retval = CL_DEVICE_PARTITION_FAILED; // cannot partition further.
+ }
else if (partition_size > 0 && partition_size <= numCPUs()) {
- num_new_devices = numCPUs() / partition_size; // discards fraction.
- }
- else {
- retval = CL_INVALID_VALUE;
- }
+ num_new_devices = numCPUs() / partition_size; // discards fraction.
+ }
+ else {
+ retval = CL_INVALID_VALUE;
+ }
}
else if (properties[0] == CL_DEVICE_PARTITION_BY_COUNTS) {
// TODO