35 #pragma GCC visibility push(default)
38 typedef enum hiprtcResult {
40 HIPRTC_ERROR_OUT_OF_MEMORY = 1,
41 HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
42 HIPRTC_ERROR_INVALID_INPUT = 3,
43 HIPRTC_ERROR_INVALID_PROGRAM = 4,
44 HIPRTC_ERROR_INVALID_OPTION = 5,
45 HIPRTC_ERROR_COMPILATION = 6,
46 HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
47 HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
48 HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
49 HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
50 HIPRTC_ERROR_INTERNAL_ERROR = 11
53 inline static nvrtcResult hiprtcResultTonvrtcResult(hiprtcResult result) {
57 case HIPRTC_ERROR_OUT_OF_MEMORY:
58 return NVRTC_ERROR_OUT_OF_MEMORY;
59 case HIPRTC_ERROR_PROGRAM_CREATION_FAILURE:
60 return NVRTC_ERROR_PROGRAM_CREATION_FAILURE;
61 case HIPRTC_ERROR_INVALID_INPUT:
62 return NVRTC_ERROR_INVALID_INPUT;
63 case HIPRTC_ERROR_INVALID_PROGRAM:
64 return NVRTC_ERROR_INVALID_PROGRAM;
65 case HIPRTC_ERROR_INVALID_OPTION:
66 return NVRTC_ERROR_INVALID_OPTION;
67 case HIPRTC_ERROR_COMPILATION:
68 return NVRTC_ERROR_COMPILATION;
69 case HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE:
70 return NVRTC_ERROR_BUILTIN_OPERATION_FAILURE;
71 case HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION:
72 return NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION;
73 case HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION:
74 return NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION;
75 case HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID:
76 return NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID;
77 case HIPRTC_ERROR_INTERNAL_ERROR:
78 return NVRTC_ERROR_INTERNAL_ERROR;
82 inline static hiprtcResult nvrtcResultTohiprtcResult(nvrtcResult result) {
85 return HIPRTC_SUCCESS;
86 case NVRTC_ERROR_OUT_OF_MEMORY:
87 return HIPRTC_ERROR_OUT_OF_MEMORY;
88 case NVRTC_ERROR_PROGRAM_CREATION_FAILURE:
89 return HIPRTC_ERROR_PROGRAM_CREATION_FAILURE;
90 case NVRTC_ERROR_INVALID_INPUT:
91 return HIPRTC_ERROR_INVALID_INPUT;
92 case NVRTC_ERROR_INVALID_PROGRAM:
93 return HIPRTC_ERROR_INVALID_PROGRAM;
94 case NVRTC_ERROR_INVALID_OPTION:
95 return HIPRTC_ERROR_INVALID_OPTION;
96 case NVRTC_ERROR_COMPILATION:
97 return HIPRTC_ERROR_COMPILATION;
98 case NVRTC_ERROR_BUILTIN_OPERATION_FAILURE:
99 return HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE;
100 case NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION:
101 return HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION;
102 case NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION:
103 return HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION;
104 case NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID:
105 return HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID;
106 case NVRTC_ERROR_INTERNAL_ERROR:
107 return HIPRTC_ERROR_INTERNAL_ERROR;
111 const char* hiprtcGetErrorString(hiprtcResult result) {
112 return nvrtcGetErrorString(hiprtcResultTonvrtcResult(result));
115 hiprtcResult hiprtcVersion(
int* major,
int* minor) {
116 return nvrtcResultTohiprtcResult(nvrtcVersion(major, minor));
119 typedef nvrtcProgram hiprtcProgram;
121 hiprtcResult hiprtcAddNameExpression(hiprtcProgram prog,
const char* name_expression) {
122 return nvrtcResultTohiprtcResult(nvrtcAddNameExpression(prog, name_expression));
125 hiprtcResult hiprtcCompileProgram(hiprtcProgram prog,
int numOptions,
const char** options) {
126 return nvrtcResultTohiprtcResult(nvrtcCompileProgram(prog, numOptions, options));
129 hiprtcResult hiprtcCreateProgram(hiprtcProgram* prog,
const char* src,
const char* name,
130 int numHeaders,
const char** headers,
const char** includeNames) {
131 return nvrtcResultTohiprtcResult(
132 nvrtcCreateProgram(prog, src, name, numHeaders, headers, includeNames));
135 hiprtcResult hiprtcDestroyProgram(hiprtcProgram* prog) {
136 return nvrtcResultTohiprtcResult(nvrtcDestroyProgram(prog));
139 hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog,
const char* name_expression,
140 const char** lowered_name) {
141 return nvrtcResultTohiprtcResult(nvrtcGetLoweredName(prog, name_expression, lowered_name));
144 hiprtcResult hiprtcGetProgramLog(hiprtcProgram prog,
char* log) {
145 return nvrtcResultTohiprtcResult(nvrtcGetProgramLog(prog, log));
148 hiprtcResult hiprtcGetProgramLogSize(hiprtcProgram prog,
size_t* logSizeRet) {
149 return nvrtcResultTohiprtcResult(nvrtcGetProgramLogSize(prog, logSizeRet));
152 hiprtcResult hiprtcGetCode(hiprtcProgram prog,
char* code) {
153 return nvrtcResultTohiprtcResult(nvrtcGetPTX(prog, code));
156 hiprtcResult hiprtcGetCodeSize(hiprtcProgram prog,
size_t* codeSizeRet) {
157 return nvrtcResultTohiprtcResult(nvrtcGetPTXSize(prog, codeSizeRet));
161 #pragma GCC visibility pop