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