mirror of
https://github.com/sgjzfzzf/triton-tvm-ffi.git
synced 2026-05-02 03:52:11 +08:00
23 lines
1.0 KiB
C++
23 lines
1.0 KiB
C++
#ifndef TRITON_TVM_FFI_MACRO_H_
|
|
#define TRITON_TVM_FFI_MACRO_H_
|
|
|
|
#include <cuda.h>
|
|
#include <sstream>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
#define __CUDA_CHECK(__code) \
|
|
do { \
|
|
if ((__code) != CUDA_SUCCESS) { \
|
|
const char *errorName = nullptr, *errorStr = nullptr; \
|
|
cuGetErrorName((__code), &errorName); \
|
|
cuGetErrorString((__code), &errorStr); \
|
|
std::ostringstream __oss; \
|
|
__oss << "[" << errorName << "] " << errorStr << ", at " << __FILE__ \
|
|
<< ":" << __LINE__; \
|
|
throw std::runtime_error(__oss.str()); \
|
|
} \
|
|
} while (false)
|
|
|
|
#endif
|