You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Refactor of FPGA loop fusion function attributes (#3298)
This patch
1. refactors two function attributes using #3224 :
[[intel::loop_fuse()]] and [[intel::loop_fuse_independent()]]
2. store expression as ConstantExpr in Semantic Attributes
3. handles template instantiations properly for duplicate attributes on a given declaration.
4. adds test
5. updates codegen codes
Signed-off-by: Soumi Manna <soumi.manna@intel.com>
// Tests for incorrect argument values for Intel FPGA loop fusion function attributes
3
4
[[intel::loop_fuse(5)]] int a; // expected-error{{'loop_fuse' attribute only applies to functions}}
4
5
5
-
[[intel::loop_fuse("foo")]] voidfunc() {} // expected-error{{'loop_fuse' attribute requires an integer constant}}
6
+
[[intel::loop_fuse("foo")]] voidfunc() {} // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const char [4]'}}
6
7
7
8
[[intel::loop_fuse(1048577)]] voidfunc1() {} // OK
8
9
[[intel::loop_fuse_independent(-1)]] voidfunc2() {} // expected-error{{'loop_fuse_independent' attribute requires a non-negative integral compile time constant expression}}
9
10
10
11
[[intel::loop_fuse(0, 1)]] voidfunc3() {} // expected-error{{'loop_fuse' attribute takes no more than 1 argument}}
11
12
[[intel::loop_fuse_independent(2, 3)]] voidfunc4() {} // expected-error{{'loop_fuse_independent' attribute takes no more than 1 argument}}
12
13
14
+
// Tests for Intel FPGA loop attributes duplication
13
15
// No diagnostic is thrown since arguments match. Duplicate attribute is silently ignored.
[[intel::loop_fuse]] [[intel::loop_fuse(10)]] voidfunc7() {} // expected-warning {{attribute 'loop_fuse' is already applied with different arguments}}
18
-
[[intel::loop_fuse_independent(5)]] [[intel::loop_fuse_independent(10)]] voidfunc8() {} // expected-warning {{attribute 'loop_fuse_independent' is already applied with different arguments}}
19
+
// Tests for merging of different argument values for Intel FPGA loop fusion function attributes
20
+
[[intel::loop_fuse]] // expected-note {{previous attribute is here}}
21
+
[[intel::loop_fuse(10)]] voidfunc7() {} // expected-warning {{attribute 'loop_fuse' is already applied with different arguments}}
22
+
23
+
[[intel::loop_fuse_independent(5)]] // expected-note {{previous attribute is here}}
24
+
[[intel::loop_fuse_independent(10)]] voidfunc8() {} // expected-warning {{attribute 'loop_fuse_independent' is already applied with different arguments}}
[[intel::loop_fuse_independent(10)]] voidfunc10();// OK
25
31
26
-
[[intel::loop_fuse(1)]] voidfunc11();
32
+
[[intel::loop_fuse(1)]] voidfunc11();// expected-note {{previous attribute is here}}
27
33
[[intel::loop_fuse(3)]] voidfunc11(); // expected-warning {{attribute 'loop_fuse' is already applied with different arguments}}
28
34
29
-
[[intel::loop_fuse_independent(1)]] voidfunc12();
35
+
[[intel::loop_fuse_independent(1)]] voidfunc12();// expected-note {{previous attribute is here}}
30
36
[[intel::loop_fuse_independent(3)]] voidfunc12(); // expected-warning {{attribute 'loop_fuse_independent' is already applied with different arguments}}
31
37
38
+
[[intel::loop_fuse_independent]]
39
+
[[intel::loop_fuse_independent]] voidfunc13() {} // OK
40
+
41
+
[[intel::loop_fuse_independent]] // expected-note {{previous attribute is here}}
42
+
[[intel::loop_fuse_independent(10)]] voidfunc14() {} // expected-warning {{attribute 'loop_fuse_independent' is already applied with different arguments}}
43
+
44
+
// Tests for Intel FPGA loop fusion function attributes compatibility
32
45
// expected-error@+2 {{'loop_fuse_independent' and 'loop_fuse' attributes are not compatible}}
33
46
// expected-note@+1 {{conflicting attribute is here}}
// expected-error@+2 {{'loop_fuse' and 'loop_fuse_independent' attributes are not compatible}}
41
54
// expected-note@+2 {{conflicting attribute is here}}
42
-
[[intel::loop_fuse]] voidfunc15();
43
-
[[intel::loop_fuse_independent]] voidfunc15();
55
+
[[intel::loop_fuse]] voidfunc17();
56
+
[[intel::loop_fuse_independent]] voidfunc17();
44
57
45
58
// expected-error@+2 {{'loop_fuse_independent' and 'loop_fuse' attributes are not compatible}}
46
59
// expected-note@+2 {{conflicting attribute is here}}
47
-
[[intel::loop_fuse_independent]] voidfunc16();
48
-
[[intel::loop_fuse]] voidfunc16();
60
+
[[intel::loop_fuse_independent]] voidfunc18();
61
+
[[intel::loop_fuse]] voidfunc18();
49
62
63
+
// Tests that check template parameter support for Intel FPGA loop fusion function attributes
50
64
template <int N>
51
-
[[intel::loop_fuse(N)]] voidfunc17(); // expected-error{{'loop_fuse' attribute requires a non-negative integral compile time constant expression}}
65
+
[[intel::loop_fuse(N)]] voidfunc19(); // expected-error{{'loop_fuse' attribute requires a non-negative integral compile time constant expression}}
52
66
53
-
template <typename Ty>
54
-
[[intel::loop_fuse(Ty{})]] voidfunc18() {} // expected-error{{'loop_fuse' attribute requires an integer constant}}
67
+
template <int size>
68
+
[[intel::loop_fuse(12)]] voidfunc20(); // expected-note {{previous attribute is here}}
69
+
template <int size>
70
+
[[intel::loop_fuse(size)]] voidfunc20() {} // expected-warning {{attribute 'loop_fuse' is already applied with different arguments}}
71
+
72
+
template <int size>
73
+
[[intel::loop_fuse_independent(5)]] voidfunc21(); // expected-note {{previous attribute is here}}
74
+
template <int size>
75
+
[[intel::loop_fuse_independent(size)]] voidfunc21() {} // expected-warning {{attribute 'loop_fuse_independent' is already applied with different arguments}}
0 commit comments