[PATCH] D135328: [CUDA] Refactored CUDA version housekeeping to use less boilerplate.

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 5 17:01:35 PDT 2022


yaxunl added inline comments.


================
Comment at: clang/lib/Basic/Cuda.cpp:59
+CudaVersion ToCudaVersion(llvm::VersionTuple Version) {
+  int IVer = Version.getMajor() * 10 + Version.getMinor().value_or(0);
+  for (auto *I = CudaNameVersionMap; I->Version != CudaVersion::UNKNOWN; ++I)
----------------
should we assert Version.getMinor().value_or(0)<10 ?


================
Comment at: clang/lib/Basic/Targets/NVPTX.cpp:45-46
+    int PTXV;
+    if (!Feature.startswith("+ptx") ||
+        Feature.drop_front(4).getAsInteger(10, PTXV))
       continue;
----------------
This behaves differently when seeing a +ptx value not listed in the original code. Previously, it returns 32, now it will just return that value. Is this intended?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135328/new/

https://reviews.llvm.org/D135328



More information about the cfe-commits mailing list