nvvm#
The cuda.bindings.nvvm Python module wraps the
libNVVM C API.
Functions#
- cuda.bindings.nvvm.version() tuple#
Get the NVVM version.
- Returns:
int: NVVM major version number.
int: NVVM minor version number.
- Return type:
A 2-tuple containing
See also
- cuda.bindings.nvvm.ir_version() tuple#
Get the NVVM IR version.
- Returns:
int: NVVM IR major version number.
int: NVVM IR minor version number.
int: NVVM IR debug metadata major version number.
int: NVVM IR debug metadata minor version number.
- Return type:
A 4-tuple containing
See also
- cuda.bindings.nvvm.create_program() intptr_t#
Create a program, and set the value of its handle to
*prog.- Returns:
NVVM program.
- Return type:
intptr_t
See also
- cuda.bindings.nvvm.add_module_to_program(intptr_t prog, buffer, size_t size, name)#
Add a module level NVVM IR to a program.
The
buffershould 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.- Parameters:
See also
- cuda.bindings.nvvm.lazy_add_module_to_program(intptr_t prog, buffer, size_t size, name)#
Add a module level NVVM IR to a program.
The
buffershould contain an NVVM IR module. The module should have NVVM IR in the LLVM 7.0.1 bitcode representation. 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.- Parameters:
See also
- cuda.bindings.nvvm.compile_program(intptr_t prog, int num_options, options)#
Compile the NVVM program.
The NVVM IR modules in the program will be linked at the IR level. The linked IR program is compiled to PTX. The target datalayout in the linked IR program is used to determine the address size (32bit vs 64bit). The valid compiler options are:.
-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.
-opt=.
0 (disable optimizations).
3 (default, enable optimizations).
-arch=.
compute_75 (default).
compute_80.
compute_87.
compute_89.
compute_90.
compute_90a.
compute_100.
compute_100a.
compute_100f.
compute_103.
compute_103a.
compute_103f.
compute_110.
compute_110a.
compute_110f.
compute_120.
compute_120a.
compute_120f.
compute_121.
compute_121a.
compute_121f.
-ftz=.
0 (default, preserve denormal values, when performing single-precision floating-point operations).
1 (flush denormal values to zero, when performing single-precision floating-point operations).
-prec-sqrt=.
0 (use a faster approximation for single-precision floating-point square root).
1 (default, use IEEE round-to-nearest mode for single-precision floating- point square root).
-prec-div=.
0 (use a faster approximation for single-precision floating-point division and reciprocals).
1 (default, use IEEE round-to-nearest mode for single-precision floating- point division and reciprocals).
-fma=.
0 (disable FMA contraction).
1 (default, enable FMA contraction).
-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.
-gen-lto (Generate LTO IR instead of PTX).
-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
progare compliant with targeted PTX version. If not set, highest available PTX version is used.
- Parameters:
See also
- cuda.bindings.nvvm.verify_program(intptr_t prog, int num_options, options)#
Verify the NVVM program.
The valid compiler options are:. Same as for
compile_program().- Parameters:
See also
- cuda.bindings.nvvm.get_compiled_result_size(intptr_t prog) size_t#
Get the size of the compiled result.
- Parameters:
prog (intptr_t) – NVVM program.
- Returns:
Size of the compiled result (including the trailing NULL).
- Return type:
size_t
See also
- cuda.bindings.nvvm.get_compiled_result(intptr_t prog, buffer)#
Get the compiled result.
The result is stored in the memory pointed to by
buffer.- Parameters:
prog (intptr_t) – NVVM program.
buffer (bytes) – Compiled result.
See also
- cuda.bindings.nvvm.get_program_log_size(intptr_t prog) size_t#
Get the Size of Compiler/Verifier Message.
The size of the message string (including the trailing NULL) is stored into
buffer_size_retwhen the return value is NVVM_SUCCESS.- Parameters:
prog (intptr_t) – NVVM program.
- Returns:
- Size of the compilation/verification log (including the
trailing NULL).
- Return type:
size_t
See also
- cuda.bindings.nvvm.get_program_log(intptr_t prog, buffer)#
Get the Compiler/Verifier Message.
The NULL terminated message string is stored in the memory pointed to by
bufferwhen the return value is NVVM_SUCCESS.- Parameters:
prog (intptr_t) – NVVM program.
buffer (bytes) – Compilation/Verification log.
See also
Types#
- class cuda.bindings.nvvm.Result(value: int)#
NVVM API call result code.
See
nvvmResult.- SUCCESS = <Result.SUCCESS: 0>#
- ERROR_OUT_OF_MEMORY = <Result.ERROR_OUT_OF_MEMORY: 1>#
- ERROR_PROGRAM_CREATION_FAILURE = <Result.ERROR_PROGRAM_CREATION_FAILURE: 2>#
- ERROR_IR_VERSION_MISMATCH = <Result.ERROR_IR_VERSION_MISMATCH: 3>#
- ERROR_INVALID_INPUT = <Result.ERROR_INVALID_INPUT: 4>#
- ERROR_INVALID_PROGRAM = <Result.ERROR_INVALID_PROGRAM: 5>#
- ERROR_INVALID_IR = <Result.ERROR_INVALID_IR: 6>#
- ERROR_INVALID_OPTION = <Result.ERROR_INVALID_OPTION: 7>#
- ERROR_NO_MODULE_IN_PROGRAM = <Result.ERROR_NO_MODULE_IN_PROGRAM: 8>#
- ERROR_COMPILATION = <Result.ERROR_COMPILATION: 9>#
- ERROR_CANCELLED = <Result.ERROR_CANCELLED: 10>#