tvm.driver
Namespace for driver APIs
- tvm.compile(mod: PrimFunc | IRModule, target: Target | None = None, *, relax_pipeline: Pass | Callable | str | None = 'default', tir_pipeline: Pass | Callable | str | None = 'default') Executable
Compile an IRModule to a runtime executable.
This function serves as a unified entry point for compiling both TIR and Relax modules. It automatically detects the module type and routes to the appropriate build function.
- Parameters:
mod (Union[PrimFunc, IRModule]) – The input module to be compiled. Can be a PrimFunc or an IRModule containing TIR or Relax functions.
target (Optional[Target]) – The target platform to compile for.
relax_pipeline (Optional[Union[tvm.transform.Pass, Callable, str]]) – The compilation pipeline to use for Relax functions. Only used if the module contains Relax functions.
tir_pipeline (Optional[Union[tvm.transform.Pass, Callable, str]]) – The compilation pipeline to use for TIR functions.
- Returns:
A runtime executable that can be loaded and executed.
- Return type:
Executable