hip_check_error.hpp Source File

hip_check_error.hpp Source File#

Composable Kernel: hip_check_error.hpp Source File
tile/host/hip_check_error.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2018-2024, Advanced Micro Devices, Inc. All rights reserved.
3
4#pragma once
5
7#include <sstream>
8#include <stdexcept>
9#include <hip/hip_runtime.h>
10
11namespace ck_tile {
12// To be removed, which really does not tell the location of failed HIP functional call
13CK_TILE_HOST void hip_check_error(hipError_t x)
14{
15 if(x != hipSuccess)
16 {
17 std::ostringstream ss;
18 ss << "HIP runtime error: " << hipGetErrorString(x) << ". " << __FILE__ << ": " << __LINE__
19 << "in function: " << __func__;
20 throw std::runtime_error(ss.str());
21 }
22}
23} // namespace ck_tile
24
25#define HIP_CHECK_ERROR(retval_or_funcall) \
26 do \
27 { \
28 hipError_t _tmpVal = retval_or_funcall; \
29 if(_tmpVal != hipSuccess) \
30 { \
31 std::ostringstream ostr; \
32 ostr << "HIP Function Failed (" << __FILE__ << "," << __LINE__ << ") " \
33 << hipGetErrorString(_tmpVal); \
34 throw std::runtime_error(ostr.str()); \
35 } \
36 } while(0)
#define CK_TILE_HOST
Definition config.hpp:40
Definition tile/core/algorithm/cluster_descriptor.hpp:13
CK_TILE_HOST void hip_check_error(hipError_t x)
Definition tile/host/hip_check_error.hpp:13