[Mlir-commits] [mlir] 7ac330a - [mlir][sparse][gpu] protect BSR method with cuda 12.1 (#67728)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 28 12:58:05 PDT 2023


Author: Aart Bik
Date: 2023-09-28T12:58:01-07:00
New Revision: 7ac330a461255f10c1664f02fae302d567d2a589

URL: https://github.com/llvm/llvm-project/commit/7ac330a461255f10c1664f02fae302d567d2a589
DIFF: https://github.com/llvm/llvm-project/commit/7ac330a461255f10c1664f02fae302d567d2a589.diff

LOG: [mlir][sparse][gpu] protect BSR method with cuda 12.1 (#67728)

MLIR official build is not quite at 12.1 yet, so until then we protext
the Bsr method with a macro guard

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp b/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp
index 8561aa090d32fd9..55db744af021c14 100644
--- a/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp
+++ b/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp
@@ -545,12 +545,14 @@ mgpuCreateBsr(intptr_t brows, intptr_t bcols, intptr_t bnnz, intptr_t rBsz,
               intptr_t cBsz, void *rowPos, void *colIdxs, void *values,
               int32_t ptp, int32_t itp, int32_t dtp, CUstream /*stream*/) {
   cusparseSpMatDescr_t mat = nullptr;
+#if CUSPARSE_VERSION >= 12100
   auto pTp = static_cast<cusparseIndexType_t>(ptp);
   auto iTp = static_cast<cusparseIndexType_t>(itp);
   auto dTp = static_cast<cudaDataType_t>(dtp);
   CUSPARSE_REPORT_IF_ERROR(cusparseCreateBsr(
       &mat, brows, bcols, bnnz, rBsz, cBsz, rowPos, colIdxs, values, pTp, iTp,
       CUSPARSE_INDEX_BASE_ZERO, dTp, CUSPARSE_ORDER_ROW))
+#endif
   return reinterpret_cast<void *>(mat);
 }
 


        


More information about the Mlir-commits mailing list