Skip to content

Latest commit

 

History

History
99 lines (75 loc) · 3.15 KB

File metadata and controls

99 lines (75 loc) · 3.15 KB

AGENTS.md

This file provides vendor-neutral guidance for agentic coding tools working with Apache TVM.

Repository Overview

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.

Repository Structure

  • include/tvm/ - public C++ headers
  • src/ - C++ implementation
  • python/tvm/ - Python package
  • tests/ - C++, Python, integration, and lint tests
  • cmake/ - CMake modules and default configuration
  • 3rdparty/ - vendored dependencies and submodules
  • docs/ - documentation source
  • apps/ - application examples
  • .agents/skills/ - reusable agent workflows for this repository

Build

Use 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.

Test And Lint

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.

Coding Conventions

  • 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.