tvm.driver
驱动程序 API 的命名空间
- tvm.compile(mod: PrimFunc | IRModule, target: Target | None = None, *, relax_pipeline: Pass | Callable | str | None = 'default', tir_pipeline: Pass | Callable | str | None = 'default') Executable
将 IRModule 编译为运行时可执行文件。
此函数作为编译 TIR 和 Relax 模块的统一入口点。它自动检测模块类型并路由到适当的构建函数。
- 参数:
mod (Union[PrimFunc, IRModule]) – 要编译的输入模块。可以是 PrimFunc 或包含 TIR 或 Relax 函数的 IRModule。
target (Optional[Target]) – 要编译的目标平台。
relax_pipeline (Optional[Union[tvm.transform.Pass, Callable, str]]) – 用于 Relax 函数的编译管道。仅当模块包含 Relax 函数时使用。
tir_pipeline (Optional[Union[tvm.transform.Pass, Callable, str]]) – 用于 TIR 函数的编译管道。
- 返回:
可以加载和执行的运行时可执行文件。
- 返回类型:
Executable