forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus_util.c
32 lines (26 loc) · 996 Bytes
/
status_util.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2021 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "experimental/rocm/status_util.h"
#include <stddef.h>
#include "experimental/rocm/dynamic_symbols.h"
iree_status_t iree_hal_rocm_result_to_status(
iree_hal_rocm_dynamic_symbols_t *syms, hipError_t result, const char *file,
uint32_t line) {
if (IREE_LIKELY(result == hipSuccess)) {
return iree_ok_status();
}
const char *error_name = syms->hipGetErrorName(result);
if (result == hipErrorUnknown) {
error_name = "UNKNOWN";
}
const char *error_string = syms->hipGetErrorString(result);
if (result == hipErrorUnknown) {
error_string = "Unknown error.";
}
return iree_make_status(IREE_STATUS_INTERNAL,
"rocm driver error '%s' (%d): %s", error_name, result,
error_string);
}