Re: [Mesa-dev] [PATCH 1/2] clover: Allow overriding platform/device version numbers

2018-03-02 Thread Francisco Jerez
Emil Velikov  writes:

> Hi Aaron,
>
> On 1 March 2018 at 19:44, Aaron Watry  wrote:
>> Useful for testing API, builtin library, and device completeness of
>> not-yet-supported versions.
>>
> Small fly-by comment:
>
> As-is it seems like getenv(foo) will be called multiple times.
> Perhaps it isn't that 'slow' since it's not a hot path.
>
> Yet again, one could get different version across calls which does sound icky.
>
> Perhaps it's not worth bothering about?

These are far from hot paths...  But if you care a trivial solution
would be to mark version_string and friends as static const, so the
initializer is only evaluated once.

> Emil
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] clover: Allow overriding platform/device version numbers

2018-03-02 Thread Emil Velikov
Hi Aaron,

On 1 March 2018 at 19:44, Aaron Watry  wrote:
> Useful for testing API, builtin library, and device completeness of
> not-yet-supported versions.
>
Small fly-by comment:

As-is it seems like getenv(foo) will be called multiple times.
Perhaps it isn't that 'slow' since it's not a hot path.

Yet again, one could get different version across calls which does sound icky.

Perhaps it's not worth bothering about?
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] clover: Allow overriding platform/device version numbers

2018-03-01 Thread Francisco Jerez
Aaron Watry  writes:

> Useful for testing API, builtin library, and device completeness of
> not-yet-supported versions.
>
> Signed-off-by: Aaron Watry 
> Cc: Pierre Moreau 
> Cc: Jan Vesely 
> Cc: Francisco Jerez 
> ---
>  src/gallium/state_trackers/clover/api/platform.cpp | 7 ++-
>  src/gallium/state_trackers/clover/core/device.cpp  | 5 +++--
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/platform.cpp 
> b/src/gallium/state_trackers/clover/api/platform.cpp
> index ed86163311..8cb2718973 100644
> --- a/src/gallium/state_trackers/clover/api/platform.cpp
> +++ b/src/gallium/state_trackers/clover/api/platform.cpp
> @@ -23,6 +23,7 @@
>  #include "api/util.hpp"
>  #include "core/platform.hpp"
>  #include "git_sha1.h"
> +#include "util/u_debug.h"
>  
>  using namespace clover;
>  
> @@ -51,6 +52,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, 
> cl_platform_info param,
> property_buffer buf { r_buf, size, r_size };
>  
> obj(d_platform);
> +   std::string version_string;
>  
> switch (param) {
> case CL_PLATFORM_PROFILE:
> @@ -58,7 +60,10 @@ clover::GetPlatformInfo(cl_platform_id d_platform, 
> cl_platform_info param,
>break;
>  
> case CL_PLATFORM_VERSION:
> -  buf.as_string() = "OpenCL 1.1 Mesa " PACKAGE_VERSION
> +  version_string = std::string(
> +debug_get_option("CLOVER_PLATFORM_VERSION_OVERRIDE", "1.1"));

Can you make the version_string declaration local to this case block and
mark as const?  With that fixed:

Reviewed-by: Francisco Jerez 

> +
> +  buf.as_string() = "OpenCL " + version_string + " Mesa " PACKAGE_VERSION
>  #ifdef MESA_GIT_SHA1
>  " (" MESA_GIT_SHA1 ")"
>  #endif
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
> b/src/gallium/state_trackers/clover/core/device.cpp
> index 71cf4bf60a..245d728886 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -25,6 +25,7 @@
>  #include "core/platform.hpp"
>  #include "pipe/p_screen.h"
>  #include "pipe/p_state.h"
> +#include "util/u_debug.h"
>  
>  using namespace clover;
>  
> @@ -268,10 +269,10 @@ device::endianness() const {
>  
>  std::string
>  device::device_version() const {
> -return "1.1";
> +   return std::string(debug_get_option("CLOVER_DEVICE_VERSION_OVERRIDE", 
> "1.1"));
>  }
>  
>  std::string
>  device::device_clc_version() const {
> -return "1.1";
> +   return std::string(debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", 
> "1.1"));
>  }
> -- 
> 2.14.1


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] clover: Allow overriding platform/device version numbers

2018-03-01 Thread Pierre Moreau
Reviewed-by: Pierre Moreau 

On 2018-03-01 — 13:44, Aaron Watry wrote:
> Useful for testing API, builtin library, and device completeness of
> not-yet-supported versions.
> 
> Signed-off-by: Aaron Watry 
> Cc: Pierre Moreau 
> Cc: Jan Vesely 
> Cc: Francisco Jerez 
> ---
>  src/gallium/state_trackers/clover/api/platform.cpp | 7 ++-
>  src/gallium/state_trackers/clover/core/device.cpp  | 5 +++--
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/clover/api/platform.cpp 
> b/src/gallium/state_trackers/clover/api/platform.cpp
> index ed86163311..8cb2718973 100644
> --- a/src/gallium/state_trackers/clover/api/platform.cpp
> +++ b/src/gallium/state_trackers/clover/api/platform.cpp
> @@ -23,6 +23,7 @@
>  #include "api/util.hpp"
>  #include "core/platform.hpp"
>  #include "git_sha1.h"
> +#include "util/u_debug.h"
>  
>  using namespace clover;
>  
> @@ -51,6 +52,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, 
> cl_platform_info param,
> property_buffer buf { r_buf, size, r_size };
>  
> obj(d_platform);
> +   std::string version_string;
>  
> switch (param) {
> case CL_PLATFORM_PROFILE:
> @@ -58,7 +60,10 @@ clover::GetPlatformInfo(cl_platform_id d_platform, 
> cl_platform_info param,
>break;
>  
> case CL_PLATFORM_VERSION:
> -  buf.as_string() = "OpenCL 1.1 Mesa " PACKAGE_VERSION
> +  version_string = std::string(
> +debug_get_option("CLOVER_PLATFORM_VERSION_OVERRIDE", "1.1"));
> +
> +  buf.as_string() = "OpenCL " + version_string + " Mesa " PACKAGE_VERSION
>  #ifdef MESA_GIT_SHA1
>  " (" MESA_GIT_SHA1 ")"
>  #endif
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
> b/src/gallium/state_trackers/clover/core/device.cpp
> index 71cf4bf60a..245d728886 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -25,6 +25,7 @@
>  #include "core/platform.hpp"
>  #include "pipe/p_screen.h"
>  #include "pipe/p_state.h"
> +#include "util/u_debug.h"
>  
>  using namespace clover;
>  
> @@ -268,10 +269,10 @@ device::endianness() const {
>  
>  std::string
>  device::device_version() const {
> -return "1.1";
> +   return std::string(debug_get_option("CLOVER_DEVICE_VERSION_OVERRIDE", 
> "1.1"));
>  }
>  
>  std::string
>  device::device_clc_version() const {
> -return "1.1";
> +   return std::string(debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", 
> "1.1"));
>  }
> -- 
> 2.14.1
> 


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev