[PATCH] D108835: [NVPTX] consider nvptx-nvidia-gpulibs triple to be compatible with other variants.

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 11:31:45 PDT 2021


tra created this revision.
tra added a reviewer: jdoerfert.
Herald added subscribers: dexonsmith, bixia, hiraditya.
tra requested review of this revision.
Herald added a project: LLVM.

libdevice bitcode provided by NVIDIA is linked with clang/LLVM-generated IR
which uses nvptx*-nvidia-cuda triple. We need to mark them as compatible.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108835

Files:
  llvm/lib/Support/Triple.cpp


Index: llvm/lib/Support/Triple.cpp
===================================================================
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -1639,6 +1639,14 @@
     return getArch() == Other.getArch() && getSubArch() == Other.getSubArch() &&
            getVendor() == Other.getVendor() && getOS() == Other.getOS();
 
+  if (getVendor() == Triple::NVIDIA) {
+    // libdevice bitcode uses nvptx64-nvidia-gpulibs triple and is used
+    // by all NVPTX variants.
+    return getArch() == Other.getArch() && getSubArch() == Other.getSubArch() &&
+           getVendor() == Other.getVendor() &&
+           (getOS() == Other.getOS() || getOSName() == "gpulibs" ||
+            Other.getOSName() == "gpulibs");
+  }
   return *this == Other;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108835.369153.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210827/ded16709/attachment.bin>


More information about the llvm-commits mailing list