9 #ifndef CUDA_API_WRAPPERS_RTC_ERROR_HPP_ 10 #define CUDA_API_WRAPPERS_RTC_ERROR_HPP_ 14 #include <cuda_runtime_api.h> 16 #include <type_traits> 41 template <source_kind_t Kind>
42 using named_t =
typename rtc::detail_::types<Kind>::named_status;
45 template <source_kind_t Kind>
47 template <source_kind_t Kind>
49 template <source_kind_t Kind>
51 template <source_kind_t Kind>
63 template <source_kind_t Kind>
74 template <source_kind_t Kind>
77 return not is_success<Kind>(status);
87 return nvrtcGetErrorString(status);
90 #if CUDA_VERSION >= 11010 95 case (
status_t) named::success:
break;
96 case (
status_t) named::invalid_program_handle:
return "Invalid PTX compilation handle";
97 case (
status_t) named::out_of_memory:
return "out of memory";
98 case (
status_t) named::invalid_input:
return "Invalid input for PTX compilation";
99 case (
status_t) named::compilation_invocation_incomplete:
return "PTX compilation invocation incomplete";
100 case (
status_t) named::compilation_failure:
return "PTX compilation failure";
101 case (
status_t) named::unsupported_ptx_version:
return "Unsupported PTX version";
102 case (
status_t) named::internal_error:
return "Unknown PTX compilation error";
103 #if CUDA_VERSION >= 12010 104 case (
status_t) named::unsupported_device_side_sync:
return "Unsupported device-side synchronization";
108 return "unknown error";
110 #endif // CUDA_VERSION >= 11010 122 template <source_kind_t Kind>
127 ::std::runtime_error(
describe(error_code)),
132 ::std::runtime_error(::std::move(what_arg) +
": " +
describe(error_code)),
142 ::std::runtime_error(::std::move(err)), code_(error_code)
174 template <source_kind_t Kind>
186 template <source_kind_t Kind>
201 #define throw_if_rtc_error_lazy(Kind, status__, ... ) \ 203 ::cuda::rtc::status_t<Kind> tie_status__ = static_cast<::cuda::rtc::status_t<Kind>>(status__); \ 204 if (::cuda::is_failure<Kind>(tie_status__)) { \ 205 throw ::cuda::rtc::runtime_error<Kind>(tie_status__, (__VA_ARGS__)); \ 211 #endif // CUDA_API_WRAPPERS_RTC_ERROR_HPP_ Definitions and functionality wrapping CUDA APIs.
Definition: array.hpp:22
constexpr bool is_failure(status_t status)
Determine whether the API call returning the specified status had failed.
Definition: error.hpp:209
typename detail_::types< Kind >::status_type status_t
Status values returned by the NVIDIA run-time compilation libraries's API calls: The NVRTC library fo...
Definition: types.hpp:131
void throw_if_error(status_t status, const ::std::string &message) noexcept(false)
Do nothing...
Definition: error.hpp:335
status_t< Kind > code() const
Obtain the CUDA status code which resulted in this error being thrown.
Definition: error.hpp:154
Type definitions used in CUDA real-time compilation work wrappers.
inline ::std::string describe(status_t status)
Obtain a brief textual explanation for a specified kind of CUDA Runtime API status or error code...
Definition: error.hpp:215
bool operator==(const context_t &lhs, const context_t &rhs) noexcept
Definition: context.hpp:762
A (base?) class for exceptions raised by CUDA code; these errors are thrown by essentially all CUDA R...
Definition: error.hpp:123
constexpr bool is_success(status_t status)
Determine whether the API call returning the specified status had succeeded.
Definition: error.hpp:203
typename rtc::detail_::types< Kind >::named_status named_t
Aliases for NVRTC / PTX compilation library status codes.
Definition: error.hpp:42
CUresult status_t
Indicates either the result (success or error index) of a CUDA Runtime or Driver API call...
Definition: types.hpp:77