-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[NVPTX] Annotate CUDA kernel pointer arguments with .ptr .space .align attributes. #79646
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
Closed
Closed
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d5bd021
Enable .ptr .global .align attributes for kernel attributes for CUDA
Vandana2896 a952cc1
Rearrange code, add comment
Vandana2896 f5e7276
Fixed clang formatting
Vandana2896 761d8a0
Update NVPTXAsmPrinter.cpp
Vandana2896 3d49f30
Update NVPTXAsmPrinter.cpp
Vandana2896 424667b
Update .global and .align
Vandana2896 637da98
Merge branch 'main' of https://github.com/Vandana2896/llvm-project in…
Vandana2896 3912211
Fix comment
Vandana2896 ce29dc1
add addrspace
Vandana2896 fbedea5
Fix typo
Vandana2896 75cce1b
CHECK-LABEL
Vandana2896 9fc5d6c
Update testcase
Vandana2896 9171d70
Merge branch 'main' into main
Vandana2896 14291a9
upadte test
Vandana2896 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| ; RUN: llc < %s -march=nvptx64 -mcpu=sm_72 2>&1 | FileCheck %s | ||
| ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_72 | %ptxas-verify %} | ||
|
|
||
| %struct.Large = type { [16 x double] } | ||
|
|
||
| ; CHECK: .param .u64 .ptr .global .align 16 func_align_param_0, | ||
Vandana2896 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ; CHECK: .param .u64 .ptr .global func_align_param_1, | ||
| ; CHECK: .param .u32 .ptr .global func_align_param_2 | ||
Vandana2896 marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still wrong. Speaking of which, please also add a test for explicitly annotated const and global AS pointers. |
||
| define void @func_align(ptr nocapture readonly align 16 %input, ptr addrspace(3) nocapture %out, i32 %n) { | ||
| entry: | ||
| %0 = addrspacecast ptr %out to ptr addrspace(1) | ||
| %1 = addrspacecast ptr %input to ptr addrspace(1) | ||
| %getElem = getelementptr inbounds %struct.Large, ptr addrspace(1) %1, i64 0, i32 0, i64 5 | ||
| %tmp2 = load i32, ptr addrspace(1) %getElem, align 8 | ||
| store i32 %tmp2, ptr addrspace(1) %0, align 4 | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK: .param .ptr .global .u64 func_param_0, | ||
Vandana2896 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ; CHECK: .param .ptr .global .u64 func_param_1, | ||
| ; CHECK: .param .u32 func_param_2 | ||
| define void @func(ptr nocapture readonly %input, ptr nocapture %out, i32 %n) { | ||
| entry: | ||
| %0 = addrspacecast ptr %out to ptr addrspace(1) | ||
| %1 = addrspacecast ptr %input to ptr addrspace(1) | ||
| %getElem = getelementptr inbounds %struct.Large, ptr addrspace(1) %1, i64 0, i32 0, i64 5 | ||
| %tmp2 = load i32, ptr addrspace(1) %getElem, align 8 | ||
| store i32 %tmp2, ptr addrspace(1) %0, align 4 | ||
| ret void | ||
| } | ||
|
|
||
| !nvvm.annotations = !{!0, !1} | ||
| !0 = !{ptr @func_align, !"kernel", i32 1} | ||
| !1 = !{ptr @func, !"kernel", i32 1} | ||
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.
Uh oh!
There was an error while loading. Please reload this page.