[llvm] [NVPTX] Support for fence.acquire and fence.release (PR #124865)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 16:51:12 PST 2025


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 617278e7b0c937fccbf7d67d14f053c3409bc33f...6eea017741b5e2a88954e6c3ee18c8144c3e74a4 llvm/test/CodeGen/NVPTX/fence.py
``````````

</details>

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

``````````diff
--- fence.py	2025-01-29 00:41:45.000000 +0000
+++ fence.py	2025-01-29 00:49:16.185400 +0000
@@ -3,20 +3,20 @@
 
 from string import Template
 from itertools import product
 
 fence_func = Template(
-"""
+    """
 define void @fence_${ordering}_${scope}() {
     fence syncscope(\"${scope}\") ${ordering}
     ret void
 }
 """
 )
 
 run_statement = Template(
-"""
+    """
 ; ${run}: llc < %s -march=nvptx64 -mcpu=sm_${sm} -mattr=+ptx${ptx} | FileCheck %s --check-prefix=SM${sm}
 ; ${run}: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_${sm} -mattr=+ptx${ptx} | %ptxas-verfy %}
 """
 )
 
@@ -27,12 +27,19 @@
 
 ORDERINGS = ["acquire", "release", "acq_rel", "seq_cst"]
 
 if __name__ == "__main__":
     for sm, ptx in TESTS:
-        with open ("fence-sm{}.ll".format(sm), "w") as fp:
-            print(run_statement.substitute(run = "RUN", sm = sm, ptx = ptx), file = fp)
+        with open("fence-sm{}.ll".format(sm), "w") as fp:
+            print(run_statement.substitute(run="RUN", sm=sm, ptx=ptx), file=fp)
             for ordering, scope in product(ORDERINGS, SCOPES):
                 if scope == "cluster" and (sm < 90 or ptx < 78):
-                    print("; .cluster scope unsupported on SM = {} PTX = {}".format(sm, ptx), file = fp)
+                    print(
+                        "; .cluster scope unsupported on SM = {} PTX = {}".format(
+                            sm, ptx
+                        ),
+                        file=fp,
+                    )
                 else:
-                    print(fence_func.substitute(scope = scope, ordering = ordering), file = fp)
+                    print(
+                        fence_func.substitute(scope=scope, ordering=ordering), file=fp
+                    )

``````````

</details>


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


More information about the llvm-commits mailing list