clover: Query device for CL_DEVICE_MAX_MEM_ALLOC_SIZE v2
authorTom Stellard <thomas.stellard@amd.com>
Mon, 17 Sep 2012 14:29:49 +0000 (14:29 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 25 Sep 2012 14:36:50 +0000 (14:36 +0000)
v2:
  - Use driver reported values and don't correct them to the OpenCL
    required minimum.

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 1a9127bb3d5d0bf65b0001b618b4c75a845c1f4a..d99aed8f5645e02a0d50dc600b9b0a4f47e12220 100644 (file)
@@ -126,7 +126,8 @@ clGetDeviceInfo(cl_device_id dev, cl_device_info param,
                                       dev->max_images_write());
 
    case CL_DEVICE_MAX_MEM_ALLOC_SIZE:
-      return scalar_property<cl_ulong>(buf, size, size_ret, 0);
+      return scalar_property<cl_ulong>(buf, size, size_ret,
+                                       dev->max_mem_alloc_size());
 
    case CL_DEVICE_IMAGE2D_MAX_WIDTH:
    case CL_DEVICE_IMAGE2D_MAX_HEIGHT:
index 2ab735d9a2a82d75ea4b07c3141f67b3b9bcadea..d93a1f6ac6c42a1ffbc4f49f5ae789082ee1d4fb 100644 (file)
@@ -144,6 +144,12 @@ _cl_device_id::max_threads_per_block() const {
       pipe, PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK)[0];
 }
 
+cl_ulong
+_cl_device_id::max_mem_alloc_size() const {
+   return get_compute_param<uint64_t>(pipe,
+                                      PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE)[0];
+}
+
 std::vector<size_t>
 _cl_device_id::max_block_size() const {
    auto v = get_compute_param<uint64_t>(pipe, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE);
index 9408083e47948c350bc9d29feab69bf5ec79b36b..5b92751cbcde0cef307c327709417700e38f9ba0 100644 (file)
@@ -56,6 +56,7 @@ public:
    cl_ulong max_const_buffer_size() const;
    cl_uint max_const_buffers() const;
    size_t max_threads_per_block() const;
+   cl_ulong max_mem_alloc_size() const;
 
    std::vector<size_t> max_block_size() const;
    std::string device_name() const;