Skip to content

Commit 64e408e

Browse files
committed
[SYCL] Enable nonsemantic.shader.debuginfo.200 by default
It's left disenabled only for FPGA target. Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 08a2edc commit 64e408e

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10674,12 +10674,8 @@ static void getTripleBasedSPIRVTransOpts(Compilation &C,
1067410674
ArgStringList &TranslatorArgs) {
1067510675
bool IsCPU = Triple.isSPIR() &&
1067610676
Triple.getSubArch() == llvm::Triple::SPIRSubArch_x86_64;
10677-
// Enable NonSemanticShaderDebugInfo.200 for CPU AOT and for non-Windows
10678-
const bool IsWindowsMSVC =
10679-
Triple.isWindowsMSVCEnvironment() ||
10680-
C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment();
10681-
const bool EnableNonSemanticDebug =
10682-
IsCPU || (!IsWindowsMSVC && !C.getDriver().IsFPGAHWMode());
10677+
// Enable NonSemanticShaderDebugInfo.200 for non-FPGA targets.
10678+
const bool EnableNonSemanticDebug = !C.getDriver().IsFPGAHWMode();
1068310679
if (EnableNonSemanticDebug) {
1068410680
TranslatorArgs.push_back(
1068510681
"-spirv-debug-info-version=nonsemantic-shader-200");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Generate .o file as SYCL device library file.
2+
//
3+
// RUN: touch %t.devicelib.cpp
4+
// RUN: %clang %t.devicelib.cpp -fsycl -fsycl-targets=spir64-unknown-unknown -c --offload-new-driver -o %t_1.devicelib.o
5+
// RUN: %clang %t.devicelib.cpp -fsycl -fsycl-targets=spir64_gen-unknown-unknown -c --offload-new-driver -o %t_2.devicelib.o
6+
// RUN: %clang %t.devicelib.cpp -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown -c --offload-new-driver -o %t_3.devicelib.o
7+
8+
// Test for default llvm-spirv options
9+
10+
// RUN: %clang -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver \
11+
// RUN: -fsycl-targets=spir64-unknown-unknown -c %s -o %t_1.o
12+
// RUN: clang-linker-wrapper -sycl-device-libraries=%t_1.devicelib.o \
13+
// RUN: "--host-triple=x86_64-unknown-linux-gnu" "--linker-path=/usr/bin/ld" \
14+
// RUN: "--" "-o" "a.out" %t_1.o --dry-run 2>&1 | FileCheck %s
15+
16+
// CHECK: llvm-spirv{{.*}}-spirv-debug-info-version=nonsemantic-shader-200

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -830,19 +830,7 @@ getTripleBasedSPIRVTransOpts(const ArgList &Args,
830830
const llvm::Triple Triple) {
831831
bool IsCPU = Triple.isSPIR() &&
832832
Triple.getSubArch() == llvm::Triple::SPIRSubArch_x86_64;
833-
// Enable NonSemanticShaderDebugInfo.200 for CPU AOT and for non-Windows
834-
const bool IsWindowsMSVC = Triple.isWindowsMSVCEnvironment() ||
835-
Args.hasArg(OPT_sycl_is_windows_msvc_env);
836-
const bool EnableNonSemanticDebug = IsCPU || !IsWindowsMSVC;
837-
if (EnableNonSemanticDebug) {
838-
TranslatorArgs.push_back(
839-
"-spirv-debug-info-version=nonsemantic-shader-200");
840-
} else {
841-
TranslatorArgs.push_back("-spirv-debug-info-version=ocl-100");
842-
// Prevent crash in the translator if input IR contains DIExpression
843-
// operations which don't have mapping to OpenCL.DebugInfo.100 spec.
844-
TranslatorArgs.push_back("-spirv-allow-extra-diexpressions");
845-
}
833+
TranslatorArgs.push_back("-spirv-debug-info-version=nonsemantic-shader-200");
846834
std::string UnknownIntrinsics("-spirv-allow-unknown-intrinsics=llvm.genx.");
847835
if (IsCPU)
848836
UnknownIntrinsics += ",llvm.fpbuiltin";

0 commit comments

Comments
 (0)