[Mesa-dev,1/8] clover/device: Move device version into core/device.cpp

Submitted by Aaron Watry on July 31, 2017, 1:26 a.m.

Details

Message ID 20170731012612.23176-2-awatry@gmail.com
State New
Headers show
Series "A few clover fixes for both CTS and eventual 1.2 support" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Aaron Watry July 31, 2017, 1:26 a.m.
The device version is the maximum CL version that the device supports.

Eventually, this will be based on the features/extensions of the actual
device, but for now move it a bit closer to its eventual destination.

Signed-off-by: Aaron Watry <awatry@gmail.com>
---
 src/gallium/state_trackers/clover/api/device.cpp  | 4 ++--
 src/gallium/state_trackers/clover/core/device.cpp | 5 +++++
 src/gallium/state_trackers/clover/core/device.hpp | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
index 0b33350bb2..18ed2f059f 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -314,7 +314,7 @@  clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_VERSION:
-      buf.as_string() = "OpenCL 1.1 Mesa " PACKAGE_VERSION
+      buf.as_string() = "OpenCL " + dev.device_version() + " Mesa " PACKAGE_VERSION
 #ifdef MESA_GIT_SHA1
                         " (" MESA_GIT_SHA1 ")"
 #endif
@@ -368,7 +368,7 @@  clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_OPENCL_C_VERSION:
-      buf.as_string() = "OpenCL C 1.1 ";
+      buf.as_string() = "OpenCL C " + dev.device_version() + " ";
       break;
 
    case CL_DEVICE_PRINTF_BUFFER_SIZE:
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 2ad9e49cf8..0277495506 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -240,3 +240,8 @@  enum pipe_endian
 device::endianness() const {
    return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS);
 }
+
+std::string
+device::device_version() const {
+    return "1.1";
+}
diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
index 7b3353df34..3cf7e20be5 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -74,6 +74,7 @@  namespace clover {
       cl_uint address_bits() const;
       std::string device_name() const;
       std::string vendor_name() const;
+      std::string device_version() const;
       enum pipe_shader_ir ir_format() const;
       std::string ir_target() const;
       enum pipe_endian endianness() const;

Comments

On Sun, 2017-07-30 at 20:26 -0500, Aaron Watry wrote:
> The device version is the maximum CL version that the device supports.
> 
> Eventually, this will be based on the features/extensions of the actual
> device, but for now move it a bit closer to its eventual destination.
> 
> Signed-off-by: Aaron Watry <awatry@gmail.com>
> ---
>  src/gallium/state_trackers/clover/api/device.cpp  | 4 ++--
>  src/gallium/state_trackers/clover/core/device.cpp | 5 +++++
>  src/gallium/state_trackers/clover/core/device.hpp | 1 +
>  3 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
> index 0b33350bb2..18ed2f059f 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -314,7 +314,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        break;
>  
>     case CL_DEVICE_VERSION:
> -      buf.as_string() = "OpenCL 1.1 Mesa " PACKAGE_VERSION
> +      buf.as_string() = "OpenCL " + dev.device_version() + " Mesa " PACKAGE_VERSION
>  #ifdef MESA_GIT_SHA1
>                          " (" MESA_GIT_SHA1 ")"
>  #endif
> @@ -368,7 +368,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        break;
>  
>     case CL_DEVICE_OPENCL_C_VERSION:
> -      buf.as_string() = "OpenCL C 1.1 ";
> +      buf.as_string() = "OpenCL C " + dev.device_version() + " ";
>        break;

This chunk looks out of place, especially since you change it again in
2/8. With this fixed:
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>

Jan

>  
>     case CL_DEVICE_PRINTF_BUFFER_SIZE:
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index 2ad9e49cf8..0277495506 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -240,3 +240,8 @@ enum pipe_endian
>  device::endianness() const {
>     return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS);
>  }
> +
> +std::string
> +device::device_version() const {
> +    return "1.1";
> +}
> diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
> index 7b3353df34..3cf7e20be5 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -74,6 +74,7 @@ namespace clover {
>        cl_uint address_bits() const;
>        std::string device_name() const;
>        std::string vendor_name() const;
> +      std::string device_version() const;
>        enum pipe_shader_ir ir_format() const;
>        std::string ir_target() const;
>        enum pipe_endian endianness() const;
On Fri, Aug 4, 2017 at 1:11 PM, Jan Vesely <jan.vesely@rutgers.edu> wrote:
> On Sun, 2017-07-30 at 20:26 -0500, Aaron Watry wrote:
>> The device version is the maximum CL version that the device supports.
>>
>> Eventually, this will be based on the features/extensions of the actual
>> device, but for now move it a bit closer to its eventual destination.
>>
>> Signed-off-by: Aaron Watry <awatry@gmail.com>
>> ---
>>  src/gallium/state_trackers/clover/api/device.cpp  | 4 ++--
>>  src/gallium/state_trackers/clover/core/device.cpp | 5 +++++
>>  src/gallium/state_trackers/clover/core/device.hpp | 1 +
>>  3 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
>> index 0b33350bb2..18ed2f059f 100644
>> --- a/src/gallium/state_trackers/clover/api/device.cpp
>> +++ b/src/gallium/state_trackers/clover/api/device.cpp
>> @@ -314,7 +314,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>>        break;
>>
>>     case CL_DEVICE_VERSION:
>> -      buf.as_string() = "OpenCL 1.1 Mesa " PACKAGE_VERSION
>> +      buf.as_string() = "OpenCL " + dev.device_version() + " Mesa " PACKAGE_VERSION
>>  #ifdef MESA_GIT_SHA1
>>                          " (" MESA_GIT_SHA1 ")"
>>  #endif
>> @@ -368,7 +368,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>>        break;
>>
>>     case CL_DEVICE_OPENCL_C_VERSION:
>> -      buf.as_string() = "OpenCL C 1.1 ";
>> +      buf.as_string() = "OpenCL C " + dev.device_version() + " ";
>>        break;
>
> This chunk looks out of place, especially since you change it again in
> 2/8. With this fixed:
> Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>

Fair enough.  I did a bunch of commit fixes and some squashing to come
up with this series, and I didn't pay as much attention to code motion
as I could've so much as just making sure that each commit built
correctly and was either no functionality change, or provided the
intended benefit.. I can remove this hunk and just do a single change
later..

--Aaron

>
> Jan
>
>>
>>     case CL_DEVICE_PRINTF_BUFFER_SIZE:
>> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
>> index 2ad9e49cf8..0277495506 100644
>> --- a/src/gallium/state_trackers/clover/core/device.cpp
>> +++ b/src/gallium/state_trackers/clover/core/device.cpp
>> @@ -240,3 +240,8 @@ enum pipe_endian
>>  device::endianness() const {
>>     return (enum pipe_endian)pipe->get_param(pipe, PIPE_CAP_ENDIANNESS);
>>  }
>> +
>> +std::string
>> +device::device_version() const {
>> +    return "1.1";
>> +}
>> diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
>> index 7b3353df34..3cf7e20be5 100644
>> --- a/src/gallium/state_trackers/clover/core/device.hpp
>> +++ b/src/gallium/state_trackers/clover/core/device.hpp
>> @@ -74,6 +74,7 @@ namespace clover {
>>        cl_uint address_bits() const;
>>        std::string device_name() const;
>>        std::string vendor_name() const;
>> +      std::string device_version() const;
>>        enum pipe_shader_ir ir_format() const;
>>        std::string ir_target() const;
>>        enum pipe_endian endianness() const;