- Before running tests for native/compiler changes, run
makein the triton directory to rebuild triton. DO NOT RUNmakeif you only changed Python code or code inpython/triton_kernels. - For compiler changes, add tests in
python/test/(pytest) or test (lit). Keep GPU-only tests inpython/test/unit/orpython/test/gluon/, name themtest_<feature>_<condition>, and avoid creating new test files unless requested. - Run pytest with
-s --tb=short. Run a single test withpytest file.py::test_name. - The build dir is given by
BUILD_DIR := $(shell PYTHONPATH="./python" python3 -c 'from build_helpers import get_cmake_dir; print(get_cmake_dir())') - Run lit from the build dir:
cd BUILD_DIR; ninja triton-opt; lit -v test/<path>.mlir(example:lit -v test/TritonNvidiaGPU/tmem_layouts.mlir). - Lit tests can be run locally (no GPU required).
- Compiler crashes sometimes print an MLIR reproducer (external_resources / mlir_reproducer). Save the full MLIR + {-# ... #-} metadata to
/tmp/<file>.mlir, then runtriton-opt /tmp/<file>.mlir --run-reproducerto reproduce locally.
- In C++, never put side-effecting code in
assert. Assertions may be compiled out, so perform mutations and other required computation before the assertion and assert only the resulting condition. This guideline does not apply to Pythonassertstatements.