From 036f1c29fc704288ceb6f7d35485ec5f86ea443a Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 21 Aug 2020 21:10:32 +0200 Subject: [PATCH] clover/llvm: undefine __IMAGE_SUPPORT__ for devices without image support libclang seems to define this on its own for SPIR targets, but the CTS requires it to be not set if the device doesn't support images. The SPIRV-LLVM-Translator also requires the spir triple to be set so we can't really do anything else except to undefine. Signed-off-by: Karol Herbst Reviewed-by: Jason Ekstrand Reviewed-by: Francisco Jerez Part-of: --- src/gallium/frontends/clover/llvm/invocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp index a305299f507..173894fa799 100644 --- a/src/gallium/frontends/clover/llvm/invocation.cpp +++ b/src/gallium/frontends/clover/llvm/invocation.cpp @@ -300,6 +300,10 @@ namespace { compat::add_link_bitcode_file(c.getCodeGenOpts(), LIBCLC_LIBEXECDIR + dev.ir_target() + ".bc"); + // undefine __IMAGE_SUPPORT__ for device without image support + if (!dev.image_support()) + c.getPreprocessorOpts().addMacroUndef("__IMAGE_SUPPORT__"); + // Compile the code clang::EmitLLVMOnlyAction act(&ctx); if (!c.ExecuteAction(act))