Commit 5b40088
committed
[SYCL][ESIMD] Replace mask_type_t with simd_mask to represent Gen predicates.
Addresses the following review comment from simd.hpp:
// TODO @rolandschulz, @mattkretz
// Introduce simd_mask type and let user use this type instead of specific
// type representation (simd<uint16_t, N>) to make it more portable
// TODO @iburyl should be mask_type_t, which might become more abstracted in
// the future revisions.
//
Gen predicates (masks) used to be represented with simd<unsigned short, N> types
which made them indistinguishable from simd objects forcing the same same sets
of available APIs, even though it did not always make sense. This patch
introduces a new class simd_mask, which provides its own set of APIs, some of
which are unique, other - repeat those from the simd class.
A new class 'simd_obj_impl' is added, which encompasses functionality common
between simd and simd_mask objects. Particularly, view creation APIs (select,
bit_cast_view), object construction APIs - replicate, memory I/O (copy from/to)
and others. simd and simd_mask both extend the simd_obj_impl class. They use the
'curiously recurring template' design pattern, when simd_obj_impl is templated
by its derivative class (simd or simd_mask), to allow simd_obj_impl APIs return
subclass objects rather than simd_obj_impl instances, those avoiding API
duplication in subclasses. For example, 'select' functions defined in
simd_obj_impl, will return a view of the derived class (subclass) rather than
a view of simd_obj_impl: simd_view<Derived,...>, where Derived is the derived
class.
APIs unique to simd_mask:
- unary logical negation '!' operator
- implicit conversion to bool for single-element masks
- logical binary operators '||' and '&&'
APIs unique to simd:
- binary arithmetic operators ('+', '-', '*', '/') and corresponding compound
assignments
- unary arithmetic operators ('+', '-', '++', '--')
- relational operators ('<', '<=', '>', '>=')
The same division of the APIs to unique sets applies to simd_view<simd<...>,...>
and simd_view<simd_mask<...>,...> simd_view class specializations.1 parent 95104c0 commit 5b40088
File tree
24 files changed
+2617
-1169
lines changed- llvm/lib/SYCLLowerIR
- sycl
- include/sycl/ext/intel/experimental/esimd
- detail
- test/esimd
- regression
24 files changed
+2617
-1169
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1350 | 1350 | | |
1351 | 1351 | | |
1352 | 1352 | | |
1353 | | - | |
1354 | | - | |
| 1353 | + | |
| 1354 | + | |
1355 | 1355 | | |
1356 | 1356 | | |
1357 | 1357 | | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
1358 | 1365 | | |
1359 | 1366 | | |
1360 | 1367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
118 | 123 | | |
119 | | - | |
120 | | - | |
| 124 | + | |
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| |||
Lines changed: 4 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
128 | | - | |
| 125 | + | |
129 | 126 | | |
130 | 127 | | |
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
135 | | - | |
| 132 | + | |
136 | 133 | | |
137 | 134 | | |
138 | 135 | | |
| |||
286 | 283 | | |
287 | 284 | | |
288 | 285 | | |
289 | | - | |
| 286 | + | |
290 | 287 | | |
291 | 288 | | |
292 | 289 | | |
| |||
310 | 307 | | |
311 | 308 | | |
312 | 309 | | |
313 | | - | |
| 310 | + | |
314 | 311 | | |
315 | 312 | | |
316 | 313 | | |
| |||
324 | 321 | | |
325 | 322 | | |
326 | 323 | | |
327 | | - | |
328 | | - | |
329 | | - | |
Lines changed: 1 addition & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
385 | 384 | | |
386 | 385 | | |
387 | 386 | | |
388 | | - | |
389 | | - | |
390 | 387 | | |
391 | 388 | | |
392 | 389 | | |
| |||
1327 | 1324 | | |
1328 | 1325 | | |
1329 | 1326 | | |
1330 | | - | |
1331 | | - | |
1332 | 1327 | | |
1333 | | - | |
1334 | | - | |
0 commit comments