1#[repr(C)]
4#[derive(Debug, Copy, Clone)]
5pub struct nvPTXCompiler {
6 _unused: [u8; 0],
7}
8#[doc = " \\ingroup handle"]
9#[doc = " \\brief nvPTXCompilerHandle represents a handle to the PTX Compiler."]
10#[doc = ""]
11#[doc = " To compile a PTX program string, an instance of nvPTXCompiler"]
12#[doc = " must be created and the handle to it must be obtained using the"]
13#[doc = " API nvPTXCompilerCreate(). Then the compilation can be done"]
14#[doc = " using the API nvPTXCompilerCompile()."]
15#[doc = ""]
16pub type nvPTXCompilerHandle = *mut nvPTXCompiler;
17pub const nvPTXCompileResult_NVPTXCOMPILE_SUCCESS: nvPTXCompileResult = 0;
18pub const nvPTXCompileResult_NVPTXCOMPILE_ERROR_INVALID_COMPILER_HANDLE: nvPTXCompileResult = 1;
19pub const nvPTXCompileResult_NVPTXCOMPILE_ERROR_INVALID_INPUT: nvPTXCompileResult = 2;
20pub const nvPTXCompileResult_NVPTXCOMPILE_ERROR_COMPILATION_FAILURE: nvPTXCompileResult = 3;
21pub const nvPTXCompileResult_NVPTXCOMPILE_ERROR_INTERNAL: nvPTXCompileResult = 4;
22pub const nvPTXCompileResult_NVPTXCOMPILE_ERROR_OUT_OF_MEMORY: nvPTXCompileResult = 5;
23pub const nvPTXCompileResult_NVPTXCOMPILE_ERROR_COMPILER_INVOCATION_INCOMPLETE: nvPTXCompileResult =
24 6;
25pub const nvPTXCompileResult_NVPTXCOMPILE_ERROR_UNSUPPORTED_PTX_VERSION: nvPTXCompileResult = 7;
26#[doc = " \\ingroup error"]
27#[doc = ""]
28#[doc = " \\brief The nvPTXCompiler APIs return the nvPTXCompileResult codes to indicate the call result"]
29pub type nvPTXCompileResult = ::std::os::raw::c_int;
30extern "C" {
31 #[doc = " \\ingroup versioning"]
32 #[doc = ""]
33 #[doc = " \\brief Queries the current \\p major and \\p minor version of"]
34 #[doc = " PTX Compiler APIs being used"]
35 #[doc = ""]
36 #[doc = " \\param [out] major Major version of the PTX Compiler APIs"]
37 #[doc = " \\param [out] minor Minor version of the PTX Compiler APIs"]
38 #[doc = " \\note The version of PTX Compiler APIs follows the CUDA Toolkit versioning."]
39 #[doc = " The PTX ISA version supported by a PTX Compiler API version is listed"]
40 #[doc = " <a href=\"https://docs.nvidia.com/cuda/parallel-thread-execution/#release-notes\">here</a>."]
41 #[doc = ""]
42 #[doc = " \\return"]
43 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
44 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
45 pub fn nvPTXCompilerGetVersion(
46 major: *mut ::std::os::raw::c_uint,
47 minor: *mut ::std::os::raw::c_uint,
48 ) -> nvPTXCompileResult;
49}
50extern "C" {
51 #[doc = " \\ingroup compilation"]
52 #[doc = ""]
53 #[doc = " \\brief Obtains the handle to an instance of the PTX compiler"]
54 #[doc = " initialized with the given PTX program \\p ptxCode"]
55 #[doc = ""]
56 #[doc = " \\param [out] compiler Returns a handle to PTX compiler initialized"]
57 #[doc = " with the PTX program \\p ptxCode"]
58 #[doc = " \\param [in] ptxCodeLen Size of the PTX program \\p ptxCode passed as string"]
59 #[doc = " \\param [in] ptxCode The PTX program which is to be compiled passed as string."]
60 #[doc = ""]
61 #[doc = ""]
62 #[doc = " \\return"]
63 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
64 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_OUT_OF_MEMORY \\endlink"]
65 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
66 pub fn nvPTXCompilerCreate(
67 compiler: *mut nvPTXCompilerHandle,
68 ptxCodeLen: size_t,
69 ptxCode: *const ::std::os::raw::c_char,
70 ) -> nvPTXCompileResult;
71}
72extern "C" {
73 #[doc = " \\ingroup compilation"]
74 #[doc = ""]
75 #[doc = " \\brief Destroys and cleans the already created PTX compiler"]
76 #[doc = ""]
77 #[doc = " \\param [in] compiler A handle to the PTX compiler which is to be destroyed"]
78 #[doc = ""]
79 #[doc = " \\return"]
80 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
81 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_OUT_OF_MEMORY \\endlink"]
82 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
83 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
84 #[doc = ""]
85 pub fn nvPTXCompilerDestroy(compiler: *mut nvPTXCompilerHandle) -> nvPTXCompileResult;
86}
87extern "C" {
88 #[doc = " \\ingroup compilation"]
89 #[doc = ""]
90 #[doc = " \\brief Compile a PTX program with the given compiler options"]
91 #[doc = ""]
92 #[doc = " \\param [in,out] compiler A handle to PTX compiler initialized with the"]
93 #[doc = " PTX program which is to be compiled."]
94 #[doc = " The compiled program can be accessed using the handle"]
95 #[doc = " \\param [in] numCompileOptions Length of the array \\p compileOptions"]
96 #[doc = " \\param [in] compileOptions Compiler options with which compilation should be done."]
97 #[doc = " The compiler options string is a null terminated character array."]
98 #[doc = " A valid list of compiler options is at"]
99 #[doc = " <a href=\"http://docs.nvidia.com/cuda/ptx-compiler-api/index.html#compile-options\">link</a>."]
100 #[doc = " \\note --gpu-name (-arch) is a mandatory option."]
101 #[doc = ""]
102 #[doc = " \\return"]
103 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
104 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_OUT_OF_MEMORY \\endlink"]
105 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
106 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
107 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_COMPILATION_FAILURE \\endlink"]
108 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_UNSUPPORTED_PTX_VERSION \\endlink"]
109 #[doc = ""]
110 pub fn nvPTXCompilerCompile(
111 compiler: nvPTXCompilerHandle,
112 numCompileOptions: ::std::os::raw::c_int,
113 compileOptions: *const *const ::std::os::raw::c_char,
114 ) -> nvPTXCompileResult;
115}
116extern "C" {
117 #[doc = " \\ingroup compilation"]
118 #[doc = ""]
119 #[doc = " \\brief Obtains the size of the image of the compiled program"]
120 #[doc = ""]
121 #[doc = " \\param [in] compiler A handle to PTX compiler on which nvPTXCompilerCompile() has been performed."]
122 #[doc = " \\param [out] binaryImageSize The size of the image of the compiled program"]
123 #[doc = ""]
124 #[doc = " \\return"]
125 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
126 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
127 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
128 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_COMPILER_INVOCATION_INCOMPLETE \\endlink"]
129 #[doc = ""]
130 #[doc = " \\note nvPTXCompilerCompile() API should be invoked for the handle before calling this API."]
131 #[doc = " Otherwise, NVPTXCOMPILE_ERROR_COMPILER_INVOCATION_INCOMPLETE is returned."]
132 pub fn nvPTXCompilerGetCompiledProgramSize(
133 compiler: nvPTXCompilerHandle,
134 binaryImageSize: *mut size_t,
135 ) -> nvPTXCompileResult;
136}
137extern "C" {
138 #[doc = " \\ingroup compilation"]
139 #[doc = ""]
140 #[doc = " \\brief Obtains the image of the compiled program"]
141 #[doc = ""]
142 #[doc = " \\param [in] compiler A handle to PTX compiler on which nvPTXCompilerCompile() has been performed."]
143 #[doc = " \\param [out] binaryImage The image of the compiled program."]
144 #[doc = " Client should allocate memory for \\p binaryImage"]
145 #[doc = ""]
146 #[doc = " \\return"]
147 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
148 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
149 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
150 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_COMPILER_INVOCATION_INCOMPLETE \\endlink"]
151 #[doc = ""]
152 #[doc = " \\note nvPTXCompilerCompile() API should be invoked for the handle before calling this API."]
153 #[doc = " Otherwise, NVPTXCOMPILE_ERROR_COMPILER_INVOCATION_INCOMPLETE is returned."]
154 #[doc = ""]
155 pub fn nvPTXCompilerGetCompiledProgram(
156 compiler: nvPTXCompilerHandle,
157 binaryImage: *mut ::std::os::raw::c_void,
158 ) -> nvPTXCompileResult;
159}
160extern "C" {
161 #[doc = " \\ingroup compilation"]
162 #[doc = ""]
163 #[doc = " \\brief Query the size of the error message that was seen previously for the handle"]
164 #[doc = ""]
165 #[doc = " \\param [in] compiler A handle to PTX compiler on which nvPTXCompilerCompile() has been performed."]
166 #[doc = " \\param [out] errorLogSize The size of the error log in bytes which was produced"]
167 #[doc = " in previous call to nvPTXCompilerCompiler()."]
168 #[doc = ""]
169 #[doc = " \\return"]
170 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
171 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
172 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
173 #[doc = ""]
174 pub fn nvPTXCompilerGetErrorLogSize(
175 compiler: nvPTXCompilerHandle,
176 errorLogSize: *mut size_t,
177 ) -> nvPTXCompileResult;
178}
179extern "C" {
180 #[doc = " \\ingroup compilation"]
181 #[doc = ""]
182 #[doc = " \\brief Query the error message that was seen previously for the handle"]
183 #[doc = ""]
184 #[doc = " \\param [in] compiler A handle to PTX compiler on which nvPTXCompilerCompile() has been performed."]
185 #[doc = " \\param [out] errorLog The error log which was produced in previous call to nvPTXCompilerCompiler()."]
186 #[doc = " Clients should allocate memory for \\p errorLog"]
187 #[doc = ""]
188 #[doc = " \\return"]
189 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
190 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
191 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
192 #[doc = ""]
193 pub fn nvPTXCompilerGetErrorLog(
194 compiler: nvPTXCompilerHandle,
195 errorLog: *mut ::std::os::raw::c_char,
196 ) -> nvPTXCompileResult;
197}
198extern "C" {
199 #[doc = " \\ingroup compilation"]
200 #[doc = ""]
201 #[doc = " \\brief Query the size of the information message that was seen previously for the handle"]
202 #[doc = ""]
203 #[doc = " \\param [in] compiler A handle to PTX compiler on which nvPTXCompilerCompile() has been performed."]
204 #[doc = " \\param [out] infoLogSize The size of the information log in bytes which was produced"]
205 #[doc = " in previous call to nvPTXCompilerCompiler()."]
206 #[doc = ""]
207 #[doc = " \\return"]
208 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
209 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
210 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
211 #[doc = ""]
212 pub fn nvPTXCompilerGetInfoLogSize(
213 compiler: nvPTXCompilerHandle,
214 infoLogSize: *mut size_t,
215 ) -> nvPTXCompileResult;
216}
217extern "C" {
218 #[doc = " \\ingroup compilation"]
219 #[doc = ""]
220 #[doc = " \\brief Query the information message that was seen previously for the handle"]
221 #[doc = ""]
222 #[doc = " \\param [in] compiler A handle to PTX compiler on which nvPTXCompilerCompile() has been performed."]
223 #[doc = " \\param [out] infoLog The information log which was produced in previous call to nvPTXCompilerCompiler()."]
224 #[doc = " Clients should allocate memory for \\p infoLog"]
225 #[doc = ""]
226 #[doc = " \\return"]
227 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_SUCCESS \\endlink"]
228 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INTERNAL \\endlink"]
229 #[doc = " - \\link #nvPTXCompileResult NVPTXCOMPILE_ERROR_INVALID_PROGRAM_HANDLE \\endlink"]
230 #[doc = ""]
231 pub fn nvPTXCompilerGetInfoLog(
232 compiler: nvPTXCompilerHandle,
233 infoLog: *mut ::std::os::raw::c_char,
234 ) -> nvPTXCompileResult;
235}
236pub type size_t = ::std::os::raw::c_ulonglong;