clover: query driver for the max number of compute units
authorBruno Jiménez <brunojimen@gmail.com>
Fri, 30 May 2014 15:31:12 +0000 (17:31 +0200)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 12 Jun 2014 23:09:32 +0000 (19:09 -0400)
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/state_trackers/clover/api/device.cpp
src/gallium/state_trackers/clover/core/device.cpp
src/gallium/state_trackers/clover/core/device.hpp

index 1bc2692fa31b755e3868bd199a8a5ea709ccf30f..97b2cf9c9968ef2293e825d40af4e54905d4673d 100644 (file)
@@ -109,7 +109,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_MAX_COMPUTE_UNITS:
-      buf.as_scalar<cl_uint>() = 1;
+      buf.as_scalar<cl_uint>() = dev.max_compute_units();
       break;
 
    case CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS:
index bc3e3e68a5e86de92877ab50107d182c0edaf660..b6078db18a45ae244aacf50e4133973af138955f 100644 (file)
@@ -163,6 +163,12 @@ device::max_clock_frequency() const {
                                       PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY)[0];
 }
 
+cl_uint
+device::max_compute_units() const {
+   return get_compute_param<uint32_t>(pipe,
+                                      PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS)[0];
+}
+
 std::vector<size_t>
 device::max_block_size() const {
    auto v = get_compute_param<uint64_t>(pipe, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE);
index 3662c6be0fe7cdff733818cb45cf30059f5d0c61..731c31e5a2fbeb6879b328a1aaa4de13d57a8c8e 100644 (file)
@@ -62,6 +62,7 @@ namespace clover {
       size_t max_threads_per_block() const;
       cl_ulong max_mem_alloc_size() const;
       cl_uint max_clock_frequency() const;
+      cl_uint max_compute_units() const;
 
       std::vector<size_t> max_block_size() const;
       std::string device_name() const;