Skip to content

Latest commit

 

History

History
173 lines (123 loc) · 3.94 KB

File metadata and controls

173 lines (123 loc) · 3.94 KB

Development Guide

This guide covers setting up a development environment, running tests, and formatting code. All developer workflows go through the ./ccex helper script in the repository root.

Table of Contents

Environment setup

Run the commands below to configure the testing and/or formatting environment:

./ccex configure          # testing & formatting environment
./ccex configure format   # formatting environment only
./ccex configure test     # testing environment only

Note

./ccex configure test installs TICO in editable mode. Use ./ccex configure test --dist to install from the built wheel instead.

Available options

Option Description
--torch_ver <ver> Torch (and torch-family packages, e.g. torchvision) version to install: a family (2.5 ~ 2.10), an exact version (e.g. 2.7.0+cu118), or nightly. Default: 2.7
--cuda_ver <maj.min> Override the detected CUDA version (e.g. 12.1)
--cpu_only Force a CPU-only installation
./ccex configure test                    # stable 2.7.x (default)
./ccex configure test --torch_ver 2.6    # stable 2.6.x
./ccex configure test --torch_ver nightly

Testing

Run all tests

./ccex test
# OR
./ccex test run-all-tests

Note

Unit tests don't include model tests — see Model tests.

Run a subset

To run a subset of test.modules.*, use ./ccex test -k <keyword>:

# Tests in a specific sub-directory (op/, net/, ...)
./ccex test -k op
./ccex test -k net

# Tests in one file (single/op/add, single/op/sub, ...)
./ccex test -k add
./ccex test -k sub

# The SimpleAdd test in test/modules/single/op/add.py
./ccex test -k SimpleAdd

Debugging aids

To see the full debug log, add -v or set TICO_LOG=4:

TICO_LOG=4 ./ccex test -k add
# OR
./ccex test -v -k add

To dump the intermediate torch graph IR as .png, set TICO_GRAPH_DUMP=1:

TICO_GRAPH_DUMP=1 ./ccex test -k add
# Images are dumped into $(pwd)/.tico_temp

Model tests

To run model tests locally, install each model's dependencies first, then run the tests one by one:

pip install -r test/modules/model/<model_name>/requirements.txt

# Run a single model
./ccex test -m <model_name>

# Run models whose names contain "Llama" (Llama, LlamaDecoderLayer, LlamaWithGQA, ...)
# Note: quote the wildcard(*) pattern
./ccex test -m "Llama*"

For example:

./ccex test -m InceptionV3

Runtime selection

By default, ./ccex test runs all modules with the circle-interpreter engine. You can run tests with the onert runtime instead.

Supported runtimes

  • circle-interpreter (default) — uses the Circle interpreter for inference.
  • onert — uses the ONERT package for inference; useful when the Circle interpreter cannot run a given module.

0. Install ONERT

pip install onert

1. Command-line flag

# Run with the default circle-interpreter
./ccex test

# Run all tests with onert
./ccex test --runtime onert
# or
./ccex test -r onert

2. Environment variable

# Temporarily override for one command
CCEX_RUNTIME=onert ./ccex test

# Persist in your shell session
export CCEX_RUNTIME=onert
./ccex test

Code formatting

Install the formatting requirements:

./ccex configure format

Run the formatter:

./ccex format

See also