Skip to main content

singe_cuda_sys/
nvvm_sys_13040.rs

1/* automatically generated by rust-bindgen 0.72.1 */
2
3/// Unsigned C `size_t`, used for byte counts and object sizes in the native ABI.
4pub type size_t = ::core::ffi::c_ulong;
5impl nvvmResult {
6    /// The operation completed successfully.
7    pub const NVVM_SUCCESS: nvvmResult = nvvmResult(0);
8    /// NVVM could not allocate the required memory.
9    pub const NVVM_ERROR_OUT_OF_MEMORY: nvvmResult = nvvmResult(1);
10    /// NVVM could not create the program.
11    pub const NVVM_ERROR_PROGRAM_CREATION_FAILURE: nvvmResult = nvvmResult(2);
12    /// The input IR version is incompatible with the NVVM library.
13    pub const NVVM_ERROR_IR_VERSION_MISMATCH: nvvmResult = nvvmResult(3);
14    /// An input argument is invalid.
15    pub const NVVM_ERROR_INVALID_INPUT: nvvmResult = nvvmResult(4);
16    /// The program handle is invalid.
17    pub const NVVM_ERROR_INVALID_PROGRAM: nvvmResult = nvvmResult(5);
18    /// The input NVVM IR is invalid.
19    pub const NVVM_ERROR_INVALID_IR: nvvmResult = nvvmResult(6);
20    /// A compilation option is invalid.
21    pub const NVVM_ERROR_INVALID_OPTION: nvvmResult = nvvmResult(7);
22    /// The program contains no IR modules.
23    pub const NVVM_ERROR_NO_MODULE_IN_PROGRAM: nvvmResult = nvvmResult(8);
24    /// NVVM compilation failed; the program log contains diagnostics.
25    pub const NVVM_ERROR_COMPILATION: nvvmResult = nvvmResult(9);
26    /// The operation was cancelled.
27    pub const NVVM_ERROR_CANCELLED: nvvmResult = nvvmResult(10);
28}
29/// NVVM API call result code.
30#[repr(transparent)]
31#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
32pub struct nvvmResult(pub ::core::ffi::c_uint);
33singe_loader::functions! { crate::NVVM;
34    /// Get the message string for the given [`nvvmResult`] code.
35    ///
36    /// # Parameters
37    ///
38    /// - `result`: NVVM API result code.
39    ///
40    /// # Return value
41    ///
42    /// Message string for the given #nvvmResult code.
43    pub fn nvvmGetErrorString(result: nvvmResult) -> *const ::core::ffi::c_char;
44}
45singe_loader::functions! { crate::NVVM;
46    /// Get the NVVM version.
47    ///
48    /// # Parameters
49    ///
50    /// - `major`: NVVM major version number.
51    /// - `minor`: NVVM minor version number.
52    ///
53    /// # Return value
54    ///
55    /// - [`nvvmResult::NVVM_SUCCESS`]
56    pub fn nvvmVersion(
57        major: *mut ::core::ffi::c_int,
58        minor: *mut ::core::ffi::c_int,
59    ) -> nvvmResult;
60}
61singe_loader::functions! { crate::NVVM;
62    /// Get the NVVM IR version.
63    ///
64    /// # Parameters
65    ///
66    /// - `majorIR`: NVVM IR major version number.
67    /// - `minorIR`: NVVM IR minor version number.
68    /// - `majorDbg`: NVVM IR debug metadata major version number.
69    /// - `minorDbg`: NVVM IR debug metadata minor version number.
70    ///
71    /// # Return value
72    ///
73    /// - [`nvvmResult::NVVM_SUCCESS`]
74    pub fn nvvmIRVersion(
75        majorIR: *mut ::core::ffi::c_int,
76        minorIR: *mut ::core::ffi::c_int,
77        majorDbg: *mut ::core::ffi::c_int,
78        minorDbg: *mut ::core::ffi::c_int,
79    ) -> nvvmResult;
80}
81singe_loader::functions! { crate::NVVM;
82    /// Get the LLVM IR version guaranteed to be supported by NVVM.
83    ///
84    /// The valid arch strings are the ones supported by [`nvvmCompileProgram`].
85    ///
86    /// # Parameters
87    ///
88    /// - `arch`: Architecture string.
89    /// - `major`: IR version number.
90    ///
91    /// # Return value
92    ///
93    /// - [`nvvmResult::NVVM_SUCCESS`]
94    /// - [`nvvmResult::NVVM_ERROR_INVALID_INPUT`]
95    pub fn nvvmLLVMVersion(
96        arch: *const ::core::ffi::c_char,
97        major: *mut ::core::ffi::c_int,
98    ) -> nvvmResult;
99}
100/// Incomplete native type used by [`nvvmProgram`] handles. The native API owns its layout.
101#[repr(C)]
102#[derive(Debug, Copy, Clone)]
103pub struct _nvvmProgram {
104    _unused: [u8; 0],
105}
106/// NVVM Program.
107///
108/// An opaque handle for a program.
109pub type nvvmProgram = *mut _nvvmProgram;
110singe_loader::functions! { crate::NVVM;
111    /// Create a program, and set the value of its handle to `*prog`.
112    ///
113    /// # Parameters
114    ///
115    /// - `prog`: NVVM program.
116    ///
117    /// # Return value
118    ///
119    /// - [`nvvmResult::NVVM_SUCCESS`]
120    /// - [`nvvmResult::NVVM_ERROR_OUT_OF_MEMORY`]
121    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
122    pub fn nvvmCreateProgram(prog: *mut nvvmProgram) -> nvvmResult;
123}
124singe_loader::functions! { crate::NVVM;
125    /// Destroy a program.
126    ///
127    /// # Parameters
128    ///
129    /// - `prog`: NVVM program.
130    ///
131    /// # Return value
132    ///
133    /// - [`nvvmResult::NVVM_SUCCESS`]
134    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
135    pub fn nvvmDestroyProgram(prog: *mut nvvmProgram) -> nvvmResult;
136}
137singe_loader::functions! { crate::NVVM;
138    /// Add a module level NVVM IR to a program.
139    ///
140    /// The `buffer` should contain an NVVM IR module. The module should have NVVM IR either in the LLVM 7.0.1 bitcode representation or in the LLVM 7.0.1 text representation. Support for reading the text representation of NVVM IR is deprecated and may be removed in a later version.
141    ///
142    /// # Parameters
143    ///
144    /// - `prog`: NVVM program.
145    /// - `buffer`: NVVM IR module in the bitcode or text representation.
146    /// - `size`: Size of the NVVM IR module.
147    /// - `name`: Name of the NVVM IR module. If NULL, “<unnamed>” is used as the name.
148    ///
149    /// # Return value
150    ///
151    /// - [`nvvmResult::NVVM_SUCCESS`]
152    /// - [`nvvmResult::NVVM_ERROR_OUT_OF_MEMORY`]
153    /// - [`nvvmResult::NVVM_ERROR_INVALID_INPUT`]
154    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
155    pub fn nvvmAddModuleToProgram(
156        prog: nvvmProgram,
157        buffer: *const ::core::ffi::c_char,
158        size: size_t,
159        name: *const ::core::ffi::c_char,
160    ) -> nvvmResult;
161}
162singe_loader::functions! { crate::NVVM;
163    /// Add a module level NVVM IR to a program.
164    ///
165    /// The `buffer` should contain an NVVM IR module. The module should have NVVM IR in the LLVM 7.0.1 bitcode representation.
166    ///
167    /// A module added using this API is lazily loaded - the only symbols loaded are those that are required by module(s) loaded using nvvmAddModuleToProgram. It is an error for a program to have all modules loaded using this API. Compiler may also optimize entities in this module by making them internal to the linked NVVM IR module, making them eligible for other optimizations. Due to these optimizations, this API to load a module is more efficient and should be used where possible.
168    ///
169    /// # Parameters
170    ///
171    /// - `prog`: NVVM program.
172    /// - `buffer`: NVVM IR module in the bitcode representation.
173    /// - `size`: Size of the NVVM IR module.
174    /// - `name`: Name of the NVVM IR module. If NULL, “<unnamed>” is used as the name.
175    ///
176    /// # Return value
177    ///
178    /// - [`nvvmResult::NVVM_SUCCESS`]
179    /// - [`nvvmResult::NVVM_ERROR_OUT_OF_MEMORY`]
180    /// - [`nvvmResult::NVVM_ERROR_INVALID_INPUT`]
181    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
182    pub fn nvvmLazyAddModuleToProgram(
183        prog: nvvmProgram,
184        buffer: *const ::core::ffi::c_char,
185        size: size_t,
186        name: *const ::core::ffi::c_char,
187    ) -> nvvmResult;
188}
189singe_loader::functions! { crate::NVVM;
190    /// Compile the NVVM program.
191    ///
192    /// The NVVM IR modules in the program will be linked at the IR level. The linked IR program is compiled to PTX.
193    ///
194    /// The target datalayout in the linked IR program is used to determine the address size (32bit vs 64bit).
195    ///
196    /// The valid compiler options are:
197    ///
198    /// * -g (enable generation of full debugging information). Full debug support is only valid with ‘-opt=0’. Debug support requires the input module to utilize NVVM IR Debug Metadata. Line number (line info) only generation is also enabled via NVVM IR Debug Metadata, there is no specific libNVVM API flag for that case.
199    /// * -opt=
200    ///
201    ///   + 0 (disable optimizations)
202    ///   + 3 (default, enable optimizations)
203    /// * -arch=
204    ///
205    ///   + compute_75 (default)
206    ///   + compute_80
207    ///   + compute_87
208    ///   + compute_89
209    ///   + compute_90
210    ///   + compute_90a
211    ///   + compute_100
212    ///   + compute_100a
213    ///   + compute_100f
214    ///   + compute_103
215    ///   + compute_103a
216    ///   + compute_103f
217    ///   + compute_110
218    ///   + compute_110a
219    ///   + compute_110f
220    ///   + compute_120
221    ///   + compute_120a
222    ///   + compute_120f
223    ///   + compute_121
224    ///   + compute_121a
225    ///   + compute_121f
226    /// * -ftz=
227    ///
228    ///   + 0 (default, preserve denormal values, when performing single-precision floating-point operations)
229    ///   + 1 (flush denormal values to zero, when performing single-precision floating-point operations)
230    /// * -prec-sqrt=
231    ///
232    ///   + 0 (use a faster approximation for single-precision floating-point square root)
233    ///   + 1 (default, use IEEE round-to-nearest mode for single-precision floating-point square root)
234    /// * -prec-div=
235    ///
236    ///   + 0 (use a faster approximation for single-precision floating-point division and reciprocals)
237    ///   + 1 (default, use IEEE round-to-nearest mode for single-precision floating-point division and reciprocals)
238    /// * -fma=
239    ///
240    ///   + 0 (disable FMA contraction)
241    ///   + 1 (default, enable FMA contraction)
242    /// * -jump-table-density=\[0-101\] Specify the case density percentage in switch statements, and use it as a minimal threshold to determine whether jump table(brx.idx instruction) will be used to implement a switch statement. Default value is 101. The percentage ranges from 0 to 101 inclusively.
243    /// * -gen-lto (Generate LTO IR instead of PTX).
244    /// * -ptx-version-target=\[86-94\] Specify the target PTX version as (MAJOR VERSION \* 10 + MINOR VERSION). This is supported only for Blackwell and later architectures (compute capability compute_100 or greater). Using this option implies that the operations in incoming `prog` are compliant with targeted PTX version. If not set, highest available PTX version is used.
245    ///
246    /// # Parameters
247    ///
248    /// - `prog`: NVVM program.
249    /// - `numOptions`: Number of compiler options passed.
250    /// - `options`: Compiler options in the form of C string array.
251    ///
252    /// # Return value
253    ///
254    /// - [`nvvmResult::NVVM_SUCCESS`]
255    /// - [`nvvmResult::NVVM_ERROR_OUT_OF_MEMORY`]
256    /// - [`nvvmResult::NVVM_ERROR_IR_VERSION_MISMATCH`]
257    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
258    /// - [`nvvmResult::NVVM_ERROR_INVALID_OPTION`]
259    /// - [`nvvmResult::NVVM_ERROR_NO_MODULE_IN_PROGRAM`]
260    /// - [`nvvmResult::NVVM_ERROR_COMPILATION`]
261    pub fn nvvmCompileProgram(
262        prog: nvvmProgram,
263        numOptions: ::core::ffi::c_int,
264        options: *mut *const ::core::ffi::c_char,
265    ) -> nvvmResult;
266}
267singe_loader::functions! { crate::NVVM;
268    /// Verify the NVVM program.
269    ///
270    /// The valid compiler options are:
271    ///
272    /// Same as for [`nvvmCompileProgram`].
273    ///
274    /// # Parameters
275    ///
276    /// - `prog`: NVVM program.
277    /// - `numOptions`: Number of compiler options passed.
278    /// - `options`: Compiler options in the form of C string array.
279    ///
280    /// # Return value
281    ///
282    /// - [`nvvmResult::NVVM_SUCCESS`]
283    /// - [`nvvmResult::NVVM_ERROR_OUT_OF_MEMORY`]
284    /// - [`nvvmResult::NVVM_ERROR_IR_VERSION_MISMATCH`]
285    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
286    /// - [`nvvmResult::NVVM_ERROR_INVALID_IR`]
287    /// - [`nvvmResult::NVVM_ERROR_INVALID_OPTION`]
288    /// - [`nvvmResult::NVVM_ERROR_NO_MODULE_IN_PROGRAM`]
289    pub fn nvvmVerifyProgram(
290        prog: nvvmProgram,
291        numOptions: ::core::ffi::c_int,
292        options: *mut *const ::core::ffi::c_char,
293    ) -> nvvmResult;
294}
295singe_loader::functions! { crate::NVVM;
296    /// Get the size of the compiled result.
297    ///
298    /// # Parameters
299    ///
300    /// - `prog`: NVVM program.
301    /// - `bufferSizeRet`: Size of the compiled result (including the trailing NULL).
302    ///
303    /// # Return value
304    ///
305    /// - [`nvvmResult::NVVM_SUCCESS`]
306    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
307    pub fn nvvmGetCompiledResultSize(
308        prog: nvvmProgram,
309        bufferSizeRet: *mut size_t,
310    ) -> nvvmResult;
311}
312singe_loader::functions! { crate::NVVM;
313    /// Get the compiled result.
314    ///
315    /// The result is stored in the memory pointed to by `buffer`.
316    ///
317    /// # Parameters
318    ///
319    /// - `prog`: NVVM program.
320    /// - `buffer`: Compiled result.
321    ///
322    /// # Return value
323    ///
324    /// - [`nvvmResult::NVVM_SUCCESS`]
325    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
326    pub fn nvvmGetCompiledResult(
327        prog: nvvmProgram,
328        buffer: *mut ::core::ffi::c_char,
329    ) -> nvvmResult;
330}
331singe_loader::functions! { crate::NVVM;
332    /// Get the Size of Compiler/Verifier Message.
333    ///
334    /// The size of the message string (including the trailing NULL) is stored into `bufferSizeRet` when the return value is [`nvvmResult::NVVM_SUCCESS`].
335    ///
336    /// # Parameters
337    ///
338    /// - `prog`: NVVM program.
339    /// - `bufferSizeRet`: Size of the compilation/verification log (including the trailing NULL).
340    ///
341    /// # Return value
342    ///
343    /// - [`nvvmResult::NVVM_SUCCESS`]
344    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
345    pub fn nvvmGetProgramLogSize(
346        prog: nvvmProgram,
347        bufferSizeRet: *mut size_t,
348    ) -> nvvmResult;
349}
350singe_loader::functions! { crate::NVVM;
351    /// Get the Compiler/Verifier Message.
352    ///
353    /// The NULL terminated message string is stored in the memory pointed to by `buffer` when the return value is [`nvvmResult::NVVM_SUCCESS`].
354    ///
355    /// # Parameters
356    ///
357    /// - `prog`: NVVM program.
358    /// - `buffer`: Compilation/Verification log.
359    ///
360    /// # Return value
361    ///
362    /// - [`nvvmResult::NVVM_SUCCESS`]
363    /// - [`nvvmResult::NVVM_ERROR_INVALID_PROGRAM`]
364    pub fn nvvmGetProgramLog(
365        prog: nvvmProgram,
366        buffer: *mut ::core::ffi::c_char,
367    ) -> nvvmResult;
368}