tvm
Guides Apache TVM install/build, Relax compilation, TIRx kernel authoring, S-TIR tuning, and RPC deployment workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- tvm
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guides Apache TVM install/build, Relax compilation, TIRx kernel authoring, S-TIR tuning, and RPC deployment workflows.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/repo-provenance.md2.2 KB
- 参考文档references/repo-routing-metadata.json422 B
- 参考文档references/troubleshooting.md4.9 KB
- 脚本scripts/check_tvm_runtime.py7.2 KB
03 SKILL.md 正文
Apache TVM Repo Skill
Use this skill when a task involves Apache TVM as a machine-learning compiler stack: installing or building TVM, compiling Relax/TIR modules, authoring TIRx kernels, scheduling/tuning tensor programs, or deploying through TVM RPC.
This is a router. Read the focused sub-skill before making detailed API, configuration, backend, or verification decisions.
Fast routing
| User task signal | Read |
|---|---|
Build from source, validate import, choose CMake/LLVM/RPC/CUDA flags, fix libtvm or tvm-ffi import failures |
sub-skills/install-build/SKILL.md |
Create or import Relax IR, apply optimization pipelines, call tvm.compile, export/load executables, decide target/pipeline boundaries |
sub-skills/relax-compile/SKILL.md |
| Write TIRx TVMScript kernels, reason about execution scope, layouts, tile primitives, lowering, CUDA/Blackwell prerequisites, or TIRx GPU tests | sub-skills/tirx-kernels/SKILL.md |
Use tvm.s_tir.Schedule, transformations, dlight, meta-schedule, tune_tir, builders/runners/databases, or tune CPU/GPU TIR |
sub-skills/s-tir-tuning/SKILL.md |
| Start/query TVM RPC tracker/server/proxy, cross-compile, upload/load remote modules, debug keys/timeouts/target-host issues | sub-skills/rpc-deployment/SKILL.md |
Minimal install/import orientation
- Distribution name:
apache-tvm; import name:tvm. - A package install starts with
python -m pip install apache-tvm; add optional dependencies only for the selected workflow, such as meta-schedule, RPC, Torch frontend, or CUDA helper packages. - Core runtime dependencies from package metadata include
apache-tvm-ffi,numpy,ml_dtypes, andtyping_extensions. - Optional extras are workflow-specific:
meta-scheduleaddsxgboost,rpcaddstornado,psutil, andcloudpickle,popen-pooladdspsutilandcloudpickle,torchaddstorch, andcudaaddscuda-bindings. - For a source checkout, prefer a built
build/directory plusPYTHONPATHpointing at the checkout'spython/tree. Avoid editable installs when working with multiple TVM checkouts because they can silently import a different checkout's Python package.
Minimal verification from this skill directory:
python scripts/check_tvm_runtime.py --expect-backend llvm
Use scripts/check_tvm_runtime.py for a safe
import/backend probe against an installed package or a caller-provided checkout.
Read references/troubleshooting.md when an
import, runtime library, backend, or optional dependency mismatch appears.
Backend truthfulness rules
- A CPU/LLVM import check proves only CPU/LLVM readiness. It does not prove CUDA, ROCm, Metal, Vulkan, RPC device execution, TIRx GPU execution, or Blackwell kernel-library correctness.
- TVM can compile for a target without a matching local device in some cases, but execution and timing require the target runtime/device to exist.
- TIRx Blackwell and external
tirx-kernelsworkflows require compute capability 10.0-class NVIDIA hardware and additional packages. Do not present them as verified from an A100/CPU-only environment.
Verify before relying on this skill
Read references/repo-provenance.md before
assuming this skill matches a different checkout or release. Refresh the skill
when the commit, major package metadata, public API shape, or TIRx/S-TIR/RPC
workflow evidence changes.
Structured router metadata lives in
references/repo-routing-metadata.json.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).