[Minor] Enhance JIT kernel and add dev docs (#14570)

This commit is contained in:
DarkSharpness
2025-12-23 22:34:59 +08:00
committed by GitHub
parent d7301c89ba
commit 291f11ae39
13 changed files with 817 additions and 290 deletions

View File

@@ -70,6 +70,36 @@ def load_jit(
extra_include_paths: List[str] | None = None,
build_directory: str | None = None,
) -> Module:
"""
Loading a JIT module from C++/CUDA source files.
We define a wrapper as a tuple of (export_name, kernel_name),
where `export_name` is the name used to called from Python,
and `kernel_name` is the name of the kernel class in C++/CUDA source.
:param args: Unique marker of the JIT module. Must be distinct for different kernels.
:type args: str
:param cpp_files: A list of C++ source files.
:type cpp_files: List[str] | None
:param cuda_files: A list of CUDA source files.
:type cuda_files: List[str] | None
:param cpp_wrappers: A list of C++ wrappers, defining the export name and kernel name.
:type cpp_wrappers: List[Tuple[str, str]] | None
:param cuda_wrappers: A list of CUDA wrappers, defining the export name and kernel name.
:type cuda_wrappers: List[Tuple[str, str]] | None
:param extra_cflags: Extra C++ compiler flags.
:type extra_cflags: List[str] | None
:param extra_cuda_cflags: Extra CUDA compiler flags.
:type extra_cuda_cflags: List[str] | None
:param extra_ldflags: Extra linker flags.
:type extra_ldflags: List[str] | None
:param extra_include_paths: Extra include paths.
:type extra_include_paths: List[str] | None
:param build_directory: The build directory for JIT compilation.
:type build_directory: str | None
:return: A just-in-time(JIT) compiled module.
:rtype: Module
"""
from tvm_ffi.cpp import load_inline
cpp_files = cpp_files or []