-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Fix device code instrumentation (#4615)
- Fix the malfunctioning driver option for passing `-fsycl-instrument-device-code` to CC1 for SPIR-V-based targets. - Add the ITT device libraries when the CLI option is enabled, excluding these from `-fno-sycl-device-lib` effects. - Disable ITT annotations for ESIMD code. Tests are in intel/llvm-test-suite#484. Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
- Loading branch information
1 parent
d37744a
commit 5667aba
Showing
8 changed files
with
90 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
/// Check that SPIR ITT instrumentation is disabled by default: | ||
// RUN: %clang -### %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s | ||
// CHECK-DEFAULT-NOT: "-fsycl-instrument-device-code" | ||
/// Check if -fsycl-instrument-device-code is passed to device-side -cc1 | ||
/// and if ITT device libraries are pulled in. | ||
/// The following conditions must be fulfilled: | ||
/// 1. A SPIR-V-based environment must be targetted | ||
/// 2. The corresponding Driver option must be enabled explicitly | ||
|
||
/// Check if "fsycl_instrument_device_code" is passed to -cc1: | ||
// RUN: %clang -### -fsycl-instrument-device-code %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=CHECK-ENABLED %s | ||
// CHECK-ENABLED: "-cc1"{{.*}} "-fsycl-instrument-device-code" | ||
// RUN: %clangxx -fsycl -fsycl-instrument-device-code -fsycl-targets=spir64 -### %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV,CHECK-HOST %s | ||
/// -fno-sycl-device-lib mustn't affect the linkage of ITT libraries | ||
// RUN: %clangxx -fsycl -fsycl-instrument-device-code -fno-sycl-device-lib=all -fsycl-targets=spir64 -### %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefixes=CHECK-SPIRV %s | ||
|
||
/// Check if "fsycl_instrument_device_code" usage with a non-spirv target | ||
/// results in an error. | ||
// RUN: %clang -### -fsycl-instrument-device-code --target=x86 %s 2>&1 | ||
// expected-error{{unsupported option '-fsycl-instrument-device-code' for target 'x86_64-unknown-linux-gnu'}} | ||
// CHECK-SPIRV: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-fsycl-instrument-device-code" | ||
// CHECK-SPIRV: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-inputs={{.*}}libsycl-itt-user-wrappers.{{o|obj}}" "-outputs={{.*}}libsycl-itt-user-wrappers-{{.*}}.{{o|obj}}" "-unbundle" | ||
// CHECK-SPIRV: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-inputs={{.*}}libsycl-itt-compiler-wrappers.{{o|obj}}" "-outputs={{.*}}libsycl-itt-compiler-wrappers-{{.*}}.{{o|obj}}" "-unbundle" | ||
// CHECK-SPIRV: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-inputs={{.*}}libsycl-itt-stubs.{{o|obj}}" "-outputs={{.*}}libsycl-itt-stubs-{{.*}}.{{o|obj}}" "-unbundle" | ||
// CHECK-SPIRV: llvm-link{{.*}} "-only-needed" "{{.*}}" "-o" "{{.*}}.bc" "--suppress-warnings" | ||
// CHECK-HOST-NOT: "-cc1"{{.*}} "-fsycl-is-host"{{.*}} "-fsycl-instrument-device-code" | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=spir64 -### %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefixes=CHECK-NONPASSED %s | ||
// RUN: %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fsycl-instrument-device-code -nocudalib -### %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefixes=CHECK-WARNING,CHECK-NONPASSED %s | ||
// CHECK-NONPASSED-NOT: "-fsycl-instrument-device-code" | ||
// CHECK-NONPASSED-NOT: "-inputs={{.*}}libsycl-itt-{{.*}}.{{o|obj}}" | ||
// CHECK-WARNING: warning: argument unused during compilation: '-fsycl-instrument-device-code' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters