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][FPGA][NFC] Fix num_simd_work_items and reqd_work_group_size argument check (#3275)
According to https://www.intel.com/content/www/us/en/programmable/documentation/mwh1391807965224.html#mwh1391807939093 (section : 5.2.13. Specifying Number of SIMD Work-Items):
Important: Introduce the num_simd_work_items attribute in conjunction with the reqd_work_group_size attribute. The num_simd_work_items attribute you specify must evenly divide the work-group size you specify for the reqd_work_group_size attribute.
Based on discussion, the requirement applies only for X argument of reqd_work_group_size attribute.
Signed-off-by: Soumi Manna <[email protected]>
Copy file name to clipboardExpand all lines: clang/test/SemaSYCL/num_simd_work_items_device.cpp
+45-36Lines changed: 45 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -40,72 +40,77 @@ struct FuncObj {
40
40
};
41
41
42
42
#ifdef TRIGGER_ERROR
43
+
// If the declaration has an [[intel::reqd_work_group_size]] or
44
+
// [[cl::reqd_work_group_size]] attribute, tests that check if
45
+
// the work group size attribute argument (the first argument)
46
+
// can be evenly divided by the num_simd_work_items attribute.
43
47
structTRIFuncObjBad1 {
44
48
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
45
-
[[intel::reqd_work_group_size(5, 5, 5)]] //expected-note{{conflicting attribute is here}}
49
+
[[intel::reqd_work_group_size(5, 3, 3)]] //expected-note{{conflicting attribute is here}}
46
50
void
47
51
operator()() const {}
48
52
};
49
53
50
54
structTRIFuncObjBad2 {
51
-
[[intel::reqd_work_group_size(5, 5, 5)]] // expected-note{{conflicting attribute is here}}
55
+
[[intel::reqd_work_group_size(5, 3, 3)]] // expected-note{{conflicting attribute is here}}
52
56
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
53
57
void
54
58
operator()() const {}
55
59
};
56
60
57
61
structTRIFuncObjBad3 {
58
62
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
59
-
[[cl::reqd_work_group_size(5, 5, 5)]] //expected-note{{conflicting attribute is here}}
63
+
[[cl::reqd_work_group_size(5, 3, 3)]] //expected-note{{conflicting attribute is here}}
60
64
void
61
65
operator()() const {}
62
66
};
63
67
64
68
structTRIFuncObjBad4 {
65
-
[[cl::reqd_work_group_size(5, 5, 5)]] // expected-note{{conflicting attribute is here}}
69
+
[[cl::reqd_work_group_size(5, 3, 3)]] // expected-note{{conflicting attribute is here}}
66
70
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
67
71
void
68
72
operator()() const {}
69
73
};
70
74
71
75
structTRIFuncObjBad5 {
72
-
[[intel::num_simd_work_items(0)]] // expected-error{{'num_simd_work_items' attribute requires a positive integral compile time constant expression}}
73
-
[[intel::reqd_work_group_size(5, 5, 5)]] void
76
+
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
77
+
[[intel::reqd_work_group_size(5)]] //expected-note{{conflicting attribute is here}}
78
+
void
74
79
operator()() const {}
75
80
};
76
81
77
82
structTRIFuncObjBad6 {
83
+
[[intel::reqd_work_group_size(5)]] // expected-note{{conflicting attribute is here}}
78
84
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
79
-
[[intel::reqd_work_group_size(5)]] //expected-note{{conflicting attribute is here}}
80
85
void
81
86
operator()() const {}
82
87
};
83
88
84
89
structTRIFuncObjBad7 {
85
-
[[intel::reqd_work_group_size(5)]] // expected-note{{conflicting attribute is here}}
86
-
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
90
+
[[intel::num_simd_work_items(4)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
91
+
[[intel::reqd_work_group_size(3, 64)]] // expected-note{{conflicting attribute is here}}
87
92
void
88
93
operator()() const {}
89
94
};
90
95
91
96
structTRIFuncObjBad8 {
92
-
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
93
-
[[intel::reqd_work_group_size(5, 5)]] // expected-note{{conflicting attribute is here}}
97
+
[[intel::reqd_work_group_size(3, 64)]] // expected-note{{conflicting attribute is here}}
98
+
[[intel::num_simd_work_items(4)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
94
99
void
95
100
operator()() const {}
96
101
};
97
102
103
+
// Tests for incorrect argument values for Intel FPGA num_simd_work_items and reqd_work_group_size function attributes
98
104
structTRIFuncObjBad9 {
99
-
[[intel::reqd_work_group_size(5, 5)]] // expected-note{{conflicting attribute is here}}
100
-
[[intel::num_simd_work_items(3)]] // expected-error{{'num_simd_work_items' attribute must evenly divide the work-group size for the 'reqd_work_group_size' attribute}}
101
-
void
102
-
operator()() const {}
105
+
[[intel::reqd_work_group_size(5, 5, 5)]]
106
+
[[intel::num_simd_work_items(0)]] // expected-error{{'num_simd_work_items' attribute requires a positive integral compile time constant expression}}
107
+
voidoperator()() const {}
103
108
};
104
109
105
110
structTRIFuncObjBad10 {
106
-
[[intel::reqd_work_group_size(5, 5, 5)]]
107
111
[[intel::num_simd_work_items(0)]] // expected-error{{'num_simd_work_items' attribute requires a positive integral compile time constant expression}}
108
-
voidoperator()() const {}
112
+
[[intel::reqd_work_group_size(5, 5, 5)]] void
113
+
operator()() const {}
109
114
};
110
115
111
116
structTRIFuncObjBad11 {
@@ -155,28 +160,32 @@ struct TRIFuncObjBad18 {
155
160
[[intel::reqd_work_group_size(-1)]] // expected-warning{{implicit conversion changes signedness: 'int' to 'unsigned long long'}}
156
161
voidoperator()() const {}
157
162
};
158
-
#endif // TRIGGER_ERROR
159
163
164
+
#endif // TRIGGER_ERROR
165
+
// If the declaration has an [[intel::reqd_work_group_size]] or
166
+
// [[cl::reqd_work_group_size]] attribute, tests that check if
167
+
// the work group size attribute argument (the first argument)
168
+
// can be evenly divided by the num_simd_work_items attribute.
0 commit comments