summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Moreau <dev@pmoreau.org>2020-05-05 13:16:47 +0200
committerPierre Moreau <dev@pmoreau.org>2021-01-01 21:56:58 +0100
commit31ce49e6b2ef473e5083e0c04ab8d53ad863dda2 (patch)
treebf18bce657cdab7e882222618db21951478bed41
parent4028911ccba1efa8a20b8a830ca4c630d6723dd1 (diff)
clover/api: Implement CL_DEVICE_IL_VERSION
v2: Move `supported_il_versions_as_string()` from `device` to an anonymous namespace, and remove the static storage of the results (Francisco Jerez) Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
-rw-r--r--src/gallium/frontends/clover/api/device.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gallium/frontends/clover/api/device.cpp b/src/gallium/frontends/clover/api/device.cpp
index ed36ad51025..5a1fcfd847e 100644
--- a/src/gallium/frontends/clover/api/device.cpp
+++ b/src/gallium/frontends/clover/api/device.cpp
@@ -27,6 +27,23 @@
using namespace clover;
+namespace {
+ std::string
+ supported_il_versions_as_string(const device &dev) {
+ std::string il_versions_string;
+
+ for (const auto &il_version : dev.supported_il_versions()) {
+ if (!il_versions_string.empty())
+ il_versions_string += " ";
+
+ il_versions_string += std::string(il_version.name) + "_" +
+ std::to_string(CL_VERSION_MAJOR(il_version.version)) + "." +
+ std::to_string(CL_VERSION_MINOR(il_version.version));
+ }
+ return il_versions_string;
+ }
+}
+
CLOVER_API cl_int
clGetDeviceIDs(cl_platform_id d_platform, cl_device_type device_type,
cl_uint num_entries, cl_device_id *rd_devices,
@@ -428,12 +445,13 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
break;
case CL_DEVICE_IL_VERSION:
- buf.as_string() = "";
+ if (dev.supported_extensions_as_string().find("cl_khr_il_program") == std::string::npos)
+ throw error(CL_INVALID_VALUE);
+ buf.as_string() = supported_il_versions_as_string(dev);
break;
case CL_DEVICE_ILS_WITH_VERSION:
- if (r_size)
- *r_size = 0;
+ buf.as_vector<cl_name_version>() = dev.supported_il_versions();
break;
case CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION: