-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Driver] Save PTX files for SYCL kernels in the user input directory. (…
…#12422) Save `PTX` files generated (for `SYCL` kernels) during PTX target processing for CUDA backend using the `-fsycl-dump-device-code` option. Example usage: `clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fsycl-dmp-device-code=/path/to/ptx syclfile.cpp` The `PTX` files (`.s` files for each kernel) will be saved under `/path/to/ptx`
- Loading branch information
1 parent
db07a26
commit 16e06ff
Showing
3 changed files
with
73 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Save PTX files during PTX target processing using -fsycl-dump-device-code option. | ||
|
||
// Verify that -fsycl-dump-device-code saves PTX files in the user provided directory | ||
// while targeting CUDA enabled GPUs. | ||
|
||
// Linux | ||
// RUN: %clang -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown -target x86_64-unknown-linux-gnu --cuda-path=%S/Inputs/CUDA/usr/local/cuda -fsycl-dump-device-code=/user/input/path %s 2>&1 \ | ||
// RUN: | FileCheck %s --check-prefixes=CHECK-PTX-FILES,CHECK-SPIRV-FILES | ||
|
||
// clang --driver-mode=g++ | ||
// RUN: %clangxx -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda -target x86_64-unknown-linux-gnu --cuda-path=%S/Inputs/CUDA/usr/local/cuda -fsycl-dump-device-code=/user/input/path %s 2>&1 \ | ||
// RUN: | FileCheck %s --check-prefixes=CHECK-PTX-FILES | ||
|
||
// RUN: %clang -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown -target x86_64-unknown-linux-gnu --cuda-path=%S/Inputs/CUDA/usr/local/cuda -fsycl-dump-device-code= %s 2>&1 \ | ||
// RUN: | FileCheck %s --check-prefixes=CHECK-PTX-FILES-CWD,CHECK-SPIRV-FILES-CWD | ||
|
||
// CHECK-PTX-FILES: llvm-foreach{{.*}} "--out-ext=s"{{.*}} "--out-dir=/user/input/path{{(/|\\\\)}}" "--" "{{.*}}clang{{.*}}" {{.*}} "-fsycl-is-device" {{.*}}.s{{.*}} | ||
// CHECK-SPIRV-FILES: llvm-foreach{{.*}} "--out-dir=/user/input/path{{(/|\\\\)}}" "--" "{{.*}}llvm-spirv" | ||
// CHECK-PTX-FILES-CWD: llvm-foreach{{.*}} "--out-ext=s"{{.*}} "--out-dir=.{{(/|\\\\)}}" "--" "{{.*}}clang{{.*}}" {{.*}} "-fsycl-is-device" | ||
// CHECK-SPIRV-FILES-CWD: llvm-foreach{{.*}} "--out-dir=.{{(/|\\\\)}}" "--" "{{.*}}llvm-spirv" | ||
|
||
// Windows - Check if PTX files are saved in the user provided path. | ||
// RUN: %clang_cl -### -fsycl \ | ||
// RUN: -fsycl-targets=nvptx64-nvidia-cuda --cuda-path=%S/Inputs/CUDA/usr/local/cuda \ | ||
// RUN: -fsycl-dump-device-code=/user/input/path %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=CHECK-PTX-WIN %s | ||
|
||
// Windows - Check if PTX and SPV files are saved in user provided path. | ||
// RUN: %clang_cl -### -fsycl \ | ||
// RUN: -fsycl-targets=nvptx64-nvidia-cuda,spir64-unknown-unknown --cuda-path=%S/Inputs/CUDA/usr/local/cuda \ | ||
// RUN: -fsycl-dump-device-code=/user/input/path %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefixes=CHECK-PTX-WIN,CHECK-SPV-WIN %s | ||
|
||
// Windows - Check PTX files saved in current working directory when -fsycl-dump-device-code | ||
// is empty. | ||
// RUN: %clang_cl -### -fsycl \ | ||
// RUN: -fsycl-targets=nvptx64-nvidia-cuda --cuda-path=%S/Inputs/CUDA/usr/local/cuda \ | ||
// RUN: -fsycl-dump-device-code= %s 2>&1 \ | ||
// RUN: | FileCheck -check-prefix=CHECK-PTX-WIN-CWD %s | ||
|
||
// CHECK-PTX-WIN: llvm-foreach{{.*}} "--out-ext=s"{{.*}} "--out-dir=/user/input/path{{(/|\\\\)}}" "--" "{{.*}}clang{{.*}}" {{.*}} "-fsycl-is-device" {{.*}}.asm{{.*}} | ||
// CHECK-PTX-WIN-CWD: llvm-foreach{{.*}} "--out-ext=s"{{.*}} "--out-dir=.{{(/|\\\\)}}" "--" "{{.*}}clang{{.*}}" {{.*}} "-fsycl-is-device" {{.*}}.asm{{.*}} | ||
// CHECK-SPV-WIN: llvm-foreach{{.*}} "--out-dir=/user/input/path{{(/|\\\\)}}" "--" "{{.*}}llvm-spirv" |