[llvm] [NVPTX] Add ptxas verification and kernel test to sm-version test (PR #139543)
Puja Saha via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 07:16:50 PDT 2025
https://github.com/puja2196 updated https://github.com/llvm/llvm-project/pull/139543
>From ab32a656b9658de70d9fdb8304bbc59e1b85d48e Mon Sep 17 00:00:00 2001
From: Puja Saha <saha.puja21.ps at gmail.com>
Date: Mon, 12 May 2025 18:16:17 +0530
Subject: [PATCH 1/2] [NVPTX] Add ptxas verification and kernel test to
sm-version test
---
llvm/test/CodeGen/NVPTX/sm-version.ll | 71 +++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/llvm/test/CodeGen/NVPTX/sm-version.ll b/llvm/test/CodeGen/NVPTX/sm-version.ll
index 9705a2f3ba730..1b820b2d9f7b8 100644
--- a/llvm/test/CodeGen/NVPTX/sm-version.ll
+++ b/llvm/test/CodeGen/NVPTX/sm-version.ll
@@ -56,6 +56,65 @@
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_121 | FileCheck %s --check-prefix=SM121
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_121a | FileCheck %s --check-prefix=SM121a
+; Also check if ptxas is available for the various SM versions
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_20 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_21 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_30 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_32 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_35 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_37 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_50 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_52 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_53 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_60 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_61 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_62 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_70 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_75 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_80 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_86 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_90 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_90a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_100 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_100a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_101 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_101a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_103 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_103a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_120 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_120a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_121 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_121a | %ptxas-verify %}
+
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_20 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_21 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_30 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_32 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_35 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_37 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_50 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_52 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_53 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_60 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_61 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_62 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_70 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_75 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_80 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_86 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_90 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_90a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_100 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_100a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_101 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_101a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_103 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_103a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_120 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_120a | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_121 | %ptxas-verify %}
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_121a | %ptxas-verify %}
+
; SM20: .version 3.2
; SM21: .version 3.2
; SM30: .version 6.0
@@ -113,3 +172,15 @@
; SM120a: .target sm_120a
; SM121: .target sm_121
; SM121a: .target sm_121a
+
+; Simple kernel function that does a basic operation that should work on all SM versions
+define void @test_kernel(ptr %out, i32 %val) {
+ store i32 %val, ptr %out, align 4
+ ret void
+}
+
+; Add a ptx_kernel for good measure
+define ptx_kernel void @test_ptx_kernel(ptr %out, i32 %val) {
+ store i32 %val, ptr %out, align 4
+ ret void
+}
>From 3592bcc2c1f0d09eaa86681aa456c4dec90182b3 Mon Sep 17 00:00:00 2001
From: Puja Saha <saha.puja21.ps at gmail.com>
Date: Mon, 12 May 2025 19:45:47 +0530
Subject: [PATCH 2/2] Address review comments: Remove unnecessary comment and
test kernel functions
---
llvm/test/CodeGen/NVPTX/sm-version.ll | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/llvm/test/CodeGen/NVPTX/sm-version.ll b/llvm/test/CodeGen/NVPTX/sm-version.ll
index 1b820b2d9f7b8..de6faf38e3b01 100644
--- a/llvm/test/CodeGen/NVPTX/sm-version.ll
+++ b/llvm/test/CodeGen/NVPTX/sm-version.ll
@@ -56,7 +56,6 @@
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_121 | FileCheck %s --check-prefix=SM121
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_121a | FileCheck %s --check-prefix=SM121a
-; Also check if ptxas is available for the various SM versions
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_20 | %ptxas-verify %}
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_21 | %ptxas-verify %}
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx -mcpu=sm_30 | %ptxas-verify %}
@@ -172,15 +171,3 @@
; SM120a: .target sm_120a
; SM121: .target sm_121
; SM121a: .target sm_121a
-
-; Simple kernel function that does a basic operation that should work on all SM versions
-define void @test_kernel(ptr %out, i32 %val) {
- store i32 %val, ptr %out, align 4
- ret void
-}
-
-; Add a ptx_kernel for good measure
-define ptx_kernel void @test_ptx_kernel(ptr %out, i32 %val) {
- store i32 %val, ptr %out, align 4
- ret void
-}
More information about the llvm-commits
mailing list