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 repository
Use an existing build/ directory when present:
cmake --build build --parallelFor a fresh checkout, initialize submodules and configure CMake first:
git submodule update --init --recursive
mkdir -p build
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DTVM_TIRX_USE_LLVM=OFF -DTVM_TIRX_USE_CUDA=OFF
cmake --build build --parallelDevelopment should use PYTHONPATH, not editable installs:
export PYTHONPATH="$(pwd)/python:$(pwd)/3rdparty/tvm-tirx/python:$(pwd)/.local/python"
export TVM_TIRX_LIBRARY_PATH="$(pwd)/build/lib"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 3rdparty/tvm-tirx/tests/python/codegen/llvm/test_minimal.py -xvs
python -m pytest 3rdparty/tvm-tirx/tests/python/tirx/test_base.py -xvs
./build/cpptestFor 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.
- Follow the surrounding style before introducing new abstractions.
- Keep changes scoped to the task and avoid unrelated cleanups.
- Prefer explicit tests that show the IR or behavior being changed.
- Use Apache TVM commit tags such as
[REFACTOR][IR],[FIX][TIR], or[DOCS]as appropriate. - Preserve Apache license headers in new source, script, and documentation files when the surrounding tree uses them.