nvfatbin#
Note#
The nvfatbin bindings are not supported on nvFatbin installations <12.4. Ensure the installed CUDA toolkit’s nvFatbin version is >=12.4.
The Tile IR API (cuda.bindings.nvfatbin.add_tile_ir()) is only available in CUDA 13.1+.
Functions#
NvFatbin defines the following functions for creating and populating fatbinaries.
- cuda.bindings.nvfatbin.create(options, size_t options_count) intptr_t#
nvFatbinCreate creates a new handle. :param options: An array of strings, each containing a single option. 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 :param options_count: Number of options. :type options_count: size_t :returns: Address of nvFatbin handle. :rtype: intptr_t .. seealso:: `nvFatbinCreate`
- cuda.bindings.nvfatbin.destroy(intptr_t handle)#
nvFatbinDestroy frees the memory associated with the given handle. :param handle: nvFatbin handle. :type handle: intptr_t .. seealso:: `nvFatbinDestroy`
- cuda.bindings.nvfatbin.add_ptx(
- intptr_t handle,
- code,
- size_t size,
- arch,
- identifier,
- options_cmd_line,
nvFatbinAddPTX adds PTX to the fatbinary. :param handle: nvFatbin handle. :type handle: intptr_t :param code: The PTX code. :type code: bytes :param size: The size of the PTX code. :type size: size_t :param arch: The numerical architecture that this PTX is for (the XX of any sm_XX, lto_XX, or compute_XX). :type arch: str :param identifier: Name of the PTX, useful when extracting the fatbin with tools like cuobjdump. :type identifier: str :param options_cmd_line: Options used during JIT compilation. :type options_cmd_line: str .. seealso:: `nvFatbinAddPTX`
- cuda.bindings.nvfatbin.add_cubin(intptr_t handle, code, size_t size, arch, identifier)#
nvFatbinAddCubin adds a CUDA binary to the fatbinary. :param handle: nvFatbin handle. :type handle: intptr_t :param code: The cubin. :type code: bytes :param size: The size of the cubin. :type size: size_t :param arch: The numerical architecture that this cubin is for (the XX of any sm_XX, lto_XX, or compute_XX). :type arch: str :param identifier: Name of the cubin, useful when extracting the fatbin with tools like cuobjdump. :type identifier: str .. seealso:: `nvFatbinAddCubin`
- cuda.bindings.nvfatbin.add_ltoir(
- intptr_t handle,
- code,
- size_t size,
- arch,
- identifier,
- options_cmd_line,
nvFatbinAddLTOIR adds LTOIR to the fatbinary. :param handle: nvFatbin handle. :type handle: intptr_t :param code: The LTOIR code. :type code: bytes :param size: The size of the LTOIR code. :type size: size_t :param arch: The numerical architecture that this LTOIR is for (the XX of any sm_XX, lto_XX, or compute_XX). :type arch: str :param identifier: Name of the LTOIR, useful when extracting the fatbin with tools like cuobjdump. :type identifier: str :param options_cmd_line: Options used during JIT compilation. :type options_cmd_line: str .. seealso:: `nvFatbinAddLTOIR`
- cuda.bindings.nvfatbin.add_reloc(intptr_t handle, code, size_t size)#
nvFatbinAddReloc adds relocatable PTX entries from a host object to the fatbinary. :param handle: nvFatbin handle. :type handle: intptr_t :param code: The host object image. :type code: bytes :param size: The size of the host object image code. :type size: size_t .. seealso:: `nvFatbinAddReloc`
- cuda.bindings.nvfatbin.add_tile_ir(
- intptr_t handle,
- code,
- size_t size,
- identifier,
- options_cmd_line,
nvFatbinAddTileIR adds Tile IR to the fatbinary. :param handle: nvFatbin handle. :type handle: intptr_t :param code: The Tile IR. :type code: bytes :param size: The size of the Tile IR. :type size: size_t :param identifier: Name of the Tile IR, useful when extracting the fatbin with tools like cuobjdump. :type identifier: str :param options_cmd_line: Options used during JIT compilation. :type options_cmd_line: str .. seealso:: `nvFatbinAddTileIR`
- cuda.bindings.nvfatbin.size(intptr_t handle) size_t#
nvFatbinSize returns the fatbinary's size. :param handle: nvFatbin handle. :type handle: intptr_t :returns: The fatbinary's size. :rtype: size_t .. seealso:: `nvFatbinSize`
- cuda.bindings.nvfatbin.get(intptr_t handle, buffer)#
nvFatbinGet returns the completed fatbinary. :param handle: nvFatbin handle. :type handle: intptr_t :param buffer: memory to store fatbinary. :type buffer: bytes .. seealso:: `nvFatbinGet`
Types#
- class cuda.bindings.nvfatbin.Result(value: int)#
The enumerated type nvFatbinResult defines API call result codes. nvFatbin APIs return nvFatbinResult codes to indicate the result. See `nvFatbinResult`.
- SUCCESS = <Result.SUCCESS: 0>#
- ERROR_INTERNAL = <Result.ERROR_INTERNAL: 1>#
- ERROR_ELF_ARCH_MISMATCH = <Result.ERROR_ELF_ARCH_MISMATCH: 2>#
- ERROR_ELF_SIZE_MISMATCH = <Result.ERROR_ELF_SIZE_MISMATCH: 3>#
- ERROR_MISSING_PTX_VERSION = <Result.ERROR_MISSING_PTX_VERSION: 4>#
- ERROR_NULL_POINTER = <Result.ERROR_NULL_POINTER: 5>#
- ERROR_COMPRESSION_FAILED = <Result.ERROR_COMPRESSION_FAILED: 6>#
- ERROR_COMPRESSED_SIZE_EXCEEDED = <Result.ERROR_COMPRESSED_SIZE_EXCEEDED: 7>#
- ERROR_UNRECOGNIZED_OPTION = <Result.ERROR_UNRECOGNIZED_OPTION: 8>#
- ERROR_INVALID_ARCH = <Result.ERROR_INVALID_ARCH: 9>#
- ERROR_INVALID_NVVM = <Result.ERROR_INVALID_NVVM: 10>#
- ERROR_EMPTY_INPUT = <Result.ERROR_EMPTY_INPUT: 11>#
- ERROR_MISSING_PTX_ARCH = <Result.ERROR_MISSING_PTX_ARCH: 12>#
- ERROR_PTX_ARCH_MISMATCH = <Result.ERROR_PTX_ARCH_MISMATCH: 13>#
- ERROR_MISSING_FATBIN = <Result.ERROR_MISSING_FATBIN: 14>#
- ERROR_INVALID_INDEX = <Result.ERROR_INVALID_INDEX: 15>#
- ERROR_IDENTIFIER_REUSE = <Result.ERROR_IDENTIFIER_REUSE: 16>#
- ERROR_INTERNAL_PTX_OPTION = <Result.ERROR_INTERNAL_PTX_OPTION: 17>#