nvidia-libmathdx-cu13 0.4.2.37__py3-none-win_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,596 @@
1
+ // Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ //
3
+ // NVIDIA CORPORATION and its licensors retain all intellectual property
4
+ // and proprietary rights in and to this software, related documentation
5
+ // and any modifications thereto. Any use, reproduction, disclosure or
6
+ // distribution of this software and related documentation without an express
7
+ // license agreement from NVIDIA CORPORATION is strictly prohibited.
8
+
9
+ // libmathdx's API is subject to change.
10
+ // Please contact Math-Libs-Feedback@nvidia.com for usage feedback.
11
+
12
+ #ifndef MATHDX_LIBCOMMONDX_H
13
+ #define MATHDX_LIBCOMMONDX_H
14
+
15
+ #include <stddef.h>
16
+
17
+ #if defined(__cplusplus)
18
+ extern "C" {
19
+ #endif /* __cplusplus */
20
+
21
+ #ifndef LIBMATHDX_API
22
+ #if __GNUC__ >= 4
23
+ #define LIBMATHDX_API __attribute__((visibility("default")))
24
+ #else
25
+ #define LIBMATHDX_API
26
+ #endif
27
+ #endif
28
+
29
+ #ifndef LIBMATHDX_CALL
30
+ #ifdef _WIN32
31
+ #define LIBMATHDX_CALL __stdcall
32
+ #else
33
+ #define LIBMATHDX_CALL
34
+ #endif
35
+ #endif
36
+
37
+ #ifdef __cplusplus
38
+ #ifndef LIBMATHDX_API_NOEXCEPT
39
+ #define LIBMATHDX_API_NOEXCEPT noexcept
40
+ #endif
41
+ #else
42
+ #define LIBMATHDX_API_NOEXCEPT
43
+ #endif
44
+
45
+ /**
46
+ * @brief A handle to some compiled code.
47
+ *
48
+ * Compiled code generally contains one or more device function, and is specified by
49
+ * the code type (e.g. SASS, PTX, LTO - \ref commondxCodeContainer_t) and the compute capability
50
+ * (in the form of an integer, e.g. 800 for CC 8.0).
51
+ *
52
+ * Compiled code can be genrated by a call to \ref cublasdxFinalizeCode,
53
+ * \ref cufftdxFinalizeCode or \ref cusolverdxFinalizeCode.
54
+ */
55
+ typedef long long int commondxCode;
56
+
57
+ /**
58
+ * @brief The set of value types supported by the library.
59
+ *
60
+ * Note that, for complex numbers, this combines real and imaginary part,
61
+ * and that all complex numbers are overaligned on their size.
62
+ */
63
+ typedef enum commondxValueType_t {
64
+ /** Equivalent to __nv_fp8_e5m2. Size: 1B, alignment: 1B */
65
+ COMMONDX_R_8F_E5M2 = 0,
66
+ /** Equivalent to 2x__nv_fp8_e5m2. Size: 2B, alignment: 2B (overaligned) */
67
+ COMMONDX_C_8F_E5M2 = 1,
68
+ /** Equivalent to __nv_fp8_e4m3. Size: 1B, alignment: 1B */
69
+ COMMONDX_R_8F_E4M3 = 2,
70
+ /** Equivalent to 2x__nv_fp8_e4m3. Size: 2B, alignment: 2B (overaligned) */
71
+ COMMONDX_C_8F_E4M3 = 3,
72
+ /** Equivalent to __nv_bfloat16. Size: 2B, alignment: 2B */
73
+ COMMONDX_R_16BF = 4,
74
+ /** Equivalent to 2x__nv_bfloat16. Size: 4B, alignment: 4B (overaligned) */
75
+ COMMONDX_C_16BF = 5,
76
+ /** Equivalent to __half2. Size: 4B, alignment: 4B */
77
+ COMMONDX_R_16F2 = 6,
78
+ /** Equivalent to __half. Size: 2B, alignment: 2B */
79
+ COMMONDX_R_16F = 7,
80
+ /** Equivalent to 2x__half. Size: 4B, alignment: 4B (overaligned) */
81
+ COMMONDX_C_16F = 8,
82
+ /** Equivalent to 2x__half2. Size: 8B, alignment: 8B (overaligned) */
83
+ COMMONDX_C_16F2 = 9,
84
+ /** Equivalent to tf32. Size: 4B, alignment: 4B */
85
+ COMMONDX_R_32TF = 10,
86
+ /** Equivalent to 2xtf32. Size: 8B, alignment: 8B (overaligned) */
87
+ COMMONDX_C_32TF = 11,
88
+ /** Equivalent to float. Size: 4B, alignment: 4B */
89
+ COMMONDX_R_32F = 12,
90
+ /** Equivalent to 2xfloat. Size: 8B, alignment: 8B (overaligned) */
91
+ COMMONDX_C_32F = 13,
92
+ /** Equivalent to double. Size: 8B, alignment: 8B */
93
+ COMMONDX_R_64F = 14,
94
+ /** Equivalent to 2xdouble. Size: 16B, alignment: 16B (overaligned) */
95
+ COMMONDX_C_64F = 15,
96
+ /** Equivalent to int8_t. Size 1B, alignment: 1B */
97
+ COMMONDX_R_8I = 16,
98
+ /** Equivalent to 2xint8_t. Size 2B, alignment: 2B (overaligned) */
99
+ COMMONDX_C_8I = 17,
100
+ /** Equivalent to int16_t. Size 2B, alignment: 2B */
101
+ COMMONDX_R_16I = 18,
102
+ /** Equivalent to 2xint16_t. Size 4B, alignment: 4B (overaligned) */
103
+ COMMONDX_C_16I = 19,
104
+ /** Equivalent to int32_t. Size 4B, alignment: 4B */
105
+ COMMONDX_R_32I = 20,
106
+ /** Equivalent to 2xint32_t. Size 8B, alignment: 8B (overaligned)*/
107
+ COMMONDX_C_32I = 21,
108
+ /** Equivalent to int64_t. Size 8B, alignment: 8B */
109
+ COMMONDX_R_64I = 22,
110
+ /** Equivalent to 2xint64_t. Size 16B, alignment: 16B (overaligned) */
111
+ COMMONDX_C_64I = 23,
112
+ /** Equivalent to uint8_t. Size 1B, alignment: 1B */
113
+ COMMONDX_R_8UI = 24,
114
+ /** Equivalent to 2xuint8_t. Size 2B, alignment: 2B (overaligned) */
115
+ COMMONDX_C_8UI = 25,
116
+ /** Equivalent to uint16_t. Size 2B, alignment: 2B */
117
+ COMMONDX_R_16UI = 26,
118
+ /** Equivalent to 2xuint16_t. Size 4B, alignment: 4B (overaligned) */
119
+ COMMONDX_C_16UI = 27,
120
+ /** Equivalent to uint32_t. Size 4B, alignment: 4B */
121
+ COMMONDX_R_32UI = 28,
122
+ /** Equivalent to 2xuint32_t. Size 8B, alignment: 8B (overaligned)*/
123
+ COMMONDX_C_32UI = 29,
124
+ /** Equivalent to uint64_t. Size 8B, alignment: 8B */
125
+ COMMONDX_R_64UI = 30,
126
+ /** Equivalent to 2xuint64_t. Size 16B, alignment: 16B (overaligned) */
127
+ COMMONDX_C_64UI = 31,
128
+ } commondxValueType;
129
+
130
+ /**
131
+ * @brief The set of status values that can be returned by APIs defined in the library
132
+ */
133
+ typedef enum commondxStatusType_t {
134
+ /** Success */
135
+ COMMONDX_SUCCESS = 0,
136
+ /** One of the input values is not in the allowed range or is otherwise invalid */
137
+ COMMONDX_INVALID_VALUE = 1,
138
+ /** Library internal error */
139
+ COMMONDX_INTERNAL_ERROR = 2,
140
+ /** Compilation did not complete successfully */
141
+ COMMONDX_COMPILATION_ERROR = 3,
142
+ /** Library dependency error */
143
+ COMMONDX_CUFFT_ERROR = 4,
144
+ /** Filesystem error (eg not enough space or no sufficient permissions) */
145
+ COMMONDX_FILE_ERROR = 5,
146
+ } commondxStatusType;
147
+
148
+ /**
149
+ * @brief The set of precisions supported by the library
150
+ *
151
+ * For the actual input and output value types, see \ref commondxValueType_t
152
+ */
153
+ typedef enum commondxPrecision_t {
154
+ /** Equivalent to __nv_fp8_e5m2 */
155
+ COMMONDX_PRECISION_F8_E5M2 = 0,
156
+ /** Equivalent to __nv_fp8_e4m3 */
157
+ COMMONDX_PRECISION_F8_E4M3 = 1,
158
+ /** Equivalent to __nv_bfloat16 */
159
+ COMMONDX_PRECISION_BF16 = 2,
160
+ /** Equivalent to __half */
161
+ COMMONDX_PRECISION_F16 = 3,
162
+ /** Equivalent to tfloat32 */
163
+ COMMONDX_PRECISION_TF32 = 4,
164
+ /** Equivalent to float */
165
+ COMMONDX_PRECISION_F32 = 5,
166
+ /** Equivalent to double */
167
+ COMMONDX_PRECISION_F64 = 6,
168
+ /** Equivalent to int8_t */
169
+ COMMONDX_PRECISION_I8 = 7,
170
+ /** Equivalent to int16_t */
171
+ COMMONDX_PRECISION_I16 = 8,
172
+ /** Equivalent to int32_t */
173
+ COMMONDX_PRECISION_I32 = 9,
174
+ /** Equivalent to int64_t */
175
+ COMMONDX_PRECISION_I64 = 10,
176
+ /** Equivalent to uint8_t */
177
+ COMMONDX_PRECISION_UI8 = 11,
178
+ /** Equivalent to uint16_t */
179
+ COMMONDX_PRECISION_UI16 = 12,
180
+ /** Equivalent to uint32_t */
181
+ COMMONDX_PRECISION_UI32 = 13,
182
+ /** Equivalent to uint64_t */
183
+ COMMONDX_PRECISION_UI64 = 14,
184
+ } commondxPrecision;
185
+
186
+ /**
187
+ * @brief The set of compute feature to target. See \ref COMMONDX_OPTION_TARGET_SM .
188
+ *
189
+ * See also https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#feature-set-compiler-targets
190
+ */
191
+ typedef enum commondxArchModifier_t {
192
+ /** Target the baseline set of compute features */
193
+ COMMONDX_ARCH_MODIFIER_GENERIC = 0,
194
+ /** Target the arch specific set of compute features */
195
+ COMMONDX_ARCH_MODIFIER_ARCH_SPECIFIC = 1,
196
+ /** Target the family specific set of compute features */
197
+ COMMONDX_ARCH_MODIFIER_FAMILY_SPECIFIC = 2,
198
+ } commondxArchModifier;
199
+
200
+ /**
201
+ * @brief Options to tweak code generation
202
+ */
203
+ typedef enum commondxOption_t {
204
+ /**
205
+ * Symbol to wrap the device function in (default is autogenerated).
206
+ * Associated value must be A C-string.
207
+ */
208
+ COMMONDX_OPTION_SYMBOL_NAME = 0,
209
+ /**
210
+ * Target SM.
211
+ * Associated value must be an integer, e.g. 800 for SM80 or a pair
212
+ * (integer, modifier) where modifier is an enum of type \ref commondxArchModifier_t .
213
+ *
214
+ * See \ref commondxSetCodeOptionInt64 and \ref commondxSetCodeOptionInt64s
215
+ */
216
+ COMMONDX_OPTION_TARGET_SM = 1,
217
+ /**
218
+ * Code container type (e.g. PTX, LTO, Cubin (SASS), FATBIN).
219
+ * Associated value must be a value of \ref commondxCodeContainer_t
220
+ */
221
+ COMMONDX_OPTION_CODE_CONTAINER = 2,
222
+ /**
223
+ * Code ISA (e.g. 12.3 for LTO).
224
+ * Associated value must be an integer, e.g. 12030 for 12.3
225
+ */
226
+ COMMONDX_OPTION_CODE_ISA = 3,
227
+ /**
228
+ * Extra arguments passed to NVRTC.
229
+ * Must be one or more C-string. See \ref commondxSetCodeOptionStr
230
+ * and \ref commondxSetCodeOptionStrs .
231
+ */
232
+ COMMONDX_OPTION_EXTRA_NVRTC_ARGS = 4,
233
+ /**
234
+ * What code to generate (PTX or LTO).
235
+ * Associated value must be a value of \ref commondxCodeType
236
+ */
237
+ COMMONDX_OPTION_TARGET_CODE = 5,
238
+ } commondxOption;
239
+
240
+ /**
241
+ * @brief The set of execution modes supported by the library
242
+ */
243
+ typedef enum commondxExecution_t {
244
+ /**
245
+ * Thread APIs.
246
+ * All threads are independant, divergent control flow is allowed.
247
+ */
248
+ COMMONDX_EXECUTION_THREAD = 0,
249
+ /**
250
+ * Block APIs.
251
+ * All threads in the block cooperate, and all must call the device function.
252
+ */
253
+ COMMONDX_EXECUTION_BLOCK = 1,
254
+ /**
255
+ * Warp APIs.
256
+ * All threads in a single warp cooperate. Participating threads must start at laneid 0.
257
+ */
258
+ COMMONDX_EXECUTION_WARP = 2,
259
+ } commondxExecution;
260
+
261
+ /**
262
+ * @brief The function ABI emitted for a generated device function.
263
+ */
264
+ typedef enum commondxFunctionAbi_t {
265
+ /**
266
+ * Existing library-native function ABI.
267
+ *
268
+ * This is the default when a library's function ABI operator is not set.
269
+ */
270
+ COMMONDX_FUNCTION_ABI_NATIVE = 0,
271
+ /**
272
+ * Tile function ABI for foreign-call integration.
273
+ *
274
+ * Input and input-output operands are emitted first in declaration order, followed by output operands in
275
+ * declaration order and compiler-provided scratch arguments.
276
+ */
277
+ COMMONDX_FUNCTION_ABI_TILE = 1,
278
+ } commondxFunctionAbi;
279
+
280
+ /**
281
+ * @brief The set of code types supported by the library.
282
+ * See \ref commondxOption_t::COMMONDX_OPTION_TARGET_CODE
283
+ */
284
+ typedef enum commondxCodeType_t {
285
+ /**
286
+ * LTO
287
+ */
288
+ COMMONDX_CODE_TYPE_LTO = 0,
289
+ /**
290
+ * PTX
291
+ */
292
+ COMMONDX_CODE_TYPE_PTX = 1,
293
+ } commondxCodeType;
294
+
295
+ /**
296
+ * @brief The set of device code container types supported by the library.
297
+ * See \ref commondxOption_t::COMMONDX_OPTION_CODE_CONTAINER
298
+ */
299
+ typedef enum commondxCodeContainer_t {
300
+ /**
301
+ * `.ltoir`, aka `-dlto -ltoir` with NVCC and NVRTC
302
+ */
303
+ COMMONDX_CODE_CONTAINER_LTOIR = 0,
304
+ /**
305
+ * `.fatbin`, aka `-fatbin` with NVCC
306
+ */
307
+ COMMONDX_CODE_CONTAINER_FATBIN = 1,
308
+ /**
309
+ * `.ptx`, PTX textual format
310
+ */
311
+ COMMONDX_CODE_CONTAINER_PTX = 2,
312
+ } commondxCodeContainer;
313
+
314
+ /**
315
+ * @brief Creates a code handle.
316
+ *
317
+ * @param[out] code A pointer to the output code handle.
318
+ * @return `COMMONDX_SUCCESS` on success, or an error.
319
+ */
320
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxCreateCode(commondxCode* code) LIBMATHDX_API_NOEXCEPT;
321
+
322
+ /**
323
+ * @brief Set an option on a code handle
324
+ *
325
+ * @param[in] code A code handle from \ref commondxCreateCode
326
+ * @param[in] option The option to set the code to
327
+ * @param[in] value A corresponding value for the selected option
328
+ * @return `COMMONDX_SUCCESS` on success, or an error.
329
+ */
330
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxSetCodeOptionInt64(commondxCode code,
331
+ commondxOption option,
332
+ long long int value) LIBMATHDX_API_NOEXCEPT;
333
+
334
+ /**
335
+ * @brief Set an option on a code handle
336
+ *
337
+ * @param[in] code A code handle from \ref commondxCreateCode.
338
+ * @param[in] option The option to set the code to.
339
+ * @param[in] count The length of the array.
340
+ * @param[in] values A pointer to `count` entries.
341
+ * @return `COMMONDX_SUCCESS` on success, or an error.
342
+ */
343
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxSetCodeOptionInt64s(commondxCode code,
344
+ commondxOption option,
345
+ size_t count,
346
+ long long int* values) LIBMATHDX_API_NOEXCEPT;
347
+
348
+ /**
349
+ * @brief Set a C-string option on a code handle.
350
+ *
351
+ * @param[in] code A code handle from \ref commondxCreateCode.
352
+ * @param[in] option The option to set the code to.
353
+ * @param[in] value A C-string. Cannot be `NULL`.
354
+ * @return `COMMONDX_SUCCESS` on success, or an error.
355
+ */
356
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxSetCodeOptionStr(commondxCode code,
357
+ commondxOption option,
358
+ const char* value) LIBMATHDX_API_NOEXCEPT;
359
+
360
+ /**
361
+ * @brief Set one or more C-string option on a code handle.
362
+ *
363
+ * @param[in] code A code handle from \ref commondxCreateCode.
364
+ * @param[in] option The option to set the code to.
365
+ * @param[in] count The number of C-strings to set.
366
+ * @param[in] values A pointer to an array of `count` C-strings.
367
+ * @return `COMMONDX_SUCCESS` on success, or an error.
368
+ */
369
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxSetCodeOptionStrs(commondxCode code,
370
+ commondxOption option,
371
+ size_t count,
372
+ const char** values) LIBMATHDX_API_NOEXCEPT;
373
+
374
+ /**
375
+ * @brief Get option from a code handle
376
+ *
377
+ * @param[in] code A code handle from \ref commondxCreateCode
378
+ * @param[in] option The option to get
379
+ * @param[out] value The option value.
380
+ * @return `COMMONDX_SUCCESS` on success, or an error.
381
+ */
382
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodeOptionInt64(commondxCode code,
383
+ commondxOption option,
384
+ long long int* value) LIBMATHDX_API_NOEXCEPT;
385
+
386
+ /**
387
+ * @brief Get options (as an array) from a code handle, with one option per output code
388
+ *
389
+ * @param[in] code A code handle from \ref commondxCreateCode
390
+ * @param[in] option The option to get
391
+ * @param[in] size The array size, as result from \ref commondxGetCodeNumLTOIRs
392
+ * @param[out] array A pointer to the beginning of the output array. Must be a pointer to a buffer of at least `size`
393
+ * elements.
394
+ * @return `COMMONDX_SUCCESS` on success, or an error.
395
+ */
396
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL
397
+ commondxGetCodeOptionsInt64s(commondxCode code, commondxOption option, size_t size, long long int* array)
398
+ LIBMATHDX_API_NOEXCEPT;
399
+
400
+ /**
401
+ * @brief Extract the LTOIR size, in bytes.
402
+ *
403
+ * @param[in] code A code handle from \ref commondxCreateCode
404
+ * @param[out] size The LTOIR size, in bytes.
405
+ * @return `COMMONDX_SUCCESS` on success, or an error.
406
+ */
407
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodeLTOIRSize(commondxCode code,
408
+ size_t* size) LIBMATHDX_API_NOEXCEPT;
409
+
410
+ /**
411
+ * @brief Extract the LTOIR.
412
+ *
413
+ * @param[in] code A code handle from \ref commondxCreateCode
414
+ * @param[in] size The LTOIR size, as returned by \ref commondxGetCodeLTOIRSize
415
+ * @param[out] out The LTOIR. Must be a pointer to a buffer of at least size byte.
416
+ * @return `COMMONDX_SUCCESS` on success, or an error.
417
+ */
418
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodeLTOIR(commondxCode code,
419
+ size_t size,
420
+ void* out) LIBMATHDX_API_NOEXCEPT;
421
+
422
+ /**
423
+ * @brief Extract the PTX size, in bytes.
424
+ *
425
+ * The PTX is a null-terminated string, and the size includes the null terminator.
426
+ *
427
+ * @param[in] code A code handle from \ref commondxCreateCode
428
+ * @param[out] size The PTX size, in bytes (including null terminator).
429
+ * @return `COMMONDX_SUCCESS` on success, or an error.
430
+ */
431
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodePTXSize(commondxCode code,
432
+ size_t* size) LIBMATHDX_API_NOEXCEPT;
433
+
434
+ /**
435
+ * @brief Extract the PTX.
436
+ *
437
+ * The PTX is returned as a null-terminated string.
438
+ *
439
+ * @param[in] code A code handle from \ref commondxCreateCode
440
+ * @param[in] size The PTX size, as returned by \ref commondxGetCodePTXSize
441
+ * @param[out] out The PTX. Must be a pointer to a buffer of at least size bytes.
442
+ * @return `COMMONDX_SUCCESS` on success, or an error.
443
+ */
444
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodePTX(commondxCode code,
445
+ size_t size,
446
+ void* out) LIBMATHDX_API_NOEXCEPT;
447
+
448
+ /**
449
+ * @brief Returns the number the LTOIR chunks.
450
+ *
451
+ * Some code produce more than one LTOIR.
452
+ * In this case, this function must be used to retreive the number of LTOIR's.
453
+ *
454
+ * @param[in] code A code handle from \ref commondxCreateCode
455
+ * @param[out] size The number of LTOIR chunks.
456
+ * @return `COMMONDX_SUCCESS` on success, or an error.
457
+ */
458
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodeNumLTOIRs(commondxCode code,
459
+ size_t* size) LIBMATHDX_API_NOEXCEPT;
460
+
461
+ /**
462
+ * @brief Returns the size of all LTOIR chunks.
463
+ *
464
+ * @param[in] code A code handle from \ref commondxCreateCode
465
+ * @param[in] size The number of LTOIR chunks, as returned by \ref commondxGetCodeNumLTOIRs
466
+ * @param[out] out On output, `out[i]` is the size, in byte, of the ith LTOIR chunk.
467
+ * @return `COMMONDX_SUCCESS` on success, or an error.
468
+ */
469
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodeLTOIRSizes(commondxCode code,
470
+ size_t size,
471
+ size_t* out) LIBMATHDX_API_NOEXCEPT;
472
+
473
+ /**
474
+ * @brief Returns all LTOIR chunks.
475
+ *
476
+ * @param[in] code A code handle from \ref commondxCreateCode
477
+ * @param[in] size The number of LTOIR chunks, as returned by \ref commondxGetCodeNumLTOIRs
478
+ * @param[out] out On output, `out[i]` is filled with the ith LTOIR chunk. `out[i]` must point to a buffer
479
+ * of at least `size[i]` bytes, with `size` the output of \ref commondxGetCodeLTOIRSizes
480
+ * @return `COMMONDX_SUCCESS` on success, or an error.
481
+ */
482
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetCodeLTOIRs(commondxCode code,
483
+ size_t size,
484
+ void** out) LIBMATHDX_API_NOEXCEPT;
485
+
486
+ /**
487
+ * @brief Destroys a code handle.
488
+ *
489
+ * @param[in] code A code handle from \ref commondxCreateCode
490
+ * @return `COMMONDX_SUCCESS` on success, or an error.
491
+ */
492
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxDestroyCode(commondxCode code) LIBMATHDX_API_NOEXCEPT;
493
+
494
+ /**
495
+ * @brief Convert a status enum to a human readable C-string
496
+ *
497
+ * @param[in] status The status enum to convert
498
+ * @return A short C-string describing the enum. This C-string should be not free'ed by the caller.
499
+ */
500
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxStatusToStr(commondxStatusType status) LIBMATHDX_API_NOEXCEPT;
501
+
502
+ /**
503
+ * @brief Convert a precision enum to a human readable C-string
504
+ *
505
+ * @param[in] precision The precision enum to convert
506
+ * @return The C-string
507
+ */
508
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxPrecisionToStr(commondxPrecision precision) LIBMATHDX_API_NOEXCEPT;
509
+
510
+ /**
511
+ * @brief Convert a value type enum to a human readable C-string
512
+ *
513
+ * @param[in] value_type The value type enum to convert
514
+ * @return The C-string
515
+ */
516
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxValueTypeToStr(commondxValueType value_type) LIBMATHDX_API_NOEXCEPT;
517
+
518
+ /**
519
+ * @brief Convert an option enum to a human readable C-string
520
+ *
521
+ * @param[in] option The option enum to convert
522
+ * @return The C-string
523
+ */
524
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxOptionToStr(commondxOption option) LIBMATHDX_API_NOEXCEPT;
525
+
526
+ /**
527
+ * @brief Convert an execution enum to a human readable C-string
528
+ *
529
+ * @param[in] execution The execution enum to convert
530
+ * @return The C-string
531
+ */
532
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxExecutionToStr(commondxExecution execution) LIBMATHDX_API_NOEXCEPT;
533
+
534
+ /**
535
+ * @brief Convert a function ABI enum to a human readable C-string
536
+ *
537
+ * @param[in] abi The function ABI enum to convert
538
+ * @return The C-string
539
+ */
540
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxFunctionAbiToStr(commondxFunctionAbi abi) LIBMATHDX_API_NOEXCEPT;
541
+
542
+ /**
543
+ * @brief Convert a code container type enum to a human readable C-string
544
+ *
545
+ * @param[in] container The code container type enum to convert
546
+ * @return The C-string
547
+ */
548
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxCodeContainerToStr(commondxCodeContainer container)
549
+ LIBMATHDX_API_NOEXCEPT;
550
+
551
+ /**
552
+ * @brief Convert a code type enum to a human readable C-string
553
+ *
554
+ * @param[in] code The code type enum to convert
555
+ * @return The C-string
556
+ */
557
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxCodeTypeToStr(commondxCodeType code)
558
+ LIBMATHDX_API_NOEXCEPT;
559
+
560
+ /**
561
+ * @brief Converts an arch modifier enum to a human readable C-string
562
+ *
563
+ * @param[in] modifier The arch modifier enum to convert
564
+ * @return The C-string
565
+ */
566
+ LIBMATHDX_API const char* LIBMATHDX_CALL commondxArchModifierToStr(commondxArchModifier modifier)
567
+ LIBMATHDX_API_NOEXCEPT;
568
+
569
+ /**
570
+ * @brief Returns the size of the last error string. See \ref commondxGetLastErrorStr
571
+ *
572
+ * @param[out] size The size in byte of the last error C-string, including the null terminator.
573
+ * @return `COMMONDX_SUCCESS` on success or `COMMONDX_INVALID_VALUE` if no error is available to be returned.
574
+ */
575
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetLastErrorStrSize(size_t* size) LIBMATHDX_API_NOEXCEPT;
576
+
577
+ /**
578
+ * @brief Returns the last error as a human readable C-string.
579
+ *
580
+ * This function will return the last error encountered by the current host thread.
581
+ * Current this only supports `COMMONDX_COMPILATION_ERROR`.
582
+ * Setting the `LIBMATHDX_LOG_LEVEL` environment variable to `5` in the environment will also display more error logs.
583
+ *
584
+ * @param[out] code The error code associated with the last error.
585
+ * @param[in] size The size in bytes of the buffer `value`. See \ref commondxGetLastErrorStrSize .
586
+ * @param[out] value Upon return, will point to a C-string holding the error description.
587
+ * @return `COMMONDX_SUCCESS` on success or `COMMONDX_INVALID_VALUE` if no error is available to be returned.
588
+ */
589
+ LIBMATHDX_API commondxStatusType LIBMATHDX_CALL commondxGetLastErrorStr(commondxStatusType* code, size_t size, char* value)
590
+ LIBMATHDX_API_NOEXCEPT;
591
+
592
+ #if defined(__cplusplus)
593
+ } // extern "C"
594
+ #endif /* __cplusplus */
595
+
596
+ #endif // MATHDX_LIBCOMMONDX_H