1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
pub const nvvmResult_NVVM_SUCCESS: nvvmResult = 0;
pub const nvvmResult_NVVM_ERROR_OUT_OF_MEMORY: nvvmResult = 1;
pub const nvvmResult_NVVM_ERROR_PROGRAM_CREATION_FAILURE: nvvmResult = 2;
pub const nvvmResult_NVVM_ERROR_IR_VERSION_MISMATCH: nvvmResult = 3;
pub const nvvmResult_NVVM_ERROR_INVALID_INPUT: nvvmResult = 4;
pub const nvvmResult_NVVM_ERROR_INVALID_PROGRAM: nvvmResult = 5;
pub const nvvmResult_NVVM_ERROR_INVALID_IR: nvvmResult = 6;
pub const nvvmResult_NVVM_ERROR_INVALID_OPTION: nvvmResult = 7;
pub const nvvmResult_NVVM_ERROR_NO_MODULE_IN_PROGRAM: nvvmResult = 8;
pub const nvvmResult_NVVM_ERROR_COMPILATION: nvvmResult = 9;
#[doc = " \\ingroup error"]
#[doc = " \\brief NVVM API call result code."]
pub type nvvmResult = ::std::os::raw::c_int;
extern "C" {
#[doc = " \\ingroup error"]
#[doc = " \\brief Get the message string for the given #nvvmResult code."]
#[doc = ""]
#[doc = " \\param [in] result NVVM API result code."]
#[doc = " \\return Message string for the given #nvvmResult code."]
pub fn nvvmGetErrorString(result: nvvmResult) -> *const ::std::os::raw::c_char;
}
extern "C" {
#[doc = " \\ingroup query"]
#[doc = " \\brief Get the NVVM version."]
#[doc = ""]
#[doc = " \\param [out] major NVVM major version number."]
#[doc = " \\param [out] minor NVVM minor version number."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = ""]
pub fn nvvmVersion(
major: *mut ::std::os::raw::c_int,
minor: *mut ::std::os::raw::c_int,
) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup query"]
#[doc = " \\brief Get the NVVM IR version."]
#[doc = ""]
#[doc = " \\param [out] majorIR NVVM IR major version number."]
#[doc = " \\param [out] minorIR NVVM IR minor version number."]
#[doc = " \\param [out] majorDbg NVVM IR debug metadata major version number."]
#[doc = " \\param [out] minorDbg NVVM IR debug metadata minor version number."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = ""]
pub fn nvvmIRVersion(
majorIR: *mut ::std::os::raw::c_int,
minorIR: *mut ::std::os::raw::c_int,
majorDbg: *mut ::std::os::raw::c_int,
minorDbg: *mut ::std::os::raw::c_int,
) -> nvvmResult;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _nvvmProgram {
_unused: [u8; 0],
}
#[doc = " \\ingroup compilation"]
#[doc = " \\brief NVVM Program"]
#[doc = ""]
#[doc = " An opaque handle for a program"]
pub type nvvmProgram = *mut _nvvmProgram;
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Create a program, and set the value of its handle to *prog."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
#[doc = ""]
#[doc = " \\see nvvmDestroyProgram()"]
pub fn nvvmCreateProgram(prog: *mut nvvmProgram) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Destroy a program."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
#[doc = ""]
#[doc = " \\see nvvmCreateProgram()"]
pub fn nvvmDestroyProgram(prog: *mut nvvmProgram) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Add a module level NVVM IR to a program."]
#[doc = ""]
#[doc = " The buffer should contain an NVVM IR module."]
#[doc = " The module should have NVVM IR version 1.6 either in the LLVM 7.0.1 bitcode"]
#[doc = " representation or in the LLVM 7.0.1 text representation. Support for reading"]
#[doc = " the text representation of NVVM IR is deprecated and may be removed in a"]
#[doc = " later version."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\param [in] buffer NVVM IR module in the bitcode or text"]
#[doc = " representation."]
#[doc = " \\param [in] size Size of the NVVM IR module."]
#[doc = " \\param [in] name Name of the NVVM IR module."]
#[doc = " If NULL, \"<unnamed>\" is used as the name."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_INPUT \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
pub fn nvvmAddModuleToProgram(
prog: nvvmProgram,
buffer: *const ::std::os::raw::c_char,
size: size_t,
name: *const ::std::os::raw::c_char,
) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Add a module level NVVM IR to a program."]
#[doc = ""]
#[doc = " The buffer should contain an NVVM IR module. The module should have NVVM IR"]
#[doc = " version 1.6 in LLVM 7.0.1 bitcode representation."]
#[doc = ""]
#[doc = " A module added using this API is lazily loaded - the only symbols loaded"]
#[doc = " are those that are required by module(s) loaded using"]
#[doc = " nvvmAddModuleToProgram. It is an error for a program to have"]
#[doc = " all modules loaded using this API. Compiler may also optimize entities"]
#[doc = " in this module by making them internal to the linked NVVM IR module,"]
#[doc = " making them eligible for other optimizations. Due to these"]
#[doc = " optimizations, this API to load a module is more efficient and should"]
#[doc = " be used where possible."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\param [in] buffer NVVM IR module in the bitcode representation."]
#[doc = " \\param [in] size Size of the NVVM IR module."]
#[doc = " \\param [in] name Name of the NVVM IR module."]
#[doc = " If NULL, \"<unnamed>\" is used as the name."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_INPUT \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
pub fn nvvmLazyAddModuleToProgram(
prog: nvvmProgram,
buffer: *const ::std::os::raw::c_char,
size: size_t,
name: *const ::std::os::raw::c_char,
) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Compile the NVVM program."]
#[doc = ""]
#[doc = " The NVVM IR modules in the program will be linked at the IR level."]
#[doc = " The linked IR program is compiled to PTX."]
#[doc = ""]
#[doc = " The target datalayout in the linked IR program is used to"]
#[doc = " determine the address size (32bit vs 64bit)."]
#[doc = ""]
#[doc = " The valid compiler options are:"]
#[doc = ""]
#[doc = " - -g (enable generation of debugging information, valid only with -opt=0)"]
#[doc = " - -generate-line-info (generate line number information)"]
#[doc = " - -opt="]
#[doc = " - 0 (disable optimizations)"]
#[doc = " - 3 (default, enable optimizations)"]
#[doc = " - -arch="]
#[doc = " - compute_35"]
#[doc = " - compute_37"]
#[doc = " - compute_50"]
#[doc = " - compute_52 (default)"]
#[doc = " - compute_53"]
#[doc = " - compute_60"]
#[doc = " - compute_61"]
#[doc = " - compute_62"]
#[doc = " - compute_70"]
#[doc = " - compute_72"]
#[doc = " - compute_75"]
#[doc = " - compute_80"]
#[doc = " - -ftz="]
#[doc = " - 0 (default, preserve denormal values, when performing"]
#[doc = " single-precision floating-point operations)"]
#[doc = " - 1 (flush denormal values to zero, when performing"]
#[doc = " single-precision floating-point operations)"]
#[doc = " - -prec-sqrt="]
#[doc = " - 0 (use a faster approximation for single-precision"]
#[doc = " floating-point square root)"]
#[doc = " - 1 (default, use IEEE round-to-nearest mode for"]
#[doc = " single-precision floating-point square root)"]
#[doc = " - -prec-div="]
#[doc = " - 0 (use a faster approximation for single-precision"]
#[doc = " floating-point division and reciprocals)"]
#[doc = " - 1 (default, use IEEE round-to-nearest mode for"]
#[doc = " single-precision floating-point division and reciprocals)"]
#[doc = " - -fma="]
#[doc = " - 0 (disable FMA contraction)"]
#[doc = " - 1 (default, enable FMA contraction)"]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\param [in] numOptions Number of compiler options passed."]
#[doc = " \\param [in] options Compiler options in the form of C string array."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_IR_VERSION_MISMATCH \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_OPTION \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_NO_MODULE_IN_PROGRAM \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_COMPILATION \\endlink"]
pub fn nvvmCompileProgram(
prog: nvvmProgram,
numOptions: ::std::os::raw::c_int,
options: *mut *const ::std::os::raw::c_char,
) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Verify the NVVM program."]
#[doc = ""]
#[doc = " The valid compiler options are:"]
#[doc = ""]
#[doc = " Same as for nvvmCompileProgram()."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\param [in] numOptions Number of compiler options passed."]
#[doc = " \\param [in] options Compiler options in the form of C string array."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_OUT_OF_MEMORY \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_IR_VERSION_MISMATCH \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_IR \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_OPTION \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_NO_MODULE_IN_PROGRAM \\endlink"]
#[doc = ""]
#[doc = " \\see nvvmCompileProgram()"]
pub fn nvvmVerifyProgram(
prog: nvvmProgram,
numOptions: ::std::os::raw::c_int,
options: *mut *const ::std::os::raw::c_char,
) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Get the size of the compiled result."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\param [out] bufferSizeRet Size of the compiled result (including the"]
#[doc = " trailing NULL)."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
pub fn nvvmGetCompiledResultSize(prog: nvvmProgram, bufferSizeRet: *mut size_t) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Get the compiled result."]
#[doc = ""]
#[doc = " The result is stored in the memory pointed by 'buffer'."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\param [out] buffer Compiled result."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
pub fn nvvmGetCompiledResult(
prog: nvvmProgram,
buffer: *mut ::std::os::raw::c_char,
) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Get the Size of Compiler/Verifier Message."]
#[doc = ""]
#[doc = " The size of the message string (including the trailing NULL) is stored into"]
#[doc = " 'buffer_size_ret' when the return value is NVVM_SUCCESS."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program."]
#[doc = " \\param [out] bufferSizeRet Size of the compilation/verification log"]
#[doc = "(including the trailing NULL)."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
pub fn nvvmGetProgramLogSize(prog: nvvmProgram, bufferSizeRet: *mut size_t) -> nvvmResult;
}
extern "C" {
#[doc = " \\ingroup compilation"]
#[doc = " \\brief Get the Compiler/Verifier Message"]
#[doc = ""]
#[doc = " The NULL terminated message string is stored in the memory pointed by"]
#[doc = " 'buffer' when the return value is NVVM_SUCCESS."]
#[doc = ""]
#[doc = " \\param [in] prog NVVM program program."]
#[doc = " \\param [out] buffer Compilation/Verification log."]
#[doc = " \\return"]
#[doc = " - \\link ::nvvmResult NVVM_SUCCESS \\endlink"]
#[doc = " - \\link ::nvvmResult NVVM_ERROR_INVALID_PROGRAM \\endlink"]
pub fn nvvmGetProgramLog(prog: nvvmProgram, buffer: *mut ::std::os::raw::c_char) -> nvvmResult;
}
pub type size_t = ::std::os::raw::c_ulonglong;