[Mlir-commits] [clang] [flang] [llvm] [mlir] Reland "[NVPTX] Validate user-specified PTX version against SM version" (PR #177459)

Justin Fargnoli llvmlistbot at llvm.org
Mon Jan 26 09:50:23 PST 2026


================
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
-; RUN: llc < %s -mtriple=nvptx64-- -mcpu=sm_30 2>&1 | FileCheck %s
-; RUN: %if ptxas-sm_30 %{ llc < %s -mtriple=nvptx64-- -mcpu=sm_30 | %ptxas-verify -arch=sm_30 %}
+; RUN: llc < %s -mtriple=nvptx64-- -mcpu=sm_30 -mattr=+ptx60 2>&1 | FileCheck %s
+; RUN: %if ptxas-sm_30 && ptxas-isa-6.0 %{ llc < %s -mtriple=nvptx64-- -mcpu=sm_30 -mattr=+ptx60 | %ptxas-verify -arch=sm_30 %}
----------------
justinfargnoli wrote:

> I assume new ptxas would still accept code generated for sm_30 while targeting sm_75.

Yes, this does work: [CE](https://godbolt.org/z/dGqjKzd95)

> In cases like these, we should probably set PTX GPU constraint to match the current default GPU. This applies to all test cases where we constrain ptxas on the old GPU variant.

I agree. e.g. `... | %ptxas-verify -arch=sm_XX`: if `XX` < 75, then we should remove `-arch=sm_XX` and just use the default `%ptxas-verify` confugration. 

Since this will apply to many other tests, I'll track this work separately from this PR. 

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


More information about the Mlir-commits mailing list