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.
:rtype: A 2-tuple containing

.. seealso:: `nvvmVersion`
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.
:rtype: A 4-tuple containing

.. seealso:: `nvvmIRVersion`
cuda.bindings.nvvm.create_program() intptr_t#
Create a program, and set the value of its handle to ``*prog``.

:returns: NVVM program.
:rtype: intptr_t

.. seealso:: `nvvmCreateProgram`
cuda.bindings.nvvm.add_module_to_program(intptr_t prog, buffer, size_t size, name)#
Add a module level NVVM IR to a program.

:param prog: NVVM program.
:type prog: intptr_t
:param buffer: NVVM IR module in the bitcode or text representation.
:type buffer: bytes
:param size: Size of the NVVM IR module.
:type size: size_t
:param name: Name of the NVVM IR module. If NULL, "<unnamed>" is used as the name.
:type name: str

.. seealso:: `nvvmAddModuleToProgram`
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.

:param prog: NVVM program.
:type prog: intptr_t
:param buffer: NVVM IR module in the bitcode representation.
:type buffer: bytes
:param size: Size of the NVVM IR module.
:type size: size_t
:param name: Name of the NVVM IR module. If NULL, "<unnamed>" is used as the name.
:type name: str

.. seealso:: `nvvmLazyAddModuleToProgram`
cuda.bindings.nvvm.compile_program(intptr_t prog, int num_options, options)#
Compile the NVVM program.

:param prog: NVVM program.
:type prog: intptr_t
:param num_options: Number of compiler ``options`` passed.
:type num_options: int
:param options: Compiler options in the form of C string array. It can be:

                - an :class:`int` as the pointer address to the nested sequence, or
                - a Python sequence of :class:`int`\s, each of which is a pointer address
                  to a valid sequence of 'char', or
                - a nested Python sequence of ``str``.
:type options: object

.. seealso:: `nvvmCompileProgram`
cuda.bindings.nvvm.verify_program(intptr_t prog, int num_options, options)#
Verify the NVVM program.

:param prog: NVVM program.
:type prog: intptr_t
:param num_options: Number of compiler ``options`` passed.
:type num_options: int
:param options: Compiler options in the form of C string array. It can be:

                - an :class:`int` as the pointer address to the nested sequence, or
                - a Python sequence of :class:`int`\s, each of which is a pointer address
                  to a valid sequence of 'char', or
                - a nested Python sequence of ``str``.
:type options: object

.. seealso:: `nvvmVerifyProgram`
cuda.bindings.nvvm.get_compiled_result_size(intptr_t prog) size_t#
Get the size of the compiled result.

:param prog: NVVM program.
:type prog: intptr_t

:returns: Size of the compiled result (including the trailing NULL).
:rtype: size_t

.. seealso:: `nvvmGetCompiledResultSize`
cuda.bindings.nvvm.get_compiled_result(intptr_t prog, buffer)#
Get the compiled result.

:param prog: NVVM program.
:type prog: intptr_t
:param buffer: Compiled result.
:type buffer: bytes

.. seealso:: `nvvmGetCompiledResult`
cuda.bindings.nvvm.get_program_log_size(intptr_t prog) size_t#
Get the Size of Compiler/Verifier Message.

:param prog: NVVM program.
:type prog: intptr_t

:returns: Size of the compilation/verification log (including the trailing NULL).
:rtype: size_t

.. seealso:: `nvvmGetProgramLogSize`
cuda.bindings.nvvm.get_program_log(intptr_t prog, buffer)#
Get the Compiler/Verifier Message.

:param prog: NVVM program.
:type prog: intptr_t
:param buffer: Compilation/Verification log.
:type buffer: bytes

.. seealso:: `nvvmGetProgramLog`

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>#