Commit 37a9a2a
Artem Gindinson
[SYCL] Specialize atomic fetch_add for floating point types (#2765)
The new EXT/SPV_EXT_shader_atomic_float_add SPIR-V extension
allows us to further specialize atomic::fetch_add() for
floating point types. In device mode, we'll now be creating
an external call to a built-in-like __spirv_AtomicFAddEXT().
This is similar to what is done for other atomic binary
instructions, e.g. the integer specialization of fetch_add()
being mapped onto __spirv_AtomicIAdd().
Furthermore, atomic::fetch_sub() is also re-implemented
to use __spirv_AtomicFAddEXT(), the added operand being
a negation of the original one.
The new implementation can be exposed if a dedicated macro is
defined: SYCL_USE_NATIVE_FP_ATOMICS. Otherwise, a fallback
is used, where the atomic operation is done via spinlock emulation.
At the moment of committing this, only Intel GPUs support the
"native" implementation, which relies on a SPIR-V extension.
Tests for the feature have been finalized in
intel/llvm-test-suite#104.
Signed-off-by: Artem Gindinson artem.gindinson@intel.com1 parent a4d4cfb commit 37a9a2a
File tree
5 files changed
+82
-27
lines changed- sycl
- include/CL
- __spirv
- sycl
- ONEAPI
- detail
- test/atomic_ref
5 files changed
+82
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| |||
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
456 | 461 | | |
457 | 462 | | |
458 | 463 | | |
| |||
462 | 467 | | |
463 | 468 | | |
464 | 469 | | |
| 470 | + | |
465 | 471 | | |
466 | 472 | | |
467 | 473 | | |
| |||
470 | 476 | | |
471 | 477 | | |
472 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
473 | 484 | | |
474 | 485 | | |
475 | 486 | | |
476 | 487 | | |
477 | 488 | | |
478 | 489 | | |
479 | 490 | | |
| 491 | + | |
480 | 492 | | |
481 | 493 | | |
482 | 494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
388 | 398 | | |
389 | 399 | | |
390 | 400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | | - | |
| 7 | + | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
| |||
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
176 | 182 | | |
177 | 183 | | |
178 | 184 | | |
179 | 185 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
186 | 193 | | |
187 | 194 | | |
188 | 195 | | |
| |||
219 | 226 | | |
220 | 227 | | |
221 | 228 | | |
222 | | - | |
| 229 | + | |
223 | 230 | | |
224 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
225 | 238 | | |
226 | 239 | | |
227 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
1 | 8 | | |
2 | 9 | | |
3 | 10 | | |
| |||
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
174 | 182 | | |
175 | 183 | | |
176 | 184 | | |
177 | 185 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
184 | 193 | | |
185 | 194 | | |
186 | 195 | | |
| |||
217 | 226 | | |
218 | 227 | | |
219 | 228 | | |
220 | | - | |
| 229 | + | |
221 | 230 | | |
222 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
223 | 238 | | |
224 | 239 | | |
225 | 240 | | |
| |||
0 commit comments