mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-04-04 23:59:10 +00:00
* Wrap ck host utitlies in CK namespace. The CK and CK-Tile source code bases are incompatible because CK is not properly using namespaces everywhere. In particular, we need to put hip_check_error in the ck namespace. Move all functions in include/ck_/host_utility that were in global namespace into the ck namespace. There may be additional namespace problems like this, and it's possible we'll have namespace clashes. But it is good design to properly guard our to code bases (CK and CKTile) so that they can both coexist. Moreover, estabilishing this compatiblity is essential if we are going to allow the builder to instantiate kernels from either template library. * Add using declarations to test code. After moving some of the untils into the ck namespace, most examples and a few tests had to be updated to recognize the new namespace declarations. We add using declarations to individual compute units for functions that were previously in the global namespace. * Add using declarations to client examples.
37 lines
1.5 KiB
C++
37 lines
1.5 KiB
C++
// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#pragma once
|
|
|
|
#include <sstream>
|
|
#include <hip/hip_runtime.h>
|
|
|
|
namespace ck {
|
|
|
|
// To be removed, which really does not tell the location of failed HIP functional call
|
|
inline void hip_check_error(hipError_t x)
|
|
{
|
|
if(x != hipSuccess)
|
|
{
|
|
std::ostringstream ss;
|
|
ss << "HIP runtime error: " << hipGetErrorString(x) << ". " << "hip_check_error.hpp" << ": "
|
|
<< __LINE__ << "in function: " << __func__;
|
|
throw std::runtime_error(ss.str());
|
|
}
|
|
}
|
|
|
|
#define HIP_CHECK_ERROR(retval_or_funcall) \
|
|
do \
|
|
{ \
|
|
hipError_t _tmpVal = retval_or_funcall; \
|
|
if(_tmpVal != hipSuccess) \
|
|
{ \
|
|
std::ostringstream ostr; \
|
|
ostr << "HIP Function Failed (" << __FILE__ << "," << __LINE__ << ") " \
|
|
<< hipGetErrorString(_tmpVal); \
|
|
throw std::runtime_error(ostr.str()); \
|
|
} \
|
|
} while(0)
|
|
|
|
} // namespace ck
|