7 #ifndef SRC_CUDA_NVRTC_TYPES_HPP_ 8 #define SRC_CUDA_NVRTC_TYPES_HPP_ 10 #include "../api/types.hpp" 13 #if CUDA_VERSION >= 11010 14 #include <nvPTXCompiler.h> 15 #endif // CUDA_VERSION >= 11010 19 #if __cplusplus >= 201703L 20 #include <string_view> 23 using string_view = ::std::string_view;
27 #include <cuda/rtc/detail/string_view.hpp> 30 using string_view = bpstd::string_view;
66 return (kind ==
cuda_cpp) ?
"CUDA C++" :
"PTX";
75 template <source_kind_t Kind>
struct types {};
77 template <>
struct types<cuda_cpp> {
78 using handle_type = nvrtcProgram;
79 using status_type = nvrtcResult;
80 enum named_status : ::std::underlying_type<status_type>::type {
81 success = NVRTC_SUCCESS,
82 out_of_memory = NVRTC_ERROR_OUT_OF_MEMORY,
83 program_creation_failure = NVRTC_ERROR_OUT_OF_MEMORY,
84 invalid_input = NVRTC_ERROR_PROGRAM_CREATION_FAILURE,
85 invalid_program = NVRTC_ERROR_INVALID_PROGRAM,
86 invalid_option = NVRTC_ERROR_INVALID_OPTION,
87 compilation_failure = NVRTC_ERROR_COMPILATION,
88 builtin_operation_failure = NVRTC_ERROR_BUILTIN_OPERATION_FAILURE,
89 no_registered_globals_after_compilation = NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION,
90 no_lowered_names_before_compilation = NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION,
91 invalid_expression_to_register_as_global = NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID,
92 internal_error = NVRTC_ERROR_INTERNAL_ERROR,
96 #if CUDA_VERSION >= 11010 97 template <>
struct types<ptx> {
98 using handle_type = nvPTXCompilerHandle;
99 using status_type = nvPTXCompileResult;
100 enum named_status : ::std::underlying_type<status_type>::type {
101 success = NVPTXCOMPILE_SUCCESS,
102 invalid_handle = NVPTXCOMPILE_ERROR_INVALID_COMPILER_HANDLE,
103 invalid_program_handle = NVPTXCOMPILE_ERROR_INVALID_COMPILER_HANDLE,
104 out_of_memory = NVPTXCOMPILE_ERROR_OUT_OF_MEMORY,
105 invalid_input = NVPTXCOMPILE_ERROR_INVALID_INPUT,
106 compilation_invocation_incomplete = NVPTXCOMPILE_ERROR_COMPILER_INVOCATION_INCOMPLETE,
107 compilation_failure = NVPTXCOMPILE_ERROR_COMPILATION_FAILURE,
108 unsupported_ptx_version = NVPTXCOMPILE_ERROR_UNSUPPORTED_PTX_VERSION,
109 internal_error = NVPTXCOMPILE_ERROR_INTERNAL,
110 #if CUDA_VERSION >= 12010 111 unsupported_device_side_sync = NVPTXCOMPILE_ERROR_UNSUPPORTED_DEVSIDE_SYNC,
115 #endif // CUDA_VERSION >= 11010 123 template <source_kind_t Kind>
124 using handle_t =
typename cuda::rtc::detail_::types<Kind>::handle_type;
130 template <source_kind_t Kind>
131 using status_t =
typename detail_::types<Kind>::status_type;
The CUDA variant of C++, accepted by the NVRTC library.
Definition: types.hpp:41
Definitions and functionality wrapping CUDA APIs.
Definition: array.hpp:22
typename cuda::rtc::detail_::types< Kind >::handle_type handle_t
Raw program handle used by the NVIDIA run-time compilation libraries's API calls: // The NVRTC librar...
Definition: types.hpp:124
source_kind_t
The API wrappers support different kinds of source code, accepted by different NVIDIA run-time compil...
Definition: types.hpp:39
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
NVIDIA's architecture-inspecific intermediate program representation language, known as PTX or Parall...
Definition: types.hpp:44
span< const char *const > const_cstrings_span
A span of C-style strings the contents of which must not be modified.
Definition: types.hpp:57