HIP: Heterogenous-computing Interface for Portability
hiprtc.h
1 /*
2 Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 #ifndef HIPRTC_H
23 #define HIPRTC_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 
29 #include <stdlib.h>
30 
31 #if !defined(_WIN32)
32 #pragma GCC visibility push (default)
33 #endif
34 
35 enum hiprtcResult {
36  HIPRTC_SUCCESS = 0,
37  HIPRTC_ERROR_OUT_OF_MEMORY = 1,
38  HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
39  HIPRTC_ERROR_INVALID_INPUT = 3,
40  HIPRTC_ERROR_INVALID_PROGRAM = 4,
41  HIPRTC_ERROR_INVALID_OPTION = 5,
42  HIPRTC_ERROR_COMPILATION = 6,
43  HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
44  HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
45  HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
46  HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
47  HIPRTC_ERROR_INTERNAL_ERROR = 11
48 };
49 
50 const char* hiprtcGetErrorString(hiprtcResult result);
51 
52 
53 hiprtcResult hiprtcVersion(int* major, int* minor);
54 
55 typedef struct _hiprtcProgram* hiprtcProgram;
56 
57 hiprtcResult hiprtcAddNameExpression(hiprtcProgram prog,
58  const char* name_expression);
59 
60 hiprtcResult hiprtcCompileProgram(hiprtcProgram prog,
61  int numOptions,
62  const char** options);
63 
64 hiprtcResult hiprtcCreateProgram(hiprtcProgram* prog,
65  const char* src,
66  const char* name,
67  int numHeaders,
68  const char** headers,
69  const char** includeNames);
70 
71 hiprtcResult hiprtcDestroyProgram(hiprtcProgram* prog);
72 
73 hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog,
74  const char* name_expression,
75  const char** lowered_name);
76 
77 hiprtcResult hiprtcGetProgramLog(hiprtcProgram prog, char* log);
78 
79 hiprtcResult hiprtcGetProgramLogSize(hiprtcProgram prog,
80  size_t* logSizeRet);
81 
82 hiprtcResult hiprtcGetCode(hiprtcProgram prog, char* code);
83 
84 hiprtcResult hiprtcGetCodeSize(hiprtcProgram prog, size_t* codeSizeRet);
85 
86 #if !defined(_WIN32)
87 #pragma GCC visibility pop
88 #endif
89 
90 #ifdef __cplusplus
91 }
92 #endif /* __cplusplus */
93 
94 #endif //HIPRTC_H