[llvm] [NVPTX] Cleanup support for atomic loads/stores (PR #201468)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 15:49:24 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD llvm/test/CodeGen/NVPTX/load.py llvm/test/CodeGen/NVPTX/store.py llvm/test/lit.cfg.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- CodeGen/NVPTX/load.py	2026-06-03 22:46:11.000000 +0000
+++ CodeGen/NVPTX/load.py	2026-06-03 22:48:56.140003 +0000
@@ -46,15 +46,29 @@
 
 SCOPE_LLVM_TO_PTX = {"": "sys", "block": "cta", "cluster": "cluster", "device": "gpu"}
 
 ORDERINGS = ["notatomic", "unordered", "monotonic", "acquire", "seq_cst"]
 
-ADDRSPACE_NUM_TO_ADDRSPACE = {0: "generic", 1: "global", 3: "shared", 4: "const", 5: "local", 101: "param"}
+ADDRSPACE_NUM_TO_ADDRSPACE = {
+    0: "generic",
+    1: "global",
+    3: "shared",
+    4: "const",
+    5: "local",
+    101: "param",
+}
 
 DATATYPE_SIZE_BITS = {
-    "i8": 8, "i16": 16, "i32": 32, "i64": 64, "i128": 128,
-    "half": 16, "bfloat": 16, "float": 32, "double": 64,
+    "i8": 8,
+    "i16": 16,
+    "i32": 32,
+    "i64": 64,
+    "i128": 128,
+    "half": 16,
+    "bfloat": 16,
+    "float": 32,
+    "double": 64,
 }
 DATATYPES = list(DATATYPE_SIZE_BITS.keys())
 
 VOLATILES = [False, True]
 
@@ -176,11 +190,14 @@
             # spaces have no observable atomic semantic). i128 only at sm_90
             # -- atom.b128 requires sm_90+/PTX 8.3+, and plain ld.b128 requires
             # sm_70+/PTX 8.3+; neither holds at sm_60/70 with our test matrix.
             # For notatomic, syncscope is illegal -- emit only at scope="".
             for ordering, addrspace, datatype, volatile, scope in product(
-                ORDERINGS, ADDRSPACE_NUM_TO_ADDRSPACE, DATATYPES, VOLATILES,
+                ORDERINGS,
+                ADDRSPACE_NUM_TO_ADDRSPACE,
+                DATATYPES,
+                VOLATILES,
                 SCOPE_LLVM_TO_PTX,
             ):
                 if datatype == "i128" and sm < 90:
                     continue
                 is_atomic = ordering != "notatomic"
--- CodeGen/NVPTX/store.py	2026-06-03 22:46:11.000000 +0000
+++ CodeGen/NVPTX/store.py	2026-06-03 22:48:56.180446 +0000
@@ -58,15 +58,29 @@
 
 SCOPE_LLVM_TO_PTX = {"": "sys", "block": "cta", "cluster": "cluster", "device": "gpu"}
 
 ORDERINGS = ["notatomic", "unordered", "monotonic", "release", "seq_cst"]
 
-ADDRSPACE_NUM_TO_ADDRSPACE = {0: "generic", 1: "global", 3: "shared", 4: "const", 5: "local", 101: "param"}
+ADDRSPACE_NUM_TO_ADDRSPACE = {
+    0: "generic",
+    1: "global",
+    3: "shared",
+    4: "const",
+    5: "local",
+    101: "param",
+}
 
 DATATYPE_SIZE_BITS = {
-    "i8": 8, "i16": 16, "i32": 32, "i64": 64, "i128": 128,
-    "half": 16, "bfloat": 16, "float": 32, "double": 64,
+    "i8": 8,
+    "i16": 16,
+    "i32": 32,
+    "i64": 64,
+    "i128": 128,
+    "half": 16,
+    "bfloat": 16,
+    "float": 32,
+    "double": 64,
 }
 DATATYPES = list(DATATYPE_SIZE_BITS.keys())
 
 VOLATILES = [False, True]
 
@@ -188,11 +202,14 @@
             # spaces). i128 only at sm_90 -- atom.b128 requires sm_90+/PTX
             # 8.3+, and plain st.b128 requires sm_70+/PTX 8.3+; neither holds
             # at sm_60/70 with our test matrix.
             # For notatomic, syncscope is illegal -- emit only at scope="".
             for ordering, addrspace, datatype, volatile, scope in product(
-                ORDERINGS, ADDRSPACE_NUM_TO_ADDRSPACE, DATATYPES, VOLATILES,
+                ORDERINGS,
+                ADDRSPACE_NUM_TO_ADDRSPACE,
+                DATATYPES,
+                VOLATILES,
                 SCOPE_LLVM_TO_PTX,
             ):
                 if datatype == "i128" and sm < 90:
                     continue
                 if addrspace in (4, 101):

``````````

</details>


https://github.com/llvm/llvm-project/pull/201468


More information about the llvm-commits mailing list