-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Extend -fsycl-device-obj to dump assembly #17390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5e39582
Allow "ptx" as device object format
stefanatwork 34f7247
[SYCL] Test and generalise -fsycl-deice-obj=asm to support more targets
jchlanda 16d79d3
SmallVector has 3 elems
jchlanda 23cfdca
Merge remote-tracking branch 'upstream/sycl' into stefanatwork/ptx_out
jchlanda 2e37246
Merge remote-tracking branch 'upstream/sycl' into stefanatwork/ptx_out
jchlanda ad064bb
-S and -fsycl-device-only
jchlanda 58df6db
Tweak warning message
jchlanda ef4344e
Align the test and the warning message
jchlanda 5b725dc
PR feedback and nocudalib in tests
jchlanda 4681124
Merge remote-tracking branch 'upstream/sycl' into stefanatwork/ptx_out
jchlanda a5eee25
Merge remote-tracking branch 'upstream/sycl' into stefanatwork/ptx_out
jchlanda bd3df96
Merge remote-tracking branch 'upstream/sycl' into stefanatwork/ptx_out
jchlanda 5ac63f4
Merge remote-tracking branch 'upstream/sycl' into stefanatwork/ptx_out
jchlanda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
/// | ||
/// Check that we call into backend assembler, when using `asm` as device | ||
/// object format, namely: | ||
/// `backend, {2}, assembler, (device-sycl, ...)` | ||
|
||
// REQUIRES: nvptx-registered-target,amdgpu-registered-target | ||
|
||
/// Check -fsycl-device-obj=asm for AMD. | ||
// 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 | ||
// CHECK-AMD: 0: input, "{{.+\.cpp}}", c++, (device-sycl, gfx90a) | ||
// CHECK-AMD: 1: preprocessor, {0}, c++-cpp-output, (device-sycl, gfx90a) | ||
// CHECK-AMD: 2: compiler, {1}, ir, (device-sycl, gfx90a) | ||
// CHECK-AMD: 3: backend, {2}, assembler, (device-sycl, gfx90a) | ||
// CHECK-AMD: 4: offload, "device-sycl (amdgcn-amd-amdhsa:gfx90a)" {3}, assembler | ||
|
||
/// Check -fsycl-device-obj=asm for Nvidia. | ||
// 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 | ||
// CHECK-PTX: 0: input, "{{.+\.cpp}}", c++, (device-sycl, sm_50) | ||
// CHECK-PTX: 1: preprocessor, {0}, c++-cpp-output, (device-sycl, sm_50) | ||
// CHECK-PTX: 2: compiler, {1}, ir, (device-sycl, sm_50) | ||
// CHECK-PTX: 3: backend, {2}, assembler, (device-sycl, sm_50) | ||
// CHECK-PTX: 4: offload, "device-sycl (nvptx64-nvidia-cuda:sm_50)" {3}, assembler | ||
|
||
/// Check -fsycl-device-obj option when emitting llvm IR. | ||
// 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 | ||
// CHECK-LLVMIR: 0: input, "{{.+\.cpp}}", c++, (device-sycl, sm_50) | ||
// CHECK-LLVMIR: 1: preprocessor, {0}, c++-cpp-output, (device-sycl, sm_50) | ||
// CHECK-LLVMIR: 2: compiler, {1}, ir, (device-sycl, sm_50) | ||
// CHECK-LLVMIR: 3: offload, "device-sycl (nvptx64-nvidia-cuda:sm_50)" {2}, ir | ||
|
||
/// -fsycl-device-obj=asm should always be accompanied by -fsycl-device-only | ||
/// and -S, check that the compiler issues a correct warning message: | ||
// 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 | ||
// 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] | ||
|
||
/// -fsycl-device-obj=asm will finish at generating assembly stage, hence | ||
/// inform users that generating library will not be possible (ignore -c) | ||
// 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 | ||
// CHECK-DASH-C-IGNORE: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument] |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.