From 3e43edcb41f81aee4f8fbf0c0a3ea8cd4638b2bd Mon Sep 17 00:00:00 2001 From: Michael D Toguchi Date: Thu, 12 Dec 2024 12:10:13 -0800 Subject: [PATCH 1/2] [Driver][NFC] Update test to use internal sysroot for device libs There is no guarantee that the device libraries are going to be built for a given built compiler. Use the internal sysroot setting to allow for proper inclusion of dependent device libraries for SYCL testing. --- .../Driver/sycl-instrumentation-old-model.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/clang/test/Driver/sycl-instrumentation-old-model.c b/clang/test/Driver/sycl-instrumentation-old-model.c index bf1471fad84ef..11e0ea94468cf 100644 --- a/clang/test/Driver/sycl-instrumentation-old-model.c +++ b/clang/test/Driver/sycl-instrumentation-old-model.c @@ -20,19 +20,25 @@ // CHECK-SPIRV-SAME: "{{.*}}libsycl-itt-stubs.bc" // CHECK-HOST-NOT: "-cc1"{{.*}} "-fsycl-is-host"{{.*}} "-fsycl-instrument-device-code" -// ITT annotations in device code are disabled by default. However, for SYCL offloading, -// we still link ITT annotations libraries to ensure ABI compatibility with previous release. -// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-targets=spir64 -### %s 2>&1 \ +// ITT annotations in device code are disabled by default. However, for SYCL +// offloading, we still link ITT annotations libraries to ensure ABI +// compatibility with previous release. +// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-targets=spir64 -### \ +// RUN: --sysroot=%S/Inputs/SYCL %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK-ITT-LINK-ONLY %s -// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -### %s 2>&1 \ +// RUN: %clangxx -fsycl --no-offload-new-driver --sysroot=%S/Inputs/SYCL \ +// RUN: -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -### %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s // CHECK-ITT-LINK-ONLY-NOT: "-fsycl-instrument-device-code" // CHECK-ITT-LINK-ONLY: llvm-link{{.*}} {{.*}}libsycl-itt-{{.*}} -// RUN: %clangxx -fsycl --no-offload-new-driver -fno-sycl-instrument-device-code -fsycl-targets=spir64 -### %s 2>&1 \ +// RUN: %clangxx -fsycl --no-offload-new-driver --sysroot=%S/Inputs/SYCL \ +// RUN: -fno-sycl-instrument-device-code -fsycl-targets=spir64 -### %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s -// RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-targets=nvptx64-nvidia-cuda -fno-sycl-instrument-device-code -nocudalib -### %s 2>&1 \ +// RUN: %clangxx -fsycl --no-offload-new-driver --sysroot=%s/Inputs/SYCL \ +// RUN: -fsycl-targets=nvptx64-nvidia-cuda -fno-sycl-instrument-device-code \ +// RUN: -nocudalib -### %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s // CHECK-NONPASSED-NOT: "-fsycl-instrument-device-code" From aabac7ba305d4ee46f357c2f8f336d141829eea4 Mon Sep 17 00:00:00 2001 From: Michael D Toguchi Date: Thu, 12 Dec 2024 13:45:48 -0800 Subject: [PATCH 2/2] Add comment and combine no ITT check tests --- clang/test/Driver/sycl-instrumentation-old-model.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clang/test/Driver/sycl-instrumentation-old-model.c b/clang/test/Driver/sycl-instrumentation-old-model.c index 11e0ea94468cf..67e3f70b3374a 100644 --- a/clang/test/Driver/sycl-instrumentation-old-model.c +++ b/clang/test/Driver/sycl-instrumentation-old-model.c @@ -26,13 +26,15 @@ // RUN: %clangxx -fsycl --no-offload-new-driver -fsycl-targets=spir64 -### \ // RUN: --sysroot=%S/Inputs/SYCL %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK-ITT-LINK-ONLY %s -// RUN: %clangxx -fsycl --no-offload-new-driver --sysroot=%S/Inputs/SYCL \ -// RUN: -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -### %s 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s // CHECK-ITT-LINK-ONLY-NOT: "-fsycl-instrument-device-code" // CHECK-ITT-LINK-ONLY: llvm-link{{.*}} {{.*}}libsycl-itt-{{.*}} +// Verify that ITT annotations are not pulled in for non-SPIR-V targets as +// well as when device code instrumentation is explicitly turned off. +// RUN: %clangxx -fsycl --no-offload-new-driver --sysroot=%S/Inputs/SYCL \ +// RUN: -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -### %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s // RUN: %clangxx -fsycl --no-offload-new-driver --sysroot=%S/Inputs/SYCL \ // RUN: -fno-sycl-instrument-device-code -fsycl-targets=spir64 -### %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s