Skip to content

Commit 91d1483

Browse files
committed
Disable ITT annotations under preview-breaking flag
1 parent d3255ee commit 91d1483

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5588,10 +5588,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
55885588

55895589
// Forward -fsycl-instrument-device-code option to cc1. This option will
55905590
// only be used for SPIR/SPIR-V based targets.
5591-
if (Triple.isSPIROrSPIRV())
5591+
// Disabled ITT annotations in device code, under
5592+
// -fpreview-breaking-changes.
5593+
if (Triple.isSPIROrSPIRV()) {
5594+
bool IsPreviewBreak = Args.hasArg(options::OPT_fpreview_breaking_changes);
55925595
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
5593-
options::OPT_fno_sycl_instrument_device_code, false))
5596+
options::OPT_fno_sycl_instrument_device_code,
5597+
!IsPreviewBreak))
55945598
CmdArgs.push_back("-fsycl-instrument-device-code");
5599+
}
55955600

55965601
if (!SYCLStdArg) {
55975602
// The user had not pass SYCL version, thus we'll employ no-sycl-strict

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,11 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
507507
addLibraries(SYCLDeviceBfloat16FallbackLib);
508508
}
509509

510+
// Disabled ITT annotations in device code, under -fpreview-breaking-changes.
511+
bool IsPreviewBreak = Args.hasArg(options::OPT_fpreview_breaking_changes);
510512
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
511-
options::OPT_fno_sycl_instrument_device_code, false))
513+
options::OPT_fno_sycl_instrument_device_code,
514+
!IsPreviewBreak))
512515
addLibraries(SYCLDeviceAnnotationLibs);
513516

514517
#if !defined(_WIN32)

clang/test/Driver/sycl-instrumentation-old-model.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
// FIXME: Force linux targets to allow for the libraries to be found. Dummy
88
// inputs for --sysroot should be updated to work better for Windows.
99

10-
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fsycl-targets=spir64 -### %s 2>&1 \
10+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver --sysroot=%S/Inputs/SYCL -fsycl-targets=spir64 -### %s 2>&1 \
1111
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV,CHECK-HOST %s
12+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fpreview-breaking-changes -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fsycl-targets=spir64 -### %s 2>&1 \
13+
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV,CHECK-HOST %s
14+
1215
// -fno-sycl-device-lib mustn't affect the linkage of ITT libraries
13-
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fno-sycl-device-lib=all -fsycl-targets=spir64 -### %s 2>&1 \
16+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver --sysroot=%S/Inputs/SYCL -fno-sycl-device-lib=all -fsycl-targets=spir64 -### %s 2>&1 \
17+
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV %s
18+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fpreview-breaking-changes -fsycl-instrument-device-code --sysroot=%S/Inputs/SYCL -fno-sycl-device-lib=all -fsycl-targets=spir64 -### %s 2>&1 \
1419
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV %s
1520

1621
// CHECK-SPIRV: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-fsycl-instrument-device-code"
@@ -25,5 +30,11 @@
2530
// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-targets=nvptx64-nvidia-cuda -fno-sycl-instrument-device-code -nocudalib -### %s 2>&1 \
2631
// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s
2732

33+
// ITT annotations are disabled by default under -fpreview-breaking-changes.
34+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fpreview-breaking-changes --sysroot=%S/Inputs/SYCL -fno-sycl-device-lib=all -fsycl-targets=spir64 -### %s 2>&1 \
35+
// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s
36+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fpreview-breaking-changes --sysroot=%S/Inputs/SYCL -fsycl-targets=spir64 -### %s 2>&1 \
37+
// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s
38+
2839
// CHECK-NONPASSED-NOT: "-fsycl-instrument-device-code"
2940
// CHECK-NONPASSED-NOT: llvm-link{{.*}} {{.*}}libsycl-itt-{{.*}}.bc"

clang/test/Driver/sycl-instrumentation.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,11 @@
2424
// RUN: %clangxx -fsycl --offload-new-driver -fsycl-targets=nvptx64-nvidia-cuda -fno-sycl-instrument-device-code -nocudalib -### %s 2>&1 \
2525
// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s
2626

27+
// ITT annotations are disabled by default under -fpreview-breaking-changes.
28+
// RUN: %clangxx -fsycl --offload-new-driver -fpreview-breaking-changes -fsycl-targets=spir64 -### %s 2>&1 \
29+
// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s
30+
// RUN: %clangxx -fsycl --offload-new-driver -fsycl-targets=nvptx64-nvidia-cuda -fpreview-breaking-changes -nocudalib -### %s 2>&1 \
31+
// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s
32+
2733
// CHECK-NONPASSED-NOT: "-fsycl-instrument-device-code"
2834
// CHECK-NONPASSED-NOT: clang-linker-wrapper{{.*}} {{.*}}libsycl-itt-{{.*}}

0 commit comments

Comments
 (0)