Mesa (master): clover: Call clang with -O0 for the SPIR-V path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 22 00:33:37 UTC 2020


Module: Mesa
Branch: master
Commit: 32dc71b23acc996198ecf429018a12326689ae01
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32dc71b23acc996198ecf429018a12326689ae01

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Fri Aug 14 15:48:59 2020 -0500

clover: Call clang with -O0 for the SPIR-V path

SPIRV-LLVM-Translator isn't really built for handling optimized LLVM IR.
It tends to fall over when, for instance, an optimization generates an
i96 type which isn't legal in SPIR-V.  Pass -O0 to avoid these cases.
See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/203.

Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6432>

---

 src/gallium/frontends/clover/llvm/invocation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp
index 38070a94e02..a305299f507 100644
--- a/src/gallium/frontends/clover/llvm/invocation.cpp
+++ b/src/gallium/frontends/clover/llvm/invocation.cpp
@@ -450,7 +450,7 @@ clover::llvm::compile_to_spirv(const std::string &source,
       "-spir-unknown-unknown" :
       "-spir64-unknown-unknown";
    auto c = create_compiler_instance(dev, target,
-                                     tokenize(opts + " input.cl"), r_log);
+                                     tokenize(opts + " -O0 input.cl"), r_log);
    auto mod = compile(*ctx, *c, "input.cl", source, headers, dev, opts, false,
                       r_log);
 



More information about the mesa-commit mailing list