TiGrIS
Tiled Graph Inference Scheduler. An ahead-of-time compiler that tiles ML models to fit embedded devices with hard memory budgets.
Give it an ONNX model and a memory budget. It partitions the compute graph into stages, tiles spatial operations, and emits a flat binary plan that the tigris-runtime executes with zero dynamic allocation.
The problem
On an embedded device with a few hundred KB of SRAM, most interesting models simply don't fit. The usual answer is to shrink the model: quantize harder, prune, pick a smaller architecture, and hope the accuracy hit is acceptable.
TiGrIS takes the other approach. It keeps the model you trained and rearranges the computation so that only a small working set lives in SRAM at any moment. Weights and intermediate spills go to flash or PSRAM. What comes out is a binary plan that the runtime executes as a flat sequence of kernel calls, with no interpreter, no tensor allocator, and no dynamic memory at all.
Quick start
pip install tigris-ml
# Will this model fit in 256KB SRAM + 16MB flash?
tigris analyze mobilenetv2.onnx -m 256K -f 16M
╭──────────────────────── TiGrIS - mobilenetv2 ────────────────────────╮
│ Operators 65 │
│ Peak memory (naive) 4.59 MiB │
│ Largest tensor 1x96x112x112 (4.59 MiB) │
╰──────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────── SRAM ────────────────────────────────╮
│ Budget 256.00 KiB │
│ Scheduled peak 254.62 KiB (5.4% of naive peak) │
│ Stages 42 │
│ Need tiling 31 of 42 stages │
╰──────────────── PASS - tiling resolves all stages ─────────────────╯
The naive peak is 4.59 MiB. TiGrIS schedules it into 256 KiB through temporal partitioning and spatial tiling. analyze runs on your laptop; no hardware required.
From ONNX to embedded
Three steps take a model from ONNX to a C file you can drop into your firmware project:
# 1. Analyze feasibility against a memory budget
tigris analyze model.onnx -m 256K -f 16M
# 2. Compile to a binary plan (weights read-in-place from flash)
tigris compile model.onnx -m 256K -f 16M --xip -o model.tgrs
# 3. Generate a backend-specific C harness for your target
tigris codegen model.tgrs --backend esp-nn -o model.c
The .tgrs plan is target-agnostic: it is the same file whether you run it on an ESP32, a Cortex-M, or a POSIX host for testing. The choice of kernel backend happens at codegen time and decides which kernel library the generated C calls into.
Several kernel backends are available (portable C99, ESP32 family, Cortex-M
family). The generated operator/backend capability
matrix
shows which operators are native, use an explicit fallback, or are rejected.
Switching between them is a --backend flag, not a rewrite.
What you get
tigris compile writes a single .tgrs file that contains the operator schedule, tile parameters, quantization tables, and the weights. This file goes on flash at deployment time.
tigris codegen produces a small C harness that locates the plan on flash at runtime and hands it to the runtime:
- declarations for the input/output buffers and the arena
- a target entry point (
app_main()for ESP-IDF,main()for POSIX/Cortex-M examples) that sets up memory and calls the runtime - backend-specific glue for finding the plan: partition mmap on ESP-IDF, an
externflash symbol on Cortex-M, a file path on POSIX
Link the harness against tigris-runtime and your chosen kernel library, flash the .tgrs alongside the firmware, and you have a working inference binary.
Embedding in an existing application
The default --format app emits that standalone example program. Use
--format core when your firmware already owns its entry point, plan placement,
arenas, input source, or observability:
tigris codegen model.tgrs --backend cmsis-nn --format core \
-o generated/tigris_codegen_core.c \
--header generated/tigris_codegen_core.h \
--name model_codegen
Core output is backend-specific but platform-neutral. It produces a C source and
header that load the plan, reset runtime memory, prepare the selected backend,
and run the generated dispatcher. Initialize the core once, then reset it before
each subsequent inference. The embedding application supplies the plan
bytes, arena buffers, and an optional input-initialization callback. If
--header is omitted, codegen writes a sibling .h file next to --output.
--name prefixes the public C symbols, so multiple generated cores can coexist
in one firmware. The header also exports the model's tensor-table capacity,
plan budget, and compressed-weight reserve for static allocation decisions.
It also exports a plan-sized executor-workspace constant and buffer entry point,
so generated integrations reserve only the metadata this model needs without
manual limit tuning.
This is suitable for bare-metal firmware, RTOS applications, and custom
instrumentation without introducing a hardware-specific codegen target.
Further reading
- Getting started: installation, first compile, deploying to ESP32
- Core compatibility data: exact compiler/runtime releases and plan schemas
- Introducing TiGrIS: design, benchmarks, how tiling works
- CLI reference: every flag, every subcommand
Maintainer
TiGrIS is maintained by RAWS Labs. For applied embedded-ML engineering or collaboration, see raws.at.
Development
git clone https://github.com/raws-labs/tigris
cd tigris
pip install -e ".[dev]"
pytest
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tigris_ml-0.5.0.tar.gz.
File metadata
- Download URL: tigris_ml-0.5.0.tar.gz
- Upload date:
- Size: 136.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95f839f7d71a5abef62793cae7f8692e7a33617e20b4f03d42376851473fd8bb
|
|
| MD5 |
83da93678cb5d9a42ad4cf18ba9a9d6c
|
|
| BLAKE2b-256 |
7b7a28097624b7e44d3a6fbf3eb479a34419411288709934341f22e31a7b8263
|
Provenance
The following attestation bundles were made for tigris_ml-0.5.0.tar.gz:
Publisher:
publish.yml on raws-labs/tigris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tigris_ml-0.5.0.tar.gz -
Subject digest:
95f839f7d71a5abef62793cae7f8692e7a33617e20b4f03d42376851473fd8bb - Sigstore transparency entry: 2218321423
- Sigstore integration time:
-
Permalink:
raws-labs/tigris@549bc099e82f636b587bbe3a3624fcc9201c6d7a -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/raws-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@549bc099e82f636b587bbe3a3624fcc9201c6d7a -
Trigger Event:
release
-
Statement type:
File details
Details for the file tigris_ml-0.5.0-py3-none-any.whl.
File metadata
- Download URL: tigris_ml-0.5.0-py3-none-any.whl
- Upload date:
- Size: 92.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
728d6b13f184cca4da99532f9ce29fa53c881c9b52e9ccfc6541ae6bb399af0c
|
|
| MD5 |
cdc99134ddb34450afa7f0a6670d81b2
|
|
| BLAKE2b-256 |
7760eaabc3858fe3a54bf2d7eb63cb1644fe0cccf07f037bfe27cf55e319bd0b
|
Provenance
The following attestation bundles were made for tigris_ml-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on raws-labs/tigris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tigris_ml-0.5.0-py3-none-any.whl -
Subject digest:
728d6b13f184cca4da99532f9ce29fa53c881c9b52e9ccfc6541ae6bb399af0c - Sigstore transparency entry: 2218321445
- Sigstore integration time:
-
Permalink:
raws-labs/tigris@549bc099e82f636b587bbe3a3624fcc9201c6d7a -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/raws-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@549bc099e82f636b587bbe3a3624fcc9201c6d7a -
Trigger Event:
release
-
Statement type: