This file provides vendor-neutral guidance for agentic coding tools working with Apache TVM.
Apache TVM is an open-source machine learning compiler stack. The repository contains the C++ compiler/runtime, Python bindings, TIR/Relax IRs, scheduling and lowering passes, target code generators, runtime integrations, tests, documentation, and application examples.
include/tvm/ - public C++ headerssrc/ - C++ implementationpython/tvm/ - Python packagetests/ - C++, Python, integration, and lint testscmake/ - CMake modules and default configuration3rdparty/ - vendored dependencies and submodulesdocs/ - documentation sourceapps/ - application examples.agents/skills/ - reusable agent workflows for this repositoryUse an existing build/ directory when present:
cmake --build build --parallel
For a fresh checkout, initialize submodules and configure CMake first:
git submodule update --init --recursive mkdir -p build cp cmake/config.cmake build/config.cmake cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo cmake --build build --parallel
Development should use PYTHONPATH, not editable installs:
export PYTHONPATH="$(pwd)/python:$(pwd)/.local/python"
Do not use pip install -e for TVM or tvm-ffi; editable installs can make one worktree silently import another worktree's code.
Run the smallest relevant test first, then broaden as needed. Common examples:
python -m pytest tests/python/all-platform-minimal-test/ -xvs python -m pytest tests/python/tir-base/test_tir_base.py -xvs ./build/cpptest
For lint validation on a pull request, run pre-commit on the files changed by the branch instead of the whole repository:
pre-commit run --files <changed-file>...
Use python -m tirx_kernels.bench_suite in the tirx-kernels repo (tirx_kernels/bench_suite/) when that workflow applies.
[REFACTOR][IR], [FIX][TIR], or [DOCS] as appropriate.