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

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 11:19:29 PDT 2022


tra marked an inline comment as done.
tra 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)
----------------
tra wrote:
> yaxunl wrote:
> > should we assert Version.getMinor().value_or(0)<10 ?
> It's not an immediate issue, but you are correct that we may potentially have CUDA 12.34 and that will mess up the integer version encoding. 
> 
> In fact, NVIDIA hit exactly this kind of problem in CUDA-11.7 when they had to version some of the libraries as 11.10 and had to change the binary representation and break existing ABIs. Here we're only dealing with internal use, but I'll update the encoding to give us more wiggle room.
I've got rid of integer-encoded version altogether and switched to comparing VersionTuple directly. 


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