https://github.com/IllogicalMoose created https://github.com/llvm/llvm-project/pull/220019
Add sm_107 to the list of architectures instantiated for NVPTX builtins in BuiltinsNVPTX.td. Also add a test invocation with -target-cpu sm_107a to builtins-nvptx.c. >From 921484b83a32fb0b954566ec5454d75407108da1 Mon Sep 17 00:00:00 2001 From: Joshua Lang <[email protected]> Date: Mon, 31 Aug 2026 06:10:33 +0000 Subject: [PATCH] [Clang][NVPTX] Add sm_107 to SM_Instantiate for NVPTX builtins Add sm_107 to the list of architectures instantiated for NVPTX builtins in BuiltinsNVPTX.td. Without this, compiling device code targeting sm_107 or sm_107a fails with an error requiring target features sm_60|...|sm_103|sm_110 when calling general SM builtins (such as atomic operations). Also add a test invocation with -target-cpu sm_107a to builtins-nvptx.c. --- clang/include/clang/Basic/BuiltinsNVPTX.td | 2 +- clang/test/CodeGen/builtins-nvptx.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.td b/clang/include/clang/Basic/BuiltinsNVPTX.td index bcfe1f9bf8572..b91b356b3d295 100644 --- a/clang/include/clang/Basic/BuiltinsNVPTX.td +++ b/clang/include/clang/Basic/BuiltinsNVPTX.td @@ -80,7 +80,7 @@ multiclass SM_Instantiate<list<int> gpu_list> { } } -defm SM : SM_Instantiate<[121, 120, 110, 103, 101, 100, 90, 89, 88, 87, 86, 80, 75, 72, 70, 62, 61, 60, 53]>; +defm SM : SM_Instantiate<[121, 120, 110, 107, 103, 101, 100, 90, 89, 88, 87, 86, 80, 75, 72, 70, 62, 61, 60, 53]>; class PTXFeatures { string Features; diff --git a/clang/test/CodeGen/builtins-nvptx.c b/clang/test/CodeGen/builtins-nvptx.c index 0eb9eadb251d6..044994116fe81 100644 --- a/clang/test/CodeGen/builtins-nvptx.c +++ b/clang/test/CodeGen/builtins-nvptx.c @@ -52,6 +52,9 @@ // RUN: %clang_cc1 -ffp-contract=off -triple nvptx64-unknown-unknown -target-cpu sm_103a -target-feature +ptx88 -DPTX=88 \ // RUN: -disable-llvm-optzns -fcuda-is-device -emit-llvm -o - -x cuda %s \ // RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK_PTX87_SM103a %s +// RUN: %clang_cc1 -ffp-contract=off -triple nvptx64-unknown-unknown -target-cpu sm_107a -target-feature +ptx88 -DPTX=88 \ +// RUN: -disable-llvm-optzns -fcuda-is-device -emit-llvm -o - -x cuda %s \ +// RUN: | FileCheck -check-prefix=CHECK %s // RUN: %clang_cc1 -ffp-contract=off -triple nvptx64-unknown-unknown -target-cpu sm_100a -target-feature +ptx87 -DPTX=87 \ // RUN: -disable-llvm-optzns -fcuda-is-device -emit-llvm -o - -x cuda %s \ // RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK_PTX87_SM100a %s _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
