diff options
author | EdB <[email protected]> | 2014-04-27 19:23:25 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2014-04-29 16:14:50 +0200 |
commit | 7fb05f929802bf32391e416ceb62a34b4571905c (patch) | |
tree | 29321c205d60aea2e617665977f9714ca63214c2 /src/gallium/state_trackers | |
parent | 5827781d25d2e27ebbcfc2362fcc14cc710bccf5 (diff) |
clover: Stub implementation of CL 1.2 sub-devices.
The implementation is basically a NOP but it conforms with OpenCL 1.2.
[ Francisco Jerez: Initialize property return buffer for
CL_DEVICE_PARTITION_PROPERTIES, CL_DEVICE_PARTITION_TYPE,
CL_DEVICE_PARTITION_AFFINITY_DOMAIN, and make the latter a scalar
rather than a vector. Some clean-up and code style fixes. ]
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/clover/api/device.cpp | 57 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/api/dispatch.cpp | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/api/dispatch.hpp | 7 |
3 files changed, 66 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp index 7bc8d0a7142..b77a50dafea 100644 --- a/src/gallium/state_trackers/clover/api/device.cpp +++ b/src/gallium/state_trackers/clover/api/device.cpp @@ -63,6 +63,37 @@ clGetDeviceIDs(cl_platform_id d_platform, cl_device_type device_type, } CLOVER_API cl_int +clCreateSubDevices(cl_device_id d_dev, + const cl_device_partition_property *props, + cl_uint num_devs, cl_device_id *rd_devs, + cl_uint *rnum_devs) { + // There are no currently supported partitioning schemes. + return CL_INVALID_VALUE; +} + +CLOVER_API cl_int +clRetainDevice(cl_device_id d_dev) try { + obj(d_dev); + + // The reference count doesn't change for root devices. + return CL_SUCCESS; + +} catch (error &e) { + return e.get(); +} + +CLOVER_API cl_int +clReleaseDevice(cl_device_id d_dev) try { + obj(d_dev); + + // The reference count doesn't change for root devices. + return CL_SUCCESS; + +} catch (error &e) { + return e.get(); +} + +CLOVER_API cl_int clGetDeviceInfo(cl_device_id d_dev, cl_device_info param, size_t size, void *r_buf, size_t *r_size) try { property_buffer buf { r_buf, size, r_size }; @@ -295,6 +326,32 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param, buf.as_string() = "OpenCL C 1.1"; break; + case CL_DEVICE_PARENT_DEVICE: + buf.as_scalar<cl_device_id>() = NULL; + break; + + case CL_DEVICE_PARTITION_MAX_SUB_DEVICES: + buf.as_scalar<cl_uint>() = 0; + break; + + case CL_DEVICE_PARTITION_PROPERTIES: + buf.as_vector<cl_device_partition_property>() = + desc(property_list<cl_device_partition_property>()); + break; + + case CL_DEVICE_PARTITION_AFFINITY_DOMAIN: + buf.as_scalar<cl_device_affinity_domain>() = 0; + break; + + case CL_DEVICE_PARTITION_TYPE: + buf.as_vector<cl_device_partition_property>() = + desc(property_list<cl_device_partition_property>()); + break; + + case CL_DEVICE_REFERENCE_COUNT: + buf.as_scalar<cl_uint>() = 1; + break; + default: throw error(CL_INVALID_VALUE); } diff --git a/src/gallium/state_trackers/clover/api/dispatch.cpp b/src/gallium/state_trackers/clover/api/dispatch.cpp index e4f7ea3cc74..2ee62086dc8 100644 --- a/src/gallium/state_trackers/clover/api/dispatch.cpp +++ b/src/gallium/state_trackers/clover/api/dispatch.cpp @@ -117,9 +117,9 @@ namespace clover { NULL, // clRetainDeviceEXT NULL, // clReleaseDeviceEXT NULL, // clCreateEventFromGLsyncKHR - NULL, // clCreateSubDevices - NULL, // clRetainDevice - NULL, // clReleaseDevice + clCreateSubDevices, + clRetainDevice, + clReleaseDevice, NULL, // clCreateImage NULL, // clCreateProgramWithBuiltInKernels NULL, // clCompileProgram diff --git a/src/gallium/state_trackers/clover/api/dispatch.hpp b/src/gallium/state_trackers/clover/api/dispatch.hpp index 47f9e3916ef..833fb0e8008 100644 --- a/src/gallium/state_trackers/clover/api/dispatch.hpp +++ b/src/gallium/state_trackers/clover/api/dispatch.hpp @@ -640,7 +640,12 @@ struct _cl_icd_dispatch { cl_GLsync sync, cl_int *errcode_ret); - void *clCreateSubDevices; + CL_API_ENTRY cl_int (CL_API_CALL *clCreateSubDevices)( + cl_device_id in_device, + const cl_device_partition_property *partition_properties, + cl_uint num_entries, + cl_device_id *out_devices, + cl_uint *num_devices); CL_API_ENTRY cl_int (CL_API_CALL *clRetainDevice)( cl_device_id device); |