clover: Query drivers for max clock frequency
authorTom Stellard <thomas.stellard@amd.com>
Fri, 18 Apr 2014 14:28:41 +0000 (16:28 +0200)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 29 Apr 2014 22:28:17 +0000 (15:28 -0700)
Igor Gnatenko:

v2: PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY instead of
    PIPE_COMPUTE_MAX_CLOCK_FREQUENCY

Bruno JimĂ©nez:

  v3: Drivers report clock in Mhz

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.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 b77a50dafeaf47536af518cb047870973f190899..1bc2692fa31b755e3868bd199a8a5ea709ccf30f 100644 (file)
@@ -153,7 +153,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_MAX_CLOCK_FREQUENCY:
-      buf.as_scalar<cl_uint>() = 0;
+      buf.as_scalar<cl_uint>() = dev.max_clock_frequency();
       break;
 
    case CL_DEVICE_ADDRESS_BITS:
index 2c5f9b74accbeda1760c7b127f8e6eebc865844c..2f84677b54e1462b1e1b7e47f053e6cd515a9bbf 100644 (file)
@@ -154,6 +154,12 @@ device::max_mem_alloc_size() const {
                                       PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE)[0];
 }
 
+cl_uint
+device::max_clock_frequency() const {
+   return get_compute_param<uint32_t>(pipe,
+                                      PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY)[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 433ac814c2194b0700a75a007d54b0e2211cbe7c..3662c6be0fe7cdff733818cb45cf30059f5d0c61 100644 (file)
@@ -61,6 +61,7 @@ namespace clover {
       cl_uint max_const_buffers() const;
       size_t max_threads_per_block() const;
       cl_ulong max_mem_alloc_size() const;
+      cl_uint max_clock_frequency() const;
 
       std::vector<size_t> max_block_size() const;
       std::string device_name() const;