-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[CudaSPIRV] Allow using integral non-type template parameters as attribute args #131546
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
alexander-shaposhnikov
merged 1 commit into
llvm:main
from
alexander-shaposhnikov:template_attr
Mar 19, 2025
Merged
Changes from all commits
Commits
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
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
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,58 @@ | ||
| // RUN: %clang_cc1 -triple spirv64 -aux-triple x86_64-unknown-linux-gnu \ | ||
| // RUN: -fcuda-is-device -verify -fsyntax-only %s | ||
|
|
||
alexander-shaposhnikov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #define __global__ __attribute__((global)) | ||
|
|
||
| __attribute__((reqd_work_group_size(0x100000000, 1, 1))) // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} | ||
| __global__ void TestTooBigArg1(void); | ||
|
|
||
| __attribute__((work_group_size_hint(0x100000000, 1, 1))) // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} | ||
| __global__ void TestTooBigArg2(void); | ||
|
|
||
| template <int... Args> | ||
| __attribute__((reqd_work_group_size(Args))) // expected-error {{expression contains unexpanded parameter pack 'Args'}} | ||
| __global__ void TestTemplateVariadicArgs1(void) {} | ||
|
|
||
| template <int... Args> | ||
| __attribute__((work_group_size_hint(Args))) // expected-error {{expression contains unexpanded parameter pack 'Args'}} | ||
| __global__ void TestTemplateVariadicArgs2(void) {} | ||
|
|
||
| template <class a> // expected-note {{declared here}} | ||
| __attribute__((reqd_work_group_size(a, 1, 1))) // expected-error {{'a' does not refer to a value}} | ||
| __global__ void TestTemplateArgClass1(void) {} | ||
|
|
||
| template <class a> // expected-note {{declared here}} | ||
| __attribute__((work_group_size_hint(a, 1, 1))) // expected-error {{'a' does not refer to a value}} | ||
| __global__ void TestTemplateArgClass2(void) {} | ||
|
|
||
| constexpr int A = 512; | ||
|
|
||
| __attribute__((reqd_work_group_size(A, A, A))) | ||
| __global__ void TestConstIntArg1(void) {} | ||
|
|
||
| __attribute__((work_group_size_hint(A, A, A))) | ||
| __global__ void TestConstIntArg2(void) {} | ||
|
|
||
| int B = 512; | ||
| __attribute__((reqd_work_group_size(B, 1, 1))) // expected-error {{attribute requires parameter 0 to be an integer constant}} | ||
| __global__ void TestNonConstIntArg1(void) {} | ||
|
|
||
| __attribute__((work_group_size_hint(B, 1, 1))) // expected-error {{attribute requires parameter 0 to be an integer constant}} | ||
| __global__ void TestNonConstIntArg2(void) {} | ||
|
|
||
| constexpr int C = -512; | ||
| __attribute__((reqd_work_group_size(C, 1, 1))) // expected-error {{attribute requires a non-negative integral compile time constant expression}} | ||
| __global__ void TestNegativeConstIntArg1(void) {} | ||
|
|
||
| __attribute__((work_group_size_hint(C, 1, 1))) // expected-error {{attribute requires a non-negative integral compile time constant expression}} | ||
| __global__ void TestNegativeConstIntArg2(void) {} | ||
|
|
||
|
|
||
| __attribute__((reqd_work_group_size(A, 0, 1))) // expected-error {{attribute must be greater than 0}} | ||
| __global__ void TestZeroArg1(void) {} | ||
|
|
||
| __attribute__((work_group_size_hint(A, 0, 1))) // expected-error {{attribute must be greater than 0}} | ||
| __global__ void TestZeroArg2(void) {} | ||
|
|
||
|
|
||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.