clover: Use device cap to query pointer size instead of hardcoded 32bits
authorJan Vesely <jan.vesely@rutgers.edu>
Sun, 28 Aug 2016 08:08:15 +0000 (04:08 -0400)
committerJan Vesely <jan.vesely@rutgers.edu>
Mon, 29 Aug 2016 18:40:15 +0000 (14:40 -0400)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97513
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
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 11f21e94eae4b4543682b02f8f88f6c2bd2d8338..f7bd61b929b2dd02273bc642648c4c861502dfc3 100644 (file)
@@ -158,7 +158,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_ADDRESS_BITS:
-      buf.as_scalar<cl_uint>() = 32;
+      buf.as_scalar<cl_uint>() = dev.address_bits();
       break;
 
    case CL_DEVICE_MAX_READ_IMAGE_ARGS:
index 39f39f436c667d4992f34553390eada78a67bff5..8825f993a75e1d1b6269c4343307bcec13162fb0 100644 (file)
@@ -193,6 +193,12 @@ device::subgroup_size() const {
                                       PIPE_COMPUTE_CAP_SUBGROUP_SIZE)[0];
 }
 
+cl_uint
+device::address_bits() const {
+   return get_compute_param<uint32_t>(pipe, ir_format(),
+                                      PIPE_COMPUTE_CAP_ADDRESS_BITS)[0];
+}
+
 std::string
 device::device_name() const {
    return pipe->get_name(pipe);
index 285784744f38bf2206bcd8766931f95ab4c47813..6cf6c7fcb24077f2ea37a56716c5a40e5af96848 100644 (file)
@@ -68,6 +68,7 @@ namespace clover {
 
       std::vector<size_t> max_block_size() const;
       cl_uint subgroup_size() const;
+      cl_uint address_bits() const;
       std::string device_name() const;
       std::string vendor_name() const;
       enum pipe_shader_ir ir_format() const;