Mesa (master): clover/device: store version in device at constructor.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 10 20:56:33 UTC 2020
Module: Mesa
Branch: master
Commit: 981f8d7252c17672598ec7ee4406e296876f8ab0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=981f8d7252c17672598ec7ee4406e296876f8ab0
Author: Dave Airlie <airlied at redhat.com>
Date: Tue Nov 10 10:03:47 2020 +1000
clover/device: store version in device at constructor.
This reads the env vars once and stores the value, and converts
to strings when needed
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7520>
---
src/gallium/frontends/clover/core/device.cpp | 22 ++++++++++++++++------
src/gallium/frontends/clover/core/device.hpp | 2 ++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/gallium/frontends/clover/core/device.cpp b/src/gallium/frontends/clover/core/device.cpp
index c055e5b4876..01799809db4 100644
--- a/src/gallium/frontends/clover/core/device.cpp
+++ b/src/gallium/frontends/clover/core/device.cpp
@@ -49,6 +49,14 @@ namespace {
device::device(clover::platform &platform, pipe_loader_device *ldev) :
platform(platform), clc_cache(NULL), ldev(ldev) {
+ unsigned major = 1, minor = 1;
+ debug_get_version_option("CLOVER_DEVICE_VERSION_OVERRIDE", &major, &minor);
+ version = CL_MAKE_VERSION(major, minor, 0);
+
+ major = 1, minor = 1;
+ debug_get_version_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", &major, &minor);
+ clc_version = CL_MAKE_VERSION(major, minor, 0);
+
pipe = pipe_loader_create_screen(ldev);
if (pipe && pipe->get_param(pipe, PIPE_CAP_COMPUTE)) {
if (supports_ir(PIPE_SHADER_IR_NATIVE))
@@ -313,16 +321,18 @@ device::endianness() const {
std::string
device::device_version_as_string() const {
- static const std::string device_version =
- debug_get_option("CLOVER_DEVICE_VERSION_OVERRIDE", "1.1");
- return device_version;
+ static const std::string version_string =
+ std::to_string(CL_VERSION_MAJOR(version)) + "." +
+ std::to_string(CL_VERSION_MINOR(version));
+ return version_string;
}
std::string
device::device_clc_version_as_string() const {
- static const std::string device_clc_version =
- debug_get_option("CLOVER_DEVICE_CLC_VERSION_OVERRIDE", "1.1");
- return device_clc_version;
+ static const std::string version_string =
+ std::to_string(CL_VERSION_MAJOR(clc_version)) + "." +
+ std::to_string(CL_VERSION_MINOR(clc_version));
+ return version_string;
}
bool
diff --git a/src/gallium/frontends/clover/core/device.hpp b/src/gallium/frontends/clover/core/device.hpp
index 6815e7a331c..85e01bf0c52 100644
--- a/src/gallium/frontends/clover/core/device.hpp
+++ b/src/gallium/frontends/clover/core/device.hpp
@@ -108,6 +108,8 @@ namespace clover {
lazy<std::shared_ptr<nir_shader>> clc_nir;
disk_cache *clc_cache;
+ cl_version version;
+ cl_version clc_version;
private:
pipe_screen *pipe;
pipe_loader_device *ldev;
More information about the mesa-commit
mailing list