[Mlir-commits] [mlir] 77c3b01 - [mlir] fix error handling in rocm runtime wrapper

Tobias Gysi llvmlistbot at llvm.org
Wed Jul 29 13:10:58 PDT 2020


Author: Tobias Gysi
Date: 2020-07-29T22:08:42+02:00
New Revision: 77c3b016c42412edd43568b001fe358425a113dd

URL: https://github.com/llvm/llvm-project/commit/77c3b016c42412edd43568b001fe358425a113dd
DIFF: https://github.com/llvm/llvm-project/commit/77c3b016c42412edd43568b001fe358425a113dd.diff

LOG: [mlir] fix error handling in rocm runtime wrapper

The patch fixes minor issues in the rocm runtime wrapper due to api differences between CUDA and HIP.

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D84861

Added: 
    

Modified: 
    mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp b/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp
index b97ce695ac42..a64815007661 100644
--- a/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp
+++ b/mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp
@@ -25,8 +25,7 @@
   [](hipError_t result) {                                                      \
     if (!result)                                                               \
       return;                                                                  \
-    const char *name = nullptr;                                                \
-    hipGetErrorName(result, &name);                                            \
+    const char *name = hipGetErrorName(result);                                \
     if (!name)                                                                 \
       name = "<unknown>";                                                      \
     llvm::errs() << "'" << #expr << "' failed with '" << name << "'\n";        \
@@ -74,8 +73,7 @@ extern "C" void mgpuStreamSynchronize(hipStream_t stream) {
 // Allows to register byte array with the ROCM runtime. Helpful until we have
 // transfer functions implemented.
 extern "C" void mgpuMemHostRegister(void *ptr, uint64_t sizeBytes) {
-  HIP_REPORT_IF_ERROR(hipHostRegister(ptr, sizeBytes, /*flags=*/0),
-                      "MemHostRegister");
+  HIP_REPORT_IF_ERROR(hipHostRegister(ptr, sizeBytes, /*flags=*/0));
 }
 
 // Allows to register a MemRef with the ROCM runtime. Initializes array with
@@ -116,10 +114,9 @@ extern "C" void mgpuMemHostRegisterInt32(int64_t rank, void *ptr) {
 
 template <typename T>
 void mgpuMemGetDevicePointer(T *hostPtr, T **devicePtr) {
-  HIP_REPORT_IF_ERROR(hipSetDevice(0), "hipSetDevice");
+  HIP_REPORT_IF_ERROR(hipSetDevice(0));
   HIP_REPORT_IF_ERROR(
-      hipHostGetDevicePointer((void **)devicePtr, hostPtr, /*flags=*/0),
-      "hipHostGetDevicePointer");
+      hipHostGetDevicePointer((void **)devicePtr, hostPtr, /*flags=*/0));
 }
 
 extern "C" StridedMemRefType<float, 1>


        


More information about the Mlir-commits mailing list