[clang] [llvm] [CUDA] Add a pseudo GPU sm_next which allows overriding for SM/PTX version. (PR #100247)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 11:58:32 PDT 2024


================
@@ -553,9 +562,23 @@ void NVPTX::FatBinary::ConstructJob(Compilation &C, const JobAction &JA,
       continue;
     // We need to pass an Arch of the form "sm_XX" for cubin files and
     // "compute_XX" for ptx.
-    const char *Arch = (II.getType() == types::TY_PP_Asm)
-                           ? OffloadArchToVirtualArchString(gpu_arch)
-                           : gpu_arch_str;
+    std::string Arch = [&]() -> std::string {
+      bool IsAsm = II.getType() == types::TY_PP_Asm;
+      if (gpu_arch != OffloadArch::SM_custom)
+        return (IsAsm) ? OffloadArchToVirtualArchString(gpu_arch)
----------------
jhuber6 wrote:

```suggestion
        return IsAsm ? OffloadArchToVirtualArchString(gpu_arch)
```

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


More information about the llvm-commits mailing list