-
Notifications
You must be signed in to change notification settings - Fork 788
[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 all commits
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,32 @@ | |
|
||
// 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 2{{'max_global_work_dim' attribute requires an integer constant}} | ||
[[intel::max_global_work_dim(Ty{})]] void func() {} | ||
|
||
struct S {}; | ||
void test() { | ||
//expected-note@+1{{in instantiation of function template specialization 'func<S>' requested here}} | ||
func<S>(); | ||
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: 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. 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 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. |
||
//expected-note@+1{{in instantiation of function template specialization 'func<float>' requested here}} | ||
func<float>(); | ||
// no error expected | ||
func<int>(); // OK | ||
} | ||
|
||
// 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 support on member function of class template. | ||
template <int SIZE> | ||
class KernelFunctor { | ||
public: | ||
|
@@ -23,3 +49,24 @@ int main() { | |
// CHECK: SubstNonTypeTemplateParmExpr {{.*}} | ||
// CHECK-NEXT: NonTypeTemplateParmDecl {{.*}} | ||
// CHECK-NEXT: IntegerLiteral{{.*}}2{{$}} | ||
|
||
// Test that checks template parameter support on function. | ||
template <int N> | ||
// expected-error@+1{{'max_global_work_dim' attribute requires a non-negative integral compile time constant expression}} | ||
[[intel::max_global_work_dim(N)]] void func3() {} | ||
|
||
int check() { | ||
// no error expected | ||
func3<2>(); | ||
//expected-note@+1{{in instantiation of function template specialization 'func3<-1>' requested here}} | ||
func3<-1>(); | ||
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.