-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Enable template parameter support for ii and max_concurrency attributes #811
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
feb279e
99756da
61beb09
de0cbe5
06fbe71
4688eda
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 |
---|---|---|
|
@@ -65,11 +65,11 @@ void goo() { | |
[[intelfpga::ivdep(0)]] | ||
for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
// expected-warning@+1 {{'ii' attribute requires a positive integral compile time constant expression - attribute ignored}} | ||
// expected-error@+1 {{'ii' attribute requires a positive integral compile time constant expression}} | ||
MrSidims marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[[intelfpga::ii(0)]] | ||
for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
// expected-warning@+1 {{'max_concurrency' attribute requires a non-negative integral compile time constant expression - attribute ignored}} | ||
// expected-error@+1 {{'max_concurrency' attribute requires a non-negative integral compile time constant expression}} | ||
[[intelfpga::max_concurrency(-1)]] | ||
for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
|
@@ -229,6 +229,36 @@ void ivdep_dependent() { | |
}; | ||
} | ||
|
||
template <int A, int B, int C> | ||
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. Can you test a non-dependent attribute in a dependent context? I have a feeling that the transforms running on a non-dependent version will cause the int value to be lost. 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. You're right, int value is lost in this case. Do you have any suggestions why it happens or how to handle this? As I see, it requires more than one-line fix, but unfortunately I have no idea where the error can be hidden. 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 think the best way about this is to just remove the IntervalValue field from the attribute. I don't think it is necessary anyway. It'll simplify a bunch of code, and result in only the Expr needing to be handled everywhere. It means you need to do a touch more work in CGLoopInfo (call isIntegerConstantExpr() on the expr to get the integer value out), but it simplifies the rest of the patch a bunch. |
||
void ii_dependent() { | ||
int a[10]; | ||
// expected-error@+1 {{'ii' attribute requires a positive integral compile time constant expression}} | ||
[[intelfpga::ii(C)]] | ||
for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
|
||
// expected-error@+1 {{duplicate Intel FPGA loop attribute 'ii'}} | ||
[[intelfpga::ii(A)]] | ||
[[intelfpga::ii(B)]] | ||
for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
} | ||
|
||
template <int A, int B, int C> | ||
void max_concurrency_dependent() { | ||
int a[10]; | ||
// expected-error@+1 {{'max_concurrency' attribute requires a non-negative integral compile time constant expression}} | ||
[[intelfpga::max_concurrency(C)]] | ||
for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
|
||
// expected-error@+1 {{duplicate Intel FPGA loop attribute 'max_concurrency'}} | ||
[[intelfpga::max_concurrency(A)]] | ||
[[intelfpga::max_concurrency(B)]] | ||
for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
} | ||
|
||
template <typename name, typename Func> | ||
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) { | ||
kernelFunc(); | ||
|
@@ -244,6 +274,10 @@ int main() { | |
//expected-note@-1 +{{in instantiation of function template specialization}} | ||
ivdep_dependent<2, 4, -1>(); | ||
//expected-note@-1 +{{in instantiation of function template specialization}} | ||
ii_dependent<2, 4, -1>(); | ||
//expected-note@-1 +{{in instantiation of function template specialization}} | ||
max_concurrency_dependent<1, 4, -2>(); | ||
//expected-note@-1 +{{in instantiation of function template specialization}} | ||
}); | ||
return 0; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.