From 3ebc53c394e34dfd780e6bf59ad3c96bd9b3fa79 Mon Sep 17 00:00:00 2001
From: Nathan Luehr <nluehr@nvidia.com>
Date: Thu, 11 Jun 2020 15:59:21 -0500
Subject: [PATCH] Relax stub include version checking.

Remove upper bound on version check for latest inc files.
---
 tensorflow/stream_executor/cuda/cublas_stub.cc   | 10 ++++------
 tensorflow/stream_executor/cuda/cuda_stub.cc     | 10 ++++------
 tensorflow/stream_executor/cuda/cudart_stub.cc   | 10 ++++------
 tensorflow/stream_executor/cuda/cusolver_stub.cc | 10 ++++------
 tensorflow/stream_executor/cuda/cusparse_stub.cc | 10 ++++------
 5 files changed, 20 insertions(+), 30 deletions(-)

diff --git a/tensorflow/stream_executor/cuda/cublas_stub.cc b/tensorflow/stream_executor/cuda/cublas_stub.cc
index 1cbfd51316c..76f3d9b134e 100644
--- a/tensorflow/stream_executor/cuda/cublas_stub.cc
+++ b/tensorflow/stream_executor/cuda/cublas_stub.cc
@@ -63,14 +63,12 @@ typedef enum {} cublasMath_t;
 
 #if CUDA_VERSION < 10000
 #include "tensorflow/stream_executor/cuda/cublas_9_0.inc"
-#elif CUDA_VERSION == 10000
+#elif CUDA_VERSION < 10010
 #include "tensorflow/stream_executor/cuda/cublas_10_0.inc"
-#elif CUDA_VERSION == 10010
+#elif CUDA_VERSION < 10020
 #include "tensorflow/stream_executor/cuda/cublas_10_1.inc"
-#elif CUDA_VERSION == 10020
+#elif CUDA_VERSION < 11000
 #include "tensorflow/stream_executor/cuda/cublas_10_2.inc"
-#elif CUBLAS_VER_MAJOR == 11 && CUBLAS_VER_MINOR == 0
-#include "tensorflow/stream_executor/cuda/cublas_11_0.inc"
 #else
-#error "We have no wrapper for this version."
+#include "tensorflow/stream_executor/cuda/cublas_11_0.inc"
 #endif
diff --git a/tensorflow/stream_executor/cuda/cuda_stub.cc b/tensorflow/stream_executor/cuda/cuda_stub.cc
index ce02be89c22..58c898a54ee 100644
--- a/tensorflow/stream_executor/cuda/cuda_stub.cc
+++ b/tensorflow/stream_executor/cuda/cuda_stub.cc
@@ -95,14 +95,12 @@ typedef void(CUDA_CB* CUhostFn)(void* userData);
 
 #if CUDA_VERSION < 10000
 #include "tensorflow/stream_executor/cuda/cuda_9_0.inc"
-#elif CUDA_VERSION == 10000
+#elif CUDA_VERSION < 10010
 #include "tensorflow/stream_executor/cuda/cuda_10_0.inc"
-#elif CUDA_VERSION <= 10010
+#elif CUDA_VERSION < 10020
 #include "tensorflow/stream_executor/cuda/cuda_10_1.inc"
-#elif CUDA_VERSION <= 10020
+#elif CUDA_VERSION < 11000
 #include "tensorflow/stream_executor/cuda/cuda_10_2.inc"
-#elif CUDA_VERSION <= 11000
-#include "tensorflow/stream_executor/cuda/cuda_11_0.inc"
 #else
-#error "We have no wrapper for this version."
+#include "tensorflow/stream_executor/cuda/cuda_11_0.inc"
 #endif
diff --git a/tensorflow/stream_executor/cuda/cudart_stub.cc b/tensorflow/stream_executor/cuda/cudart_stub.cc
index 3b9e0f2937b..2ab9d142e3c 100644
--- a/tensorflow/stream_executor/cuda/cudart_stub.cc
+++ b/tensorflow/stream_executor/cuda/cudart_stub.cc
@@ -53,16 +53,14 @@ cudaError_t GetSymbolNotFoundError() {
 // A bunch of new symbols were introduced in version 10
 #if CUDART_VERSION < 10000
 #include "tensorflow/stream_executor/cuda/cuda_runtime_9_0.inc"
-#elif CUDART_VERSION == 10000
+#elif CUDART_VERSION < 10010
 #include "tensorflow/stream_executor/cuda/cuda_runtime_10_0.inc"
-#elif CUDART_VERSION == 10010
+#elif CUDART_VERSION < 10020
 #include "tensorflow/stream_executor/cuda/cuda_runtime_10_1.inc"
-#elif CUDART_VERSION == 10020
+#elif CUDART_VERSION < 11000
 #include "tensorflow/stream_executor/cuda/cuda_runtime_10_2.inc"
-#elif CUDART_VERSION == 11000
-#include "tensorflow/stream_executor/cuda/cuda_runtime_11_0.inc"
 #else
-#error "We have no wrapper for this version."
+#include "tensorflow/stream_executor/cuda/cuda_runtime_11_0.inc"
 #endif
 #undef __dv
 #undef __CUDA_DEPRECATED
diff --git a/tensorflow/stream_executor/cuda/cusolver_stub.cc b/tensorflow/stream_executor/cuda/cusolver_stub.cc
index a4b9cc37f9b..edf87c3dc0b 100644
--- a/tensorflow/stream_executor/cuda/cusolver_stub.cc
+++ b/tensorflow/stream_executor/cuda/cusolver_stub.cc
@@ -53,14 +53,12 @@ cusolverStatus_t GetSymbolNotFoundError() {
 
 #if CUDA_VERSION < 10000
 #include "tensorflow/stream_executor/cuda/cusolver_dense_9_0.inc"
-#elif CUDA_VERSION == 10000
+#elif CUDA_VERSION < 10010
 #include "tensorflow/stream_executor/cuda/cusolver_dense_10_0.inc"
-#elif CUDA_VERSION == 10010
+#elif CUDA_VERSION < 10020
 #include "tensorflow/stream_executor/cuda/cusolver_dense_10_1.inc"
-#elif CUDA_VERSION == 10020
+#elif CUDA_VERSION < 11000
 #include "tensorflow/stream_executor/cuda/cusolver_dense_10_2.inc"
-#elif CUDA_VERSION == 11000
-#include "tensorflow/stream_executor/cuda/cusolver_dense_11_0.inc"
 #else
-#error "We don't have a wrapper for this version."
+#include "tensorflow/stream_executor/cuda/cusolver_dense_11_0.inc"
 #endif
diff --git a/tensorflow/stream_executor/cuda/cusparse_stub.cc b/tensorflow/stream_executor/cuda/cusparse_stub.cc
index ae56402fbc3..caed4d1008e 100644
--- a/tensorflow/stream_executor/cuda/cusparse_stub.cc
+++ b/tensorflow/stream_executor/cuda/cusparse_stub.cc
@@ -53,14 +53,12 @@ cusparseStatus_t GetSymbolNotFoundError() {
 
 #if CUDA_VERSION < 10000
 #include "tensorflow/stream_executor/cuda/cusparse_9_0.inc"
-#elif CUDA_VERSION == 10000
+#elif CUDA_VERSION < 10010
 #include "tensorflow/stream_executor/cuda/cusparse_10_0.inc"
-#elif CUDA_VERSION == 10010
+#elif CUDA_VERSION < 10020
 #include "tensorflow/stream_executor/cuda/cusparse_10_1.inc"
-#elif CUDA_VERSION == 10020
+#elif CUDA_VERSION < 11000
 #include "tensorflow/stream_executor/cuda/cusparse_10_2.inc"
-#elif CUSPARSE_VER_MAJOR == 11 && CUSPARSE_VER_MINOR == 0
-#include "tensorflow/stream_executor/cuda/cusparse_11_0.inc"
 #else
-#error "We don't have a wrapper for this version."
+#include "tensorflow/stream_executor/cuda/cusparse_11_0.inc"
 #endif