[Mlir-commits] [mlir] 6b7e6ea - Revert "Fix CUDA runtime wrapper for GPU mem alloc/free to async"

Mehdi Amini llvmlistbot at llvm.org
Mon Apr 11 23:50:54 PDT 2022


Author: Mehdi Amini
Date: 2022-04-12T06:50:27Z
New Revision: 6b7e6ea489f6dd45a9b0da9ac20871560917b9b0

URL: https://github.com/llvm/llvm-project/commit/6b7e6ea489f6dd45a9b0da9ac20871560917b9b0
DIFF: https://github.com/llvm/llvm-project/commit/6b7e6ea489f6dd45a9b0da9ac20871560917b9b0.diff

LOG: Revert "Fix CUDA runtime wrapper for GPU mem alloc/free to async"

This reverts commit b4117fede20b8c649320ad37364ae208baa0d0e7.
This broke one of the MLIR bot, a test is failing.

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp b/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp
index 18b6c589cb91f..44ed5b0cd2057 100644
--- a/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp
+++ b/mlir/lib/ExecutionEngine/CudaRuntimeWrappers.cpp
@@ -18,12 +18,6 @@
 
 #include "cuda.h"
 
-// We need to know the CUDA version to determine how to map some of the runtime
-// calls below.
-#if !defined(CUDA_VERSION)
-#error "cuda.h did not define CUDA_VERSION"
-#endif
-
 #ifdef _WIN32
 #define MLIR_CUDA_WRAPPERS_EXPORT __declspec(dllexport)
 #else
@@ -140,28 +134,15 @@ extern MLIR_CUDA_WRAPPERS_EXPORT "C" void mgpuEventRecord(CUevent event,
   CUDA_REPORT_IF_ERROR(cuEventRecord(event, stream));
 }
 
-extern "C" void *mgpuMemAlloc(uint64_t sizeBytes, CUstream stream) {
+extern "C" void *mgpuMemAlloc(uint64_t sizeBytes, CUstream /*stream*/) {
   ScopedContext scopedContext;
   CUdeviceptr ptr;
-#if CUDA_VERSION >= 11020
-  // Use the async version that was available since CUDA 11.2.
-  CUDA_REPORT_IF_ERROR(cuMemAllocAsync(&ptr, sizeBytes, stream));
-#else
   CUDA_REPORT_IF_ERROR(cuMemAlloc(&ptr, sizeBytes));
-  (void)stream;
-#endif
   return reinterpret_cast<void *>(ptr);
 }
 
-extern "C" void mgpuMemFree(void *ptr, CUstream stream) {
-#if CUDA_VERSION >= 11020
-  // Use the async version that was available since CUDA 11.2.
-  CUDA_REPORT_IF_ERROR(
-      cuMemFreeAsync(reinterpret_cast<CUdeviceptr>(ptr), stream));
-#else
+extern "C" void mgpuMemFree(void *ptr, CUstream /*stream*/) {
   CUDA_REPORT_IF_ERROR(cuMemFree(reinterpret_cast<CUdeviceptr>(ptr)));
-  (void)stream;
-#endif
 }
 
 extern "C" void mgpuMemcpy(void *dst, void *src, size_t sizeBytes,


        


More information about the Mlir-commits mailing list