-
Notifications
You must be signed in to change notification settings - Fork 795
[SYCL] Update tests with new test cases for FPGA function attributes #3089
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,28 @@ | |
|
|
||
| // Test that checkes template parameter support for 'max_global_work_dim' attribute on sycl device. | ||
|
|
||
| // Test that checks wrong function template instantiation and ensures that the type | ||
| // is checked properly when instantiating from the template definition. | ||
| template <typename Ty> | ||
| // expected-error@+1{{'max_global_work_dim' attribute requires an integer constant}} | ||
| [[intel::max_global_work_dim(Ty{})]] void func() {} | ||
|
|
||
| struct S {}; | ||
| void var() { | ||
| //expected-note@+1{{in instantiation of function template specialization 'func<S>' requested here}} | ||
| func<S>(); | ||
|
Contributor
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. Another interesting test would be:
Contributor
Author
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.
Test is added. We get an implicit conversion to int for all attributes here.
Test is added.
Contributor
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. Is it expected that we get an implicit conversion for Also, is the inconsistency between the other attributes with
Contributor
Author
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. I have created #3100 for this issue and assigned to me. I will investigate this behavior for all of these in a separate PR. Thanks @AaronBallman for suggesting about this tests. |
||
| } | ||
|
|
||
| // Test that checks expression is not a constant expression. | ||
| int foo(); | ||
| // expected-error@+1{{'max_global_work_dim' attribute requires an integer constant}} | ||
| [[intel::max_global_work_dim(foo() + 1)]] void func1(); | ||
|
|
||
| // Test that checks expression is a constant expression. | ||
| constexpr int bar() { return 0; } | ||
| [[intel::max_global_work_dim(bar() + 2)]] void func2(); // OK | ||
|
|
||
| // Test that checks template parameter suppport on member function of class template. | ||
elizabethandrews marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| template <int SIZE> | ||
| class KernelFunctor { | ||
| public: | ||
|
|
@@ -23,3 +45,20 @@ int main() { | |
| // CHECK: SubstNonTypeTemplateParmExpr {{.*}} | ||
| // CHECK-NEXT: NonTypeTemplateParmDecl {{.*}} | ||
| // CHECK-NEXT: IntegerLiteral{{.*}}2{{$}} | ||
|
|
||
| // Test that checks template parameter support on function. | ||
| template <int N> | ||
| [[intel::max_global_work_dim(N)]] void func3() {} | ||
|
|
||
| int check() { | ||
| func3<2>(); | ||
| return 0; | ||
| } | ||
|
|
||
| // CHECK: FunctionTemplateDecl {{.*}} {{.*}} func3 | ||
| // CHECK: NonTypeTemplateParmDecl {{.*}} {{.*}} referenced 'int' depth 0 index 0 N | ||
| // CHECK: FunctionDecl {{.*}} {{.*}} func3 'void ()' | ||
| // CHECK: SYCLIntelMaxGlobalWorkDimAttr {{.*}} | ||
| // CHECK: SubstNonTypeTemplateParmExpr {{.*}} | ||
| // CHECK-NEXT: NonTypeTemplateParmDecl {{.*}} | ||
| // CHECK-NEXT: IntegerLiteral{{.*}}2{{$}} | ||
Uh oh!
There was an error while loading. Please reload this page.