From 330fb7b1a31577ea9640528348b25ce6a297b708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20O=C5=BC=C3=B3g?= <58388001+SzymonOzog@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:16:20 +0200 Subject: [PATCH] Print more meaningfull hip error messages (#1530) --- extra/hip_wrapper.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extra/hip_wrapper.py b/extra/hip_wrapper.py index cc0ccd5230..9084e69818 100644 --- a/extra/hip_wrapper.py +++ b/extra/hip_wrapper.py @@ -14,7 +14,16 @@ except: def hipCheckStatus(status): if status != 0: - raise RuntimeError('HIP error %s' % status) + raise RuntimeError('HIP error %s: %s' % (status, hipGetErrorString(status))) + + +_libhip.hipGetErrorString.restype = ctypes.c_char_p +_libhip.hipGetErrorString.argtypes = [ctypes.c_int] + + +def hipGetErrorString(status): + return _libhip.hipGetErrorString(status).decode('utf-8') + _libhip.hipDeviceSynchronize.restype = int _libhip.hipDeviceSynchronize.argtypes = []