From 77c3b016c42412edd43568b001fe358425a113dd Mon Sep 17 00:00:00 2001 From: Tobias Gysi Date: Wed, 29 Jul 2020 22:00:48 +0200 Subject: [PATCH] [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 --- mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 = ""; \ 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 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