summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Moreau <dev@pmoreau.org>2020-11-12 20:36:15 +0100
committerPierre Moreau <dev@pmoreau.org>2021-01-01 21:56:57 +0100
commitc0d4d21ff5db14f9caeecb85fff4f92844c27630 (patch)
tree94313d29ad13aaea5ff8f4bbb9440ee94614cd69
parent42fe80896b42a055d57a5713b648874467d878ef (diff)
clover/spirv: Use cl_version for SPIR-V versions (v2)
v2: Explicitly construct the cl_name_version object. Reviewed-by: Dave Airlie <airlied@redhat.com> 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/llvm/invocation.cpp3
-rw-r--r--src/gallium/frontends/clover/spirv/invocation.cpp12
-rw-r--r--src/gallium/frontends/clover/spirv/invocation.hpp2
3 files changed, 6 insertions, 11 deletions
diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp
index 85af8b7c6a1..be0f3976b92 100644
--- a/src/gallium/frontends/clover/llvm/invocation.cpp
+++ b/src/gallium/frontends/clover/llvm/invocation.cpp
@@ -352,8 +352,9 @@ namespace {
SPIRV::TranslatorOpts
get_spirv_translator_options(const device &dev) {
const auto supported_versions = clover::spirv::supported_versions();
+ const auto max_supported = clover::spirv::to_spirv_version_encoding(supported_versions.back().version);
const auto maximum_spirv_version =
- std::min(static_cast<SPIRV::VersionNumber>(supported_versions.back()),
+ std::min(static_cast<SPIRV::VersionNumber>(max_supported),
SPIRV::VersionNumber::MaximumVersion);
SPIRV::TranslatorOpts::ExtensionsStatusMap spirv_extensions;
diff --git a/src/gallium/frontends/clover/spirv/invocation.cpp b/src/gallium/frontends/clover/spirv/invocation.cpp
index 5763c351698..5dfdeb0bd39 100644
--- a/src/gallium/frontends/clover/spirv/invocation.cpp
+++ b/src/gallium/frontends/clover/spirv/invocation.cpp
@@ -49,12 +49,6 @@ using namespace clover;
#ifdef HAVE_CLOVER_SPIRV
namespace {
- uint32_t
- make_spirv_version(uint8_t major, uint8_t minor) {
- return (static_cast<uint32_t>(major) << 16u) |
- (static_cast<uint32_t>(minor) << 8u);
- }
-
template<typename T>
T get(const char *source, size_t index) {
const uint32_t *word_ptr = reinterpret_cast<const uint32_t *>(source);
@@ -886,9 +880,9 @@ clover::spirv::supported_extensions() {
};
}
-std::vector<uint32_t>
+std::vector<cl_name_version>
clover::spirv::supported_versions() {
- return { make_spirv_version(1u, 0u) };
+ return { cl_name_version { CL_MAKE_VERSION(1u, 0u, 0u), "SPIR-V" } };
}
cl_version
@@ -949,7 +943,7 @@ clover::spirv::supported_extensions() {
return {};
}
-std::vector<uint32_t>
+std::vector<cl_name_version>
clover::spirv::supported_versions() {
return {};
}
diff --git a/src/gallium/frontends/clover/spirv/invocation.hpp b/src/gallium/frontends/clover/spirv/invocation.hpp
index 3d13bdecef9..ab79c5c388e 100644
--- a/src/gallium/frontends/clover/spirv/invocation.hpp
+++ b/src/gallium/frontends/clover/spirv/invocation.hpp
@@ -68,7 +68,7 @@ namespace clover {
// Returns a vector (sorted in increasing order) of supported SPIR-V
// versions.
- std::vector<uint32_t> supported_versions();
+ std::vector<cl_name_version> supported_versions();
// Converts a version number from SPIR-V's encoding to OpenCL's one.
cl_version to_opencl_version_encoding(uint32_t version);