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    pub fn nvvmGetErrorString(result: nvvmResult) -> *const ::core::ffi::c_char;
40}
41singe_loader::functions! { crate::NVVM;
42    /// Get the NVVM version.
43    ///
44    /// # Parameters
45    ///
46    /// - `major`: NVVM major version number.
47    /// - `minor`: NVVM minor version number.
48    pub fn nvvmVersion(
49        major: *mut ::core::ffi::c_int,
50        minor: *mut ::core::ffi::c_int,
51    ) -> nvvmResult;
52}
53singe_loader::functions! { crate::NVVM;
54    /// Get the NVVM IR version.
55    ///
56    /// # Parameters
57    ///
58    /// - `majorIR`: NVVM IR major version number.
59    /// - `minorIR`: NVVM IR minor version number.
60    /// - `majorDbg`: NVVM IR debug metadata major version number.
61    /// - `minorDbg`: NVVM IR debug metadata minor version number.
62    pub fn nvvmIRVersion(
63        majorIR: *mut ::core::ffi::c_int,
64        minorIR: *mut ::core::ffi::c_int,
65        majorDbg: *mut ::core::ffi::c_int,
66        minorDbg: *mut ::core::ffi::c_int,
67    ) -> nvvmResult;
68}
69singe_loader::functions! { crate::NVVM;
70    /// Get the LLVM IR version guaranteed to be supported by NVVM.
71    ///
72    /// The valid arch strings are the ones supported by [`nvvmCompileProgram`].
73    ///
74    /// # Parameters
75    ///
76    /// - `arch`: Architecture string.
77    /// - `major`: IR version number.
78    pub fn nvvmLLVMVersion(
79        arch: *const ::core::ffi::c_char,
80        major: *mut ::core::ffi::c_int,
81    ) -> nvvmResult;
82}
83/// Incomplete native type used by [`nvvmProgram`] handles. The native API owns its layout.
84#[repr(C)]
85#[derive(Debug, Copy, Clone)]
86pub struct _nvvmProgram {
87    _unused: [u8; 0],
88}
89/// NVVM Program.
90///
91/// An opaque handle for a program.
92pub type nvvmProgram = *mut _nvvmProgram;
93singe_loader::functions! { crate::NVVM;
94    /// Create a program, and set the value of its handle to `*prog`.
95    ///
96    /// # Parameters
97    ///
98    /// - `prog`: NVVM program.
99    pub fn nvvmCreateProgram(prog: *mut nvvmProgram) -> nvvmResult;
100}
101singe_loader::functions! { crate::NVVM;
102    /// Destroy a program.
103    ///
104    /// # Parameters
105    ///
106    /// - `prog`: NVVM program.
107    pub fn nvvmDestroyProgram(prog: *mut nvvmProgram) -> nvvmResult;
108}
109singe_loader::functions! { crate::NVVM;
110    /// Add a module level NVVM IR to a program.
111    ///
112    /// 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.
113    ///
114    /// # Parameters
115    ///
116    /// - `prog`: NVVM program.
117    /// - `buffer`: NVVM IR module in the bitcode or text representation.
118    /// - `size`: Size of the NVVM IR module.
119    /// - `name`: Name of the NVVM IR module. If NULL, “<unnamed>” is used as the name.
120    pub fn nvvmAddModuleToProgram(
121        prog: nvvmProgram,
122        buffer: *const ::core::ffi::c_char,
123        size: size_t,
124        name: *const ::core::ffi::c_char,
125    ) -> nvvmResult;
126}
127singe_loader::functions! { crate::NVVM;
128    /// Add a module level NVVM IR to a program.
129    ///
130    /// The `buffer` should contain an NVVM IR module. The module should have NVVM IR in the LLVM 7.0.1 bitcode representation.
131    ///
132    /// 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.
133    ///
134    /// # Parameters
135    ///
136    /// - `prog`: NVVM program.
137    /// - `buffer`: NVVM IR module in the bitcode representation.
138    /// - `size`: Size of the NVVM IR module.
139    /// - `name`: Name of the NVVM IR module. If NULL, “<unnamed>” is used as the name.
140    pub fn nvvmLazyAddModuleToProgram(
141        prog: nvvmProgram,
142        buffer: *const ::core::ffi::c_char,
143        size: size_t,
144        name: *const ::core::ffi::c_char,
145    ) -> nvvmResult;
146}
147singe_loader::functions! { crate::NVVM;
148    /// Compile the NVVM program.
149    ///
150    /// The NVVM IR modules in the program will be linked at the IR level. The linked IR program is compiled to PTX.
151    ///
152    /// The target datalayout in the linked IR program is used to determine the address size (32bit vs 64bit).
153    ///
154    /// The valid compiler options are:
155    ///
156    /// * -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.
157    /// * -opt=
158    ///
159    ///   + 0 (disable optimizations)
160    ///   + 3 (default, enable optimizations)
161    /// * -arch=
162    ///
163    ///   + compute_75 (default)
164    ///   + compute_80
165    ///   + compute_87
166    ///   + compute_89
167    ///   + compute_90
168    ///   + compute_90a
169    ///   + compute_100
170    ///   + compute_100a
171    ///   + compute_100f
172    ///   + compute_103
173    ///   + compute_103a
174    ///   + compute_103f
175    ///   + compute_110
176    ///   + compute_110a
177    ///   + compute_110f
178    ///   + compute_120
179    ///   + compute_120a
180    ///   + compute_120f
181    ///   + compute_121
182    ///   + compute_121a
183    ///   + compute_121f
184    /// * -ftz=
185    ///
186    ///   + 0 (default, preserve denormal values, when performing single-precision floating-point operations)
187    ///   + 1 (flush denormal values to zero, when performing single-precision floating-point operations)
188    /// * -prec-sqrt=
189    ///
190    ///   + 0 (use a faster approximation for single-precision floating-point square root)
191    ///   + 1 (default, use IEEE round-to-nearest mode for single-precision floating-point square root)
192    /// * -prec-div=
193    ///
194    ///   + 0 (use a faster approximation for single-precision floating-point division and reciprocals)
195    ///   + 1 (default, use IEEE round-to-nearest mode for single-precision floating-point division and reciprocals)
196    /// * -fma=
197    ///
198    ///   + 0 (disable FMA contraction)
199    ///   + 1 (default, enable FMA contraction)
200    /// * -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.
201    /// * -gen-lto (Generate LTO IR instead of PTX).
202    /// * -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.
203    ///
204    /// # Parameters
205    ///
206    /// - `prog`: NVVM program.
207    /// - `numOptions`: Number of compiler options passed.
208    /// - `options`: Compiler options in the form of C string array.
209    pub fn nvvmCompileProgram(
210        prog: nvvmProgram,
211        numOptions: ::core::ffi::c_int,
212        options: *mut *const ::core::ffi::c_char,
213    ) -> nvvmResult;
214}
215singe_loader::functions! { crate::NVVM;
216    /// Verify the NVVM program.
217    ///
218    /// The valid compiler options are:
219    ///
220    /// Same as for [`nvvmCompileProgram`].
221    ///
222    /// # Parameters
223    ///
224    /// - `prog`: NVVM program.
225    /// - `numOptions`: Number of compiler options passed.
226    /// - `options`: Compiler options in the form of C string array.
227    pub fn nvvmVerifyProgram(
228        prog: nvvmProgram,
229        numOptions: ::core::ffi::c_int,
230        options: *mut *const ::core::ffi::c_char,
231    ) -> nvvmResult;
232}
233singe_loader::functions! { crate::NVVM;
234    /// Get the size of the compiled result.
235    ///
236    /// # Parameters
237    ///
238    /// - `prog`: NVVM program.
239    /// - `bufferSizeRet`: Size of the compiled result (including the trailing NULL).
240    pub fn nvvmGetCompiledResultSize(
241        prog: nvvmProgram,
242        bufferSizeRet: *mut size_t,
243    ) -> nvvmResult;
244}
245singe_loader::functions! { crate::NVVM;
246    /// Get the compiled result.
247    ///
248    /// The result is stored in the memory pointed to by `buffer`.
249    ///
250    /// # Parameters
251    ///
252    /// - `prog`: NVVM program.
253    /// - `buffer`: Compiled result.
254    pub fn nvvmGetCompiledResult(
255        prog: nvvmProgram,
256        buffer: *mut ::core::ffi::c_char,
257    ) -> nvvmResult;
258}
259singe_loader::functions! { crate::NVVM;
260    /// Get the Size of Compiler/Verifier Message.
261    ///
262    /// The size of the message string (including the trailing NULL) is stored into `bufferSizeRet` when the return value is [`nvvmResult::NVVM_SUCCESS`].
263    ///
264    /// # Parameters
265    ///
266    /// - `prog`: NVVM program.
267    /// - `bufferSizeRet`: Size of the compilation/verification log (including the trailing NULL).
268    pub fn nvvmGetProgramLogSize(
269        prog: nvvmProgram,
270        bufferSizeRet: *mut size_t,
271    ) -> nvvmResult;
272}
273singe_loader::functions! { crate::NVVM;
274    /// Get the Compiler/Verifier Message.
275    ///
276    /// The NULL terminated message string is stored in the memory pointed to by `buffer` when the return value is [`nvvmResult::NVVM_SUCCESS`].
277    ///
278    /// # Parameters
279    ///
280    /// - `prog`: NVVM program.
281    /// - `buffer`: Compilation/Verification log.
282    pub fn nvvmGetProgramLog(
283        prog: nvvmProgram,
284        buffer: *mut ::core::ffi::c_char,
285    ) -> nvvmResult;
286}