File: gpu-atomics-operation.rst

package info (click to toggle)
rocm 6.4.3%2Bds-4~exp2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 17,188 kB
  • sloc: sh: 10,149; python: 1,221; xml: 979; javascript: 168; perl: 46; makefile: 32
file content (791 lines) | stat: -rw-r--r-- 30,706 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
.. meta::
   :description: AMD Instinct accelerator, AMD Radeon PRO, and AMD Radeon GPU
                 atomics operations information
   :keywords: Atomics operations, atomic bitwise functions, atomics add, atomics
              subtraction, atomics exchange, atomics min, atomics max

.. _hw_atomics_operation_support:

Hardware atomics operation support
================================================================================

:ref:`Atomic operations <atomic functions>` guarantee that the operation is
completed as an indivisible unit, preventing race conditions where simultaneous
access to the same memory location could lead to incorrect or undefined
behavior.

This document details the various support of atomic read-modify-write
(atomicRMW) operations on gfx9, gfx10, gfx11, gfx12, MI100, MI200 and MI300 AMD
GPUs. The atomics operation type behavior effected by the memory locations,
memory granularity or scope of operations.

Memory locations:

- :ref:`Device memory <hip:device_memory>`, i.e. VRAM, the RAM on a discrete GPU
  device or in framebuffer carveout for APUs. This includes peer-device memory
  within an Infinity Fabric™ hive.

- :ref:`Host memory <hip:host_memory>`: in DRAM associated with the CPU (or
  peer device memory using PCIe® (PCI Express) peer-to-peer). This can be two sub-types:

  - Migratable memory: memory that is currently residing in host DRAM, but
    which can be migrated back to device memory. For example,
    ``hipMallocManaged()`` or :ref:`unified memory <hip:unified_memory>`
    allocations.

  - :ref:`Pinned memory <hip:pinned_host_memory>`: memory that is in host memory
    and cannot be migrated to the device (not necessarily pinned to a particular
    physical address, but can't be moved to device memory). ``hipHostMalloc()``,
    for example.

Memory granularity or :ref:`coherence <hip:coherence_control>`:

- Coarse-grained memory

  - This memory can be used for device-scope synchronization during the
    execution of a single GPU kernel. Any system-scope atomics sent to this type
    of memory will not achieve system-scope coherency and will instead be
    downgraded to device-scope as per the programming model.

  - This type of memory only available on AMD GPUs.

- Fine-grained memory

  - This memory can be used for device and system-scope synchronization during
    the execution of a single GPU kernel.

Scopes of operations:

- Device-scope or agent-scope

  - This atomic should happen atomically from the point of view of every thread
    within the device that the atomic-executing thread is in.

- System-scope

  - This atomic should happen atomically from the point of view of every thread
    in all devices and in the CPUs.

Support summary
================================================================================

AMD Instinct™ accelerators
--------------------------------------------------------------------------------

**MI300**

- All atomicRMW operations are forwarded out to the Infinity Fabric.
- Infinity Fabric supports common integer and bitwise atomics, FP32 atomic add,
  packed-FP16 atomic add, packed-BF16 atomic add, and FP64 add, min, and max.
- In discrete GPUs (dGPUs), if the data is stored in host memory, the atomic
  will be forwarded from the Infinity Fabric to PCIe.
- If the PCIe bus does not support the requested atomic, the GPU's PCIe
  controller changes it into a load-op-store sequence. All waves on the chip
  submitting atomics to that address will stall waiting for the load-op-store.
  It will seem like atomics to the wave, but the CPU sees it as a non-atomic
  load-op-store sequence. This downgrades system-scope atomics to device-scope.

**MI200**

- L2 cache and Infinity Fabric both support common integer and bitwise atomics.
- L2 cache supports FP32 atomic add, packed-FP16 atomic add, and FP64 add,
  min, and max.
- The Infinity Fabric does not support FP32 atomic add, packed-FP16 atomic add,
  and FP64 add, min, and max atomics and these commands cannot be sent to the
  Infinity Fabric.
- Coarse-grained memory is marked as cacheable, and atomic operations will be
  processed in the L2 cache.
- Fine-grained memory is marked write-uncacheable through the page tables.
- Atomics that hit write-uncached memory are forwarded to the Infinity Fabric.
- If the uncached data is stored in host memory on a PCIe system, the atomic
  will be forwarded from Infinity Fabric to PCIe. Any atomic not supported by
  the PCIe bus will be a NOP and give incorrect result.
- If the uncached data is stored in host memory on an A+A system (system with
  AMD CPU and AMD GPU connected via Infinity Fabric), the atomic operation will
  be forwarded to the remote location and will succeed if supported by Infinity
  Fabric.
- If the float atomics access write-uncached memory, they cannot be forwarded to
  the Infinity Fabric, resulting in a NOP and an incorrect outcome.

**MI100**

- L2 cache and Infinity Fabric both support common integer and bitwise atomics.
- L2 cache supports no returns (NoReturn) versions of packed-FP16 and FP32
  atomic adds, that cannot return data.
- The Infinity Fabric does not support packed-FP16 or FP32 atomic adds,
  preventing these commands from being transmitted through it.
- Coarse-grained memory is marked as cacheable, and atomic operations will be
  processed in the L2 cache.
- Fine-grained memory is marked uncacheable through the page tables.
- Atomics that hit uncached memory are forwarded to the Infinity Fabric.
- If the uncached data is stored in host memory, the atomic will be forwarded
  from Infinity Fabric to PCIe. Any atomic not supported by the PCIe bus will
  be a NOP and give incorrect result.
- If an float atomic add hits uncached memory, it cannot be forwarded to the
  Infinity Fabric so it will NOP and give incorrect result.

AMD gfx generic targets
--------------------------------------------------------------------------------

**gfx9**

- L2 cache and Infinity Fabric both support common integer and bitwise atomics.
- Coarse-grained memory is marked as cacheable, and atomic operations will be
  processed in the L2 cache.
- Fine-grained memory is marked uncacheable through the page tables.
- Atomics that hit uncached memory are forwarded to the Infinity Fabric.
- In a dGPU: if the uncached data is stored in host memory, the atomic will be
  forwarded from Infinity Fabric to PCIe. Any atomic not supported by the PCIe
  bus will be a NOP and.

**gfx10**

- L2 cache and Infinity Fabric both support common integer and bitwise atomics.
- Coarse-grained memory is marked as cacheable, and atomic operations will be
  processed in the L2 cache.
- Fine-grained memory is marked uncacheable through the page tables.
- Atomics that hit uncached memory are forwarded to the Infinity Fabric.
- In a dGPU: if the uncached data is stored in host memory, the atomic will be
  forwarded from Infinity Fabric to PCIe. Any atomic not supported by the PCIe
  bus will be a NOP and give incorrect result.
- Supports floating-point atomic min/max.
- The Infinity Fabric does not support floating-point atomic min/max atomics
  and these commands cannot be sent to the Infinity Fabric.
- If the floating-point atomics hit uncached memory, they cannot be forwarded to
  the Infinity Fabric, so they will NOP and give incorrect result.

**gfx11**

- L2 cache and Infinity Fabric both support common integer and bitwise atomics.
- L2 cache supports FP32 atomic add, min and max.
- The Infinity Fabric does not support FP32 atomic add, min and max atomics and
  these commands cannot be sent to the Infinity Fabric.
- Coarse-grained memory is marked as cacheable, and atomic operations will be
  processed in the L2 cache.
- Fine-grained memory is marked uncacheable through the page tables.
- Atomics that hit write-uncached memory are forwarded to the Infinity Fabric.
- In a dGPU: if the uncached data is stored in host memory, the atomic will be
  forwarded from Infinity Fabric to PCIe. Any atomic not supported by the PCIe
  bus will be a NOP and give incorrect result.
- If the float atomics hit uncached memory, they cannot be forwarded to the
  Infinity Fabric, so they will NOP and give incorrect result.

**gfx12**

- L2 cache and Infinity Fabric both support common integer and bitwise atomics.

- L2 cache and Infinity Fabric both also support FP32 atomic add, min and max,
  and packed-FP16 atomic add, and packed-BF16 atomic add.

- Coarse-grained memory is marked as cacheable, and atomic operations will be
  processed in the L2 cache.

- Fine-grained device memory is marked uncacheable through the page tables.

  - Atomics that hit write-uncached memory are forwarded to the Infinity Fabric.

- Fine-grained system memory is marked as cacheable through the page tables.

  - Device-scope atomic operations will process in the L2 cache.

  - System-scope atomic operations will bypass the L2 cache and be forwarded to
    the Infinity Fabric.

- Atomics that hit write-uncached memory are forwarded to the Infinity Fabric.

- In dGPUs, if the data is stored in host memory, the atomic will be forwarded
  from the Infinity Fabric to PCIe.

- If the PCIe bus does not support the requested atomic, the GPU's PCIe
  controller changes it into a load-op-store sequence. All waves on the chip
  submitting atomics to that address will stall waiting for the load-op-store.
  It will seem like atomics to the wave, but the CPU sees it as a non-atomic
  load-op-store sequence. This downgrades system-scope atomics to device-scope.

GPUs atomics support
================================================================================

This section presents a series of tables that show the level of atomic
operations support for the different hardware devices described above, and
different datatypes, different operations and different scopes.

Hardware atomics support refers to the ability of GPUs to natively perform
atomic operations—special low-level operations that ensure data consistency when
multiple threads access and modify memory concurrently.

CAS (Compare-and-Swap) atomic support refers to the hardware or software
capability to perform an atomic Compare-and-Swap operation.

PCIe atomics are a feature of the PCIe interface that enable
atomic operations between devices and hosts across the PCIe bus. For further
information, please check `How ROCm uses PCIe atomics <https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/conceptual/pcie-atomics.html>`_.

The tables that follow show the correctness of atomics operations on the
hardware using the following notations:

- ✅: Produces the correct answer.

- ⚠️: Produces the correct answer, but works only at a weaker scope.

- ❌: The atomics operation fails.

The tables show the different types of atomic operations used by specific
devices:

- Native: Computes the correct result using a hardware-native atomic
  instruction.

- CAS: Generates the correct result, but the atomic operation is implemented by
  the compiler for this ISA using a compare-and-swap emulation loop.

- ✅ NoReturn: Produces the correct correct result but does not precisely
  conform to the atomic API.

- Scope Downgrade: Generates the correct result but operates at a weaker scope
  than requested. For example, if a user specifies a system-scope atomic, the
  operation may only function at the device scope.

- NOP: The atomic operation is not executed on the target location, and the
  requesting thread receives back 0 as a return value.

- n/a: The atomic type is not supported and cannot be executed on the specific
  hardware.

The tables selectors or options are the following:

- Highest level option:

  - "HW atomics", where software attempts to use hardware atomics.

  - "CAS emulation", where software attempts to use CAS emulation.

- Second-level option:

  - "No PCIe atomics" means the system does not support PCIe atomics between
    the accelerator and peer/host-memory.

  - "PCIe atomics" means the system supports PCIe atomics between the
    accelerator and peer/host-memory.

- The third-level option is the memory granularity of the memory target.

- The final option is the scope of atomic access.

Integer atomics operations
--------------------------------------------------------------------------------

The integer type atomic operations that are supported by different hardware.

- 32 bit integer

  - Add

  - Subtract

  - Min

  - Max

  - IncDec

- 64 bit integer

  - Add

  - Min

  - Max

AMD Instinct accelerators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The integer type atomic operations that are supported by different AMD
Instinct accelerators listed in the following table.

.. <!-- spellcheck-disable -->

.. The relative path not working in datatemplate, that's why we also need the absolute path of docs folder.

.. datatemplate:nodata::

  {% set ns = namespace(offset=2, previous_csv='') %}

  .. tab-set::
    {% for (atomics_type_text, atomics_type_key) in config.html_context['atomics_type'] %}
    .. tab-item:: {{ atomics_type_text }}
      :sync: {{ atomics_type_key }}

      .. tab-set::
        {% for (pcie_type_text, pcie_type_key) in config.html_context['pcie_type'] %}
        .. tab-item:: {{ pcie_type_text }}
          :sync: {{ pcie_type_key }}

          .. tab-set::
            {% for (memory_type_text, memory_type_key) in config.html_context['memory_type'] %}
            .. tab-item:: {{ memory_type_text }}
              :sync: {{ memory_type_key }}

              .. tab-set::
                {% for (granularity_type_text, granularity_type_key) in config.html_context['granularity_type'] %}
                .. tab-item:: {{ granularity_type_text }}
                  :sync: {{ granularity_type_key }}

                  .. tab-set::
                    {% for (scope_type_text, scope_type_key) in config.html_context['scope_type'] %}
                    .. tab-item:: {{ scope_type_text }}
                      :sync: {{ scope_type_key }}

                      {# Build the CSV file path for this branch #}
                      {% set current_csv = "data/reference/gpu-atomics-operation/"
                          ~ atomics_type_key ~ "_" ~ pcie_type_key ~ "_instinct.csv" %}
                      {# If we have a new CSV file, reset the offset #}
                      {% if current_csv != ns.previous_csv %}
                        {% set ns.offset = 2 %}
                      {% endif %}
                      {% set ns.previous_csv = current_csv %}

                      {# Compute the row numbers for this leaf #}
                      {% set start = ns.offset %}
                      {% set end   = ns.offset + 8 %}

                      .. csv-to-list-table::
                        :file: {{ current_csv }}
                        :rows: {{ start }}-{{ end }}

                      {# Update the offset: block (9 rows) plus gap (18 rows) #}
                      {% set ns.offset = ns.offset + 9 + 18 %}

                    {% endfor %}
                  {% endfor %}
              {% endfor %}
          {% endfor %}
      {% endfor %}

.. <!-- spellcheck-enable -->

AMD gfx generic targets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The integer type atomic operations that are supported by different gfx generic
targets listed in the following table.

.. <!-- spellcheck-disable -->

.. The relative path not working in datatemplate, that's why we also need the absolute path of docs folder.

.. datatemplate:nodata::

  {% set ns = namespace(offset=2, previous_csv='') %}

  .. tab-set::
    {% for (atomics_type_text, atomics_type_key) in config.html_context['atomics_type'] %}
    .. tab-item:: {{ atomics_type_text }}
      :sync: {{ atomics_type_key }}

      .. tab-set::
        {% for (pcie_type_text, pcie_type_key) in config.html_context['pcie_type'] %}
        .. tab-item:: {{ pcie_type_text }}
          :sync: {{ pcie_type_key }}

          .. tab-set::
            {% for (memory_type_text, memory_type_key) in config.html_context['memory_type'] %}
            .. tab-item:: {{ memory_type_text }}
              :sync: {{ memory_type_key }}

              .. tab-set::
                {% for (granularity_type_text, granularity_type_key) in config.html_context['granularity_type'] %}
                .. tab-item:: {{ granularity_type_text }}
                  :sync: {{ granularity_type_key }}

                  .. tab-set::
                    {% for (scope_type_text, scope_type_key) in config.html_context['scope_type'] %}
                    .. tab-item:: {{ scope_type_text }}
                      :sync: {{ scope_type_key }}

                      {# Build the CSV file path for this branch #}
                      {% set current_csv = "data/reference/gpu-atomics-operation/"
                          ~ atomics_type_key ~ "_" ~ pcie_type_key ~ "_gfx.csv" %}
                      {# If we switch CSV files, reset the offset to 2 (to skip the header row) #}
                      {% if current_csv != ns.previous_csv %}
                        {% set ns.offset = 2 %}
                      {% endif %}
                      {% set ns.previous_csv = current_csv %}

                      {# Determine the increment based on atomics_type_key #}
                      {% if atomics_type_key == "hw-atomics" %}
                        {% set increment = 20 %}
                      {% elif atomics_type_key == "cas-atomics" %}
                        {% set increment = 18 %}
                      {% endif %}

                      {# Compute start and end rows (end is inclusive) #}
                      {% set start = ns.offset %}
                      {% set end   = ns.offset + 8 %}

                      .. csv-to-list-table::
                        :file: {{ current_csv }}
                        :rows: {{ start }}-{{ end }}

                      {# Update the offset for the next table in this CSV #}
                      {% set ns.offset = ns.offset + 9 + increment %}

                    {% endfor %}
                  {% endfor %}
              {% endfor %}
          {% endfor %}
      {% endfor %}

.. <!-- spellcheck-enable -->

Bitwise atomics operations
--------------------------------------------------------------------------------

The bitwise atomic operations that are supported by different hardware.

- 32 bit bitwise

  - Exchange

  - Compare-and-Swap (CAS)

  - AND

  - OR

  - XOR

- 64 bit bitwise

  - Exchange

  - CAS

  - AND

  - OR

  - XOR


.. note::

  128-bit bitwise Exchange and CAS are not supported on AMD GPUs

AMD Instinct accelerators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The bitwise atomic operations that are supported by different AMD Instinct
accelerators listed in the following table.

.. <!-- spellcheck-disable -->

.. The relative path not working in datatemplate, that's why we also need the absolute path of docs folder.

.. datatemplate:nodata::

  {% set ns = namespace(offset=19, previous_csv='') %}

  .. tab-set::
    {% for (atomics_type_text, atomics_type_key) in config.html_context['atomics_type'] %}
    .. tab-item:: {{ atomics_type_text }}
      :sync: {{ atomics_type_key }}

      .. tab-set::
        {% for (pcie_type_text, pcie_type_key) in config.html_context['pcie_type'] %}
        .. tab-item:: {{ pcie_type_text }}
          :sync: {{ pcie_type_key }}

          .. tab-set::
            {% for (memory_type_text, memory_type_key) in config.html_context['memory_type'] %}
            .. tab-item:: {{ memory_type_text }}
              :sync: {{ memory_type_key }}

              .. tab-set::
                {% for (granularity_type_text, granularity_type_key) in config.html_context['granularity_type'] %}
                .. tab-item:: {{ granularity_type_text }}
                  :sync: {{ granularity_type_key }}

                  .. tab-set::
                    {% for (scope_type_text, scope_type_key) in config.html_context['scope_type'] %}
                    .. tab-item:: {{ scope_type_text }}
                      :sync: {{ scope_type_key }}

                      {# Build the CSV file path for this branch #}
                      {% set current_csv = "data/reference/gpu-atomics-operation/"
                          ~ atomics_type_key ~ "_" ~ pcie_type_key ~ "_instinct.csv" %}
                      {# If we have a new CSV file, reset the offset #}
                      {% if current_csv != ns.previous_csv %}
                        {% set ns.offset = 19 %}
                      {% endif %}
                      {% set ns.previous_csv = current_csv %}

                      {# Compute the row numbers for this leaf #}
                      {% set start = ns.offset %}
                      {% set end   = ns.offset + 9 %}

                      .. csv-to-list-table::
                        :file: {{ current_csv }}
                        :rows: {{ start }}-{{ end }}

                      {# Update the offset: block (10 rows) plus gap (17 rows) #}
                      {% set ns.offset = ns.offset + 10 + 17 %}

                    {% endfor %}
                  {% endfor %}
              {% endfor %}
          {% endfor %}
      {% endfor %}

.. <!-- spellcheck-enable -->

AMD gfx generic targets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The bitwise atomic operations that are supported by different AMD gfx generic
targets listed in the following table.

.. <!-- spellcheck-disable -->

.. The relative path not working in datatemplate, that's why we also need the absolute path of docs folder.

.. datatemplate:nodata::

  {% set ns = namespace(offset=19, previous_csv='') %}

  .. tab-set::
    {% for (atomics_type_text, atomics_type_key) in config.html_context['atomics_type'] %}
    .. tab-item:: {{ atomics_type_text }}
      :sync: {{ atomics_type_key }}

      .. tab-set::
        {% for (pcie_type_text, pcie_type_key) in config.html_context['pcie_type'] %}
        .. tab-item:: {{ pcie_type_text }}
          :sync: {{ pcie_type_key }}

          .. tab-set::
            {% for (memory_type_text, memory_type_key) in config.html_context['memory_type'] %}
            .. tab-item:: {{ memory_type_text }}
              :sync: {{ memory_type_key }}

              .. tab-set::
                {% for (granularity_type_text, granularity_type_key) in config.html_context['granularity_type'] %}
                .. tab-item:: {{ granularity_type_text }}
                  :sync: {{ granularity_type_key }}

                  .. tab-set::
                    {% for (scope_type_text, scope_type_key) in config.html_context['scope_type'] %}
                    .. tab-item:: {{ scope_type_text }}
                      :sync: {{ scope_type_key }}

                      {# Build the CSV file path for this branch #}
                      {% set current_csv = "data/reference/gpu-atomics-operation/"
                          ~ atomics_type_key ~ "_" ~ pcie_type_key ~ "_gfx.csv" %}
                      {# If we switch CSV files, reset the offset to 2 (to skip the header row) #}
                      {% if current_csv != ns.previous_csv %}
                        {% set ns.offset = 19 %}
                      {% endif %}
                      {% set ns.previous_csv = current_csv %}

                      {# Determine the increment based on atomics_type_key #}
                      {% if atomics_type_key == "hw-atomics" %}
                        {% set increment = 19 %}
                      {% elif atomics_type_key == "cas-atomics" %}
                        {% set increment = 17 %}
                      {% endif %}

                      {# Compute start and end rows (end is inclusive) #}
                      {% set start = ns.offset %}
                      {% set end   = ns.offset + 9 %}

                      .. csv-to-list-table::
                        :file: {{ current_csv }}
                        :rows: {{ start }}-{{ end }}

                      {# Update the offset for the next table in this CSV #}
                      {% set ns.offset = ns.offset + 10 + increment %}

                    {% endfor %}
                  {% endfor %}
              {% endfor %}
          {% endfor %}
      {% endfor %}

.. <!-- spellcheck-enable -->

Float atomics operations
--------------------------------------------------------------------------------

The float types atomic operations that are supported by different hardware.

- 32-bit IEEE 754 floating point ('single precision', FP32)

  - Add

  - Min

  - Max

- 64-bit IEEE 754 floating point ('double precision', FP64)

  - Add

  - Min

  - Max

- 16-bit IEEE 754 floating point ('half precision", FP16)

  - Add

- 2xPacked 16-bit IEEE 754 floating point ('half precision', FP16)

  - Add

- BrainFloat-16 floating point (BF16)

  - Add

- 2xPacked BrainFloat-16 floating point (BF16)

  - Add

AMD Instinct accelerators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The float type atomic operations that are supported by different AMD Instinct
accelerators listed in the following table.

.. <!-- spellcheck-disable -->

.. The relative path not working in datatemplate, that's why we also need the absolute path of docs folder.

.. datatemplate:nodata::

  {% set ns = namespace(offset=11, previous_csv='') %}

  .. tab-set::
    {% for (atomics_type_text, atomics_type_key) in config.html_context['atomics_type'] %}
    .. tab-item:: {{ atomics_type_text }}
      :sync: {{ atomics_type_key }}

      .. tab-set::
        {% for (pcie_type_text, pcie_type_key) in config.html_context['pcie_type'] %}
        .. tab-item:: {{ pcie_type_text }}
          :sync: {{ pcie_type_key }}

          .. tab-set::
            {% for (memory_type_text, memory_type_key) in config.html_context['memory_type'] %}
            .. tab-item:: {{ memory_type_text }}
              :sync: {{ memory_type_key }}

              .. tab-set::
                {% for (granularity_type_text, granularity_type_key) in config.html_context['granularity_type'] %}
                .. tab-item:: {{ granularity_type_text }}
                  :sync: {{ granularity_type_key }}

                  .. tab-set::
                    {% for (scope_type_text, scope_type_key) in config.html_context['scope_type'] %}
                    .. tab-item:: {{ scope_type_text }}
                      :sync: {{ scope_type_key }}

                      {# Build the CSV file path for this branch #}
                      {% set current_csv = "data/reference/gpu-atomics-operation/"
                          ~ atomics_type_key ~ "_" ~ pcie_type_key ~ "_instinct.csv" %}
                      {# If we have a new CSV file, reset the offset #}
                      {% if current_csv != ns.previous_csv %}
                        {% set ns.offset = 11 %}
                      {% endif %}
                      {% set ns.previous_csv = current_csv %}

                      {# Compute the row numbers for this leaf #}
                      {% set start = ns.offset %}
                      {% set end   = ns.offset + 7 %}

                      .. csv-to-list-table::
                        :file: {{ current_csv }}
                        :rows: {{ start }}-{{ end }}

                      {# Update the offset: block (8 rows) plus gap (19 rows) #}
                      {% set ns.offset = ns.offset + 8 + 19 %}

                    {% endfor %}
                  {% endfor %}
              {% endfor %}
          {% endfor %}
      {% endfor %}

.. <!-- spellcheck-enable -->

AMD gfx generic targets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The float types atomic operations that are supported by different AMD gfx
generic targets listed in the following table.

.. <!-- spellcheck-disable -->

.. The relative path not working in datatemplate, that's why we also need the absolute path of docs folder.

.. datatemplate:nodata::

  {% set ns = namespace(offset=11, previous_csv='') %}

  .. tab-set::
    {% for (atomics_type_text, atomics_type_key) in config.html_context['atomics_type'] %}
    .. tab-item:: {{ atomics_type_text }}
      :sync: {{ atomics_type_key }}

      .. tab-set::
        {% for (pcie_type_text, pcie_type_key) in config.html_context['pcie_type'] %}
        .. tab-item:: {{ pcie_type_text }}
          :sync: {{ pcie_type_key }}

          .. tab-set::
            {% for (memory_type_text, memory_type_key) in config.html_context['memory_type'] %}
            .. tab-item:: {{ memory_type_text }}
              :sync: {{ memory_type_key }}

              .. tab-set::
                {% for (granularity_type_text, granularity_type_key) in config.html_context['granularity_type'] %}
                .. tab-item:: {{ granularity_type_text }}
                  :sync: {{ granularity_type_key }}

                  .. tab-set::
                    {% for (scope_type_text, scope_type_key) in config.html_context['scope_type'] %}
                    .. tab-item:: {{ scope_type_text }}
                      :sync: {{ scope_type_key }}

                      {# Build the CSV file path for this branch #}
                      {% set current_csv = "data/reference/gpu-atomics-operation/"
                          ~ atomics_type_key ~ "_" ~ pcie_type_key ~ "_gfx.csv" %}
                      {# If we switch CSV files, reset the offset to 2 (to skip the header row) #}
                      {% if current_csv != ns.previous_csv %}
                        {% set ns.offset = 11 %}
                      {% endif %}
                      {% set ns.previous_csv = current_csv %}

                      {# Determine the increment based on atomics_type_key #}
                      {% if atomics_type_key == "hw-atomics" %}
                        {% set increment = 21 %}
                      {% elif atomics_type_key == "cas-atomics" %}
                        {% set increment = 19 %}
                      {% endif %}

                      {# Compute start and end rows (end is inclusive) #}
                      {% set start = ns.offset %}
                      {% set end   = ns.offset + 7 %}

                      .. csv-to-list-table::
                        :file: {{ current_csv }}
                        :rows: {{ start }}-{{ end }}

                      {# Update the offset for the next table in this CSV #}
                      {% set ns.offset = ns.offset + 8 + increment %}

                    {% endfor %}
                  {% endfor %}
              {% endfor %}
          {% endfor %}
      {% endfor %}

.. <!-- spellcheck-enable -->