tilelang.contrib.nvrtc

Functions

get_nvrtc_version()

Return the loaded NVRTC's version, cached for this process.

default_compile_options([compile_flags])

Extend the common CUDA compile options with NVRTC header compatibility.

compile_cuda(code[, target_format, arch, options, verbose])

Compile cuda code with NVRTC.

Module Contents

tilelang.contrib.nvrtc.get_nvrtc_version()

Return the loaded NVRTC’s version, cached for this process.

Return type:

tuple[int, int]

tilelang.contrib.nvrtc.default_compile_options(compile_flags=None)

Extend the common CUDA compile options with NVRTC header compatibility.

Parameters:

compile_flags (list[str] | str | None)

Return type:

list[str]

tilelang.contrib.nvrtc.compile_cuda(code, target_format='ptx', arch=None, options=None, verbose=False)

Compile cuda code with NVRTC.

Parameters:
  • code (str) – The cuda code.

  • target_format (Literal["ptx", "cubin"]) – The target format of nvrtc compiler.

  • arch (Optional[Union[int, str]]) – The CUDA architecture code. String tokens preserve the exact suffix, such as “90”, “90a”, or “100f”. Integer values use the legacy architecture-specific suffix for SM90 and newer. If None, use the current target architecture or detect it from the GPU, as in NVCC.

  • options (Optional[Union[str, List[str]]]) – The additional options.

  • verbose (bool) – Whether to print the verbose output.

Returns:

result_bytes – The bytearray of the cubin or ptx code.

Return type:

bytearray