[llvm] 5585d99 - [NVPTX] Fix issues in ptxas integration to LIT tests

Andrew Savonichev via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 14:30:48 PDT 2022


Author: Andrew Savonichev
Date: 2022-10-04T00:29:42+03:00
New Revision: 5585d99835e83cca79ead9f0d90fcfab927391d5

URL: https://github.com/llvm/llvm-project/commit/5585d99835e83cca79ead9f0d90fcfab927391d5
DIFF: https://github.com/llvm/llvm-project/commit/5585d99835e83cca79ead9f0d90fcfab927391d5.diff

LOG: [NVPTX] Fix issues in ptxas integration to LIT tests

1) Fixed a typo in PTXAS_EXECUTABLE CMake variable (PXTAS -> PTXAS).

2) Version check was implemented incorrectly,
   now version (major, minor) is converted to int for comparison.

3) ptxas -arch argument was incorrect (or missing) in 3 tests.

Differential Revision: https://reviews.llvm.org/D127866

Added: 
    

Modified: 
    llvm/test/CodeGen/NVPTX/atomicrmw-expand.ll
    llvm/test/CodeGen/NVPTX/bug52623.ll
    llvm/test/CodeGen/NVPTX/ldu-ldg.ll
    llvm/test/lit.cfg.py
    llvm/test/lit.site.cfg.py.in

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/NVPTX/atomicrmw-expand.ll b/llvm/test/CodeGen/NVPTX/atomicrmw-expand.ll
index a2512dfbf5811..5f57b3bbd0120 100644
--- a/llvm/test/CodeGen/NVPTX/atomicrmw-expand.ll
+++ b/llvm/test/CodeGen/NVPTX/atomicrmw-expand.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 | FileCheck %s --check-prefixes=ALL,SM30
 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_60 | FileCheck %s --check-prefixes=ALL,SM60
-; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_30 | %ptxas-verify %}
-; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_60 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_30 | %ptxas-verify %if !ptxas-11.0 %{-arch=sm_30%} %}
+; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_60 | %ptxas-verify -arch=sm_60 %}
 
 ; CHECK-LABEL: fadd_double
 define void @fadd_double(ptr %0, double %1) {

diff  --git a/llvm/test/CodeGen/NVPTX/bug52623.ll b/llvm/test/CodeGen/NVPTX/bug52623.ll
index ea004bdf2300d..eb352d7d5fb52 100644
--- a/llvm/test/CodeGen/NVPTX/bug52623.ll
+++ b/llvm/test/CodeGen/NVPTX/bug52623.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -march=nvptx -mcpu=sm_75 -verify-machineinstrs
-; RUN: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_75 | %ptxas-verify %}
+; RUN: llc < %s -march=nvptx -verify-machineinstrs
+; RUN: %if ptxas %{ llc < %s -march=nvptx | %ptxas-verify %}
 
 ; Check that llc will not crash even when first MBB doesn't contain
 ; any instruction.

diff  --git a/llvm/test/CodeGen/NVPTX/ldu-ldg.ll b/llvm/test/CodeGen/NVPTX/ldu-ldg.ll
index ab7767cfcc09b..2cdbd3dd32a4a 100644
--- a/llvm/test/CodeGen/NVPTX/ldu-ldg.ll
+++ b/llvm/test/CodeGen/NVPTX/ldu-ldg.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
-; RUN: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_20 | %ptxas-verify %}
+; RUN: llc < %s -march=nvptx -mcpu=sm_32 | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_32 | %ptxas-verify %if !ptxas-11.0 %{-arch=sm_32%} %}
 
 
 declare i8 @llvm.nvvm.ldu.global.i.i8.p1i8(i8 addrspace(1)* %ptr, i32 %align)

diff  --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 1da6274de0963..e80a659e886f5 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -216,19 +216,23 @@ def enable_ptxas(ptxas_executable):
             (11, 0), (11, 1), (11, 2), (11, 3), (11, 4), (11, 5), (11, 6),
         ]
 
+        def version_int(ver):
+            return ver[0] * 100 + ver[1]
+
         # ignore ptxas if its version is below the minimum supported
         # version
         min_version = ptxas_known_versions[0]
-        if version[0] < min_version[0] or version[1] < min_version[1]:
+        if version_int(version) < version_int(min_version):
             print(
                 'Warning: ptxas version {}.{} is not supported'.format(
                     version[0], version[1]))
             return
 
-        for known_major, known_minor in ptxas_known_versions:
-            if known_major <= version[0] and known_minor <= version[1]:
+        for known_version in ptxas_known_versions:
+            if version_int(known_version) <= version_int(version):
+                major, minor = known_version
                 config.available_features.add(
-                    'ptxas-{}.{}'.format(known_major, known_minor))
+                    'ptxas-{}.{}'.format(major, minor))
 
     config.available_features.add('ptxas')
     tools.extend([ToolSubst('%ptxas', ptxas_executable),

diff  --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in
index 09210e2e56d4c..c9ff7c007200d 100644
--- a/llvm/test/lit.site.cfg.py.in
+++ b/llvm/test/lit.site.cfg.py.in
@@ -23,7 +23,7 @@ config.have_ocamlopt = @HAVE_OCAMLOPT@
 config.ocaml_flags = "@OCAMLFLAGS@"
 config.include_go_tests = @LLVM_INCLUDE_GO_TESTS@
 config.go_executable = "@GO_EXECUTABLE@"
-config.ptxas_executable = "@PXTAS_EXECUTABLE@"
+config.ptxas_executable = "@PTXAS_EXECUTABLE@"
 config.enable_shared = @ENABLE_SHARED@
 config.enable_assertions = @ENABLE_ASSERTIONS@
 config.targets_to_build = "@TARGETS_TO_BUILD@"


        


More information about the llvm-commits mailing list