Mesa (staging/20.1): clover/nir: Check the result of spirv_to_nir

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 8 16:27:48 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 1dfbdca81d9bbc42dbd94cb7089de3975a559027
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1dfbdca81d9bbc42dbd94cb7089de3975a559027

Author: Pierre Moreau <dev at pmoreau.org>
Date:   Tue May  5 13:13:19 2020 +0200

clover/nir: Check the result of spirv_to_nir

Fixes: deb04adf2ae ("clover: add support for passing kernels as nir to the driver")
Signed-off-by: Pierre Moreau <dev at pmoreau.org>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4901>
(cherry picked from commit 38bbfd3a57d68abdc88a93b436eac9f30a397b0f)

---

 .pick_status.json                                    | 2 +-
 src/gallium/state_trackers/clover/nir/invocation.cpp | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index d5698625fe2..31d0088fd2c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -346,7 +346,7 @@
         "description": "clover/nir: Check the result of spirv_to_nir",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "deb04adf2ae605a017d7ce4e81f57db679567dfa"
     },
diff --git a/src/gallium/state_trackers/clover/nir/invocation.cpp b/src/gallium/state_trackers/clover/nir/invocation.cpp
index 87a98046cc1..46440d96e09 100644
--- a/src/gallium/state_trackers/clover/nir/invocation.cpp
+++ b/src/gallium/state_trackers/clover/nir/invocation.cpp
@@ -90,6 +90,11 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
       nir_shader *nir = spirv_to_nir(data, num_words, nullptr, 0,
                                      MESA_SHADER_KERNEL, name,
                                      &spirv_options, compiler_options);
+      if (!nir) {
+         r_log += "Translation from SPIR-V to NIR for kernel \"" + sym.name +
+                  "\" failed.\n";
+         throw build_error();
+      }
 
       nir->info.cs.local_size_variable = true;
       nir_validate_shader(nir, "clover");



More information about the mesa-commit mailing list