[PATCH] D75806: [CUDA] Add CUDA 10.2 detection

Raul Tambre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 7 06:20:20 PST 2020


tambre created this revision.
tambre added reviewers: tra, jlebar.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75806

Files:
  clang/include/clang/Basic/Cuda.h
  clang/lib/Basic/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -634,23 +634,24 @@
   // back-end.
   const char *PtxFeature = nullptr;
   switch(CudaInstallation.version()) {
-    case CudaVersion::CUDA_101:
-      PtxFeature = "+ptx64";
-      break;
-    case CudaVersion::CUDA_100:
-      PtxFeature = "+ptx63";
-      break;
-    case CudaVersion::CUDA_92:
-      PtxFeature = "+ptx61";
-      break;
-    case CudaVersion::CUDA_91:
-      PtxFeature = "+ptx61";
-      break;
-    case CudaVersion::CUDA_90:
-      PtxFeature = "+ptx60";
-      break;
-    default:
-      PtxFeature = "+ptx42";
+  case CudaVersion::CUDA_102:
+  case CudaVersion::CUDA_101:
+    PtxFeature = "+ptx64";
+    break;
+  case CudaVersion::CUDA_100:
+    PtxFeature = "+ptx63";
+    break;
+  case CudaVersion::CUDA_92:
+    PtxFeature = "+ptx61";
+    break;
+  case CudaVersion::CUDA_91:
+    PtxFeature = "+ptx61";
+    break;
+  case CudaVersion::CUDA_90:
+    PtxFeature = "+ptx60";
+    break;
+  default:
+    PtxFeature = "+ptx42";
   }
   CC1Args.append({"-target-feature", PtxFeature});
   if (DriverArgs.hasFlag(options::OPT_fcuda_short_ptr,
Index: clang/lib/Basic/Cuda.cpp
===================================================================
--- clang/lib/Basic/Cuda.cpp
+++ clang/lib/Basic/Cuda.cpp
@@ -28,6 +28,8 @@
     return "10.0";
   case CudaVersion::CUDA_101:
     return "10.1";
+  case CudaVersion::CUDA_102:
+    return "10.2";
   }
   llvm_unreachable("invalid enum");
 }
@@ -42,6 +44,7 @@
       .Case("9.2", CudaVersion::CUDA_92)
       .Case("10.0", CudaVersion::CUDA_100)
       .Case("10.1", CudaVersion::CUDA_101)
+      .Case("10.2", CudaVersion::CUDA_102)
       .Default(CudaVersion::UNKNOWN);
 }
 
@@ -382,6 +385,8 @@
     return CudaVersion::CUDA_100;
   case 101:
     return CudaVersion::CUDA_101;
+  case 102:
+    return CudaVersion::CUDA_102;
   default:
     return CudaVersion::UNKNOWN;
   }
Index: clang/include/clang/Basic/Cuda.h
===================================================================
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -27,7 +27,8 @@
   CUDA_92,
   CUDA_100,
   CUDA_101,
-  LATEST = CUDA_101,
+  CUDA_102,
+  LATEST = CUDA_102,
 };
 const char *CudaVersionToString(CudaVersion V);
 // Input is "Major.Minor"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75806.248929.patch
Type: text/x-patch
Size: 2427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200307/e655cf7a/attachment.bin>


More information about the cfe-commits mailing list