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

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.

Return type:

A 4-tuple containing

See also

nvvmIRVersion

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

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.

Parameters:
  • prog (intptr_t) – NVVM program.

  • buffer (bytes) – NVVM IR module in the bitcode or text representation.

  • size (size_t) – Size of the NVVM IR module.

  • name (str) – Name of the NVVM IR module. If NULL, “<unnamed>” is used as the name.

See also

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.

Parameters:
  • prog (intptr_t) – NVVM program.

  • buffer (bytes) – NVVM IR module in the bitcode representation.

  • size (size_t) – Size of the NVVM IR module.

  • name (str) – Name of the NVVM IR module. If NULL, “<unnamed>” is used as the name.

See also

nvvmLazyAddModuleToProgram

cuda.bindings.nvvm.compile_program(intptr_t prog, int num_options, options)

Compile the NVVM program.

Parameters:
  • prog (intptr_t) – NVVM program.

  • num_options (int) – Number of compiler options passed.

  • options (object) –

    Compiler options in the form of C string array. It can be:

    • an int as the pointer address to the nested sequence, or

    • a Python sequence of ints, each of which is a pointer address to a valid sequence of ‘char’, or

    • a nested Python sequence of str.

See also

nvvmCompileProgram

cuda.bindings.nvvm.verify_program(intptr_t prog, int num_options, options)

Verify the NVVM program.

Parameters:
  • prog (intptr_t) – NVVM program.

  • num_options (int) – Number of compiler options passed.

  • options (object) –

    Compiler options in the form of C string array. It can be:

    • an int as the pointer address to the nested sequence, or

    • a Python sequence of ints, each of which is a pointer address to a valid sequence of ‘char’, or

    • a nested Python sequence of str.

See also

nvvmVerifyProgram

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

nvvmGetCompiledResultSize

cuda.bindings.nvvm.get_compiled_result(intptr_t prog, buffer)

Get the compiled result.

Parameters:
  • prog (intptr_t) – NVVM program.

  • buffer (bytes) – Compiled result.

See also

nvvmGetCompiledResult

cuda.bindings.nvvm.get_program_log_size(intptr_t prog) size_t

Get the Size of Compiler/Verifier Message.

Parameters:

prog (intptr_t) – NVVM program.

Returns:

Size of the compilation/verification log (including the trailing NULL).

Return type:

size_t

See also

nvvmGetProgramLogSize

cuda.bindings.nvvm.get_program_log(intptr_t prog, buffer)

Get the Compiler/Verifier Message.

Parameters:
  • prog (intptr_t) – NVVM program.

  • buffer (bytes) – Compilation/Verification log.

See also

nvvmGetProgramLog

Types

class cuda.bindings.nvvm.Result(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

See nvvmResult.

SUCCESS = 0
ERROR_OUT_OF_MEMORY = 1
ERROR_PROGRAM_CREATION_FAILURE = 2
ERROR_IR_VERSION_MISMATCH = 3
ERROR_INVALID_INPUT = 4
ERROR_INVALID_PROGRAM = 5
ERROR_INVALID_IR = 6
ERROR_INVALID_OPTION = 7
ERROR_NO_MODULE_IN_PROGRAM = 8
ERROR_COMPILATION = 9
ERROR_CANCELLED = 10