|
| 1 | +/// |
| 2 | +/// Check that we call into backend assembler, when using `asm` as device |
| 3 | +/// object format, namely: |
| 4 | +/// `backend, {2}, assembler, (device-sycl, ...)` |
| 5 | + |
| 6 | +// REQUIRES: nvptx-registered-target,amdgpu-registered-target |
| 7 | + |
| 8 | +/// Check -fsycl-device-obj=asm for AMD. |
| 9 | +// RUN: %clang -fsycl-device-only -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx90a -fsycl-device-obj=asm -S %s 2>&1 -ccc-print-phases -o - | FileCheck %s --check-prefix=CHECK-AMD |
| 10 | +// CHECK-AMD: 0: input, "{{.+\.cpp}}", c++, (device-sycl, gfx90a) |
| 11 | +// CHECK-AMD: 1: preprocessor, {0}, c++-cpp-output, (device-sycl, gfx90a) |
| 12 | +// CHECK-AMD: 2: compiler, {1}, ir, (device-sycl, gfx90a) |
| 13 | +// CHECK-AMD: 3: backend, {2}, assembler, (device-sycl, gfx90a) |
| 14 | +// CHECK-AMD: 4: offload, "device-sycl (amdgcn-amd-amdhsa:gfx90a)" {3}, assembler |
| 15 | + |
| 16 | +/// Check -fsycl-device-obj=asm for Nvidia. |
| 17 | +// RUN: %clang -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=asm -S %s 2>&1 -ccc-print-phases -o - | FileCheck %s --check-prefix=CHECK-PTX |
| 18 | +// CHECK-PTX: 0: input, "{{.+\.cpp}}", c++, (device-sycl, sm_50) |
| 19 | +// CHECK-PTX: 1: preprocessor, {0}, c++-cpp-output, (device-sycl, sm_50) |
| 20 | +// CHECK-PTX: 2: compiler, {1}, ir, (device-sycl, sm_50) |
| 21 | +// CHECK-PTX: 3: backend, {2}, assembler, (device-sycl, sm_50) |
| 22 | +// CHECK-PTX: 4: offload, "device-sycl (nvptx64-nvidia-cuda:sm_50)" {3}, assembler |
| 23 | + |
| 24 | +/// Check -fsycl-device-obj option when emitting llvm IR. |
| 25 | +// RUN: %clang -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=llvmir -S %s 2>&1 -ccc-print-phases -o - | FileCheck %s --check-prefix=CHECK-LLVMIR |
| 26 | +// CHECK-LLVMIR: 0: input, "{{.+\.cpp}}", c++, (device-sycl, sm_50) |
| 27 | +// CHECK-LLVMIR: 1: preprocessor, {0}, c++-cpp-output, (device-sycl, sm_50) |
| 28 | +// CHECK-LLVMIR: 2: compiler, {1}, ir, (device-sycl, sm_50) |
| 29 | +// CHECK-LLVMIR: 3: offload, "device-sycl (nvptx64-nvidia-cuda:sm_50)" {2}, ir |
| 30 | + |
| 31 | +/// -fsycl-device-obj=asm should always be accompanied by -fsycl-device-only |
| 32 | +/// and -S, check that the compiler issues a correct warning message: |
| 33 | +// RUN: %clang -nocudalib -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=asm %s 2>&1 -o - | FileCheck %s --check-prefix=CHECK-NO-DEV-ONLY-NO-S |
| 34 | +// CHECK-NO-DEV-ONLY-NO-S: warning: -fsycl-device-obj=asm flag has an effect only when compiling device code and emitting assembly, make sure both -fsycl-device-only and -S flags are present; will be ignored [-Wunused-command-line-argument] |
| 35 | + |
| 36 | +/// -fsycl-device-obj=asm will finish at generating assembly stage, hence |
| 37 | +/// inform users that generating library will not be possible (ignore -c) |
| 38 | +// RUN: %clang -nocudalib -fsycl-device-only -fsycl -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_50 -fsycl-device-obj=asm %s 2>&1 -fsycl-device-only -S -c -o - | FileCheck %s --check-prefix=CHECK-DASH-C-IGNORE |
| 39 | +// CHECK-DASH-C-IGNORE: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument] |
0 commit comments