Skip to main content

TOSA Tools: serialization library, reference model, optional MLIR translator

Project description

TOSA Tools

A toolkit for working with the Tensor Operator Set Architecture (TOSA) Specification (https://github.com/arm/tosa-specification), providing serialization, reference implementation, and MLIR translation capabilities.

Introduction

TOSA Tools is a composite project that integrates three main components:

  • reference_model – a reference implementation of TOSA operators.
  • serialization – provides methods to read and write serialized TOSA graphs.
  • mlir_translator – implements translators between the TOSA MLIR dialect and serialized representations.

Each subfolder contains its own README with more detailed information.

PyPI package

From v2026.02.0 onward, the tosa-tools Python package is published on PyPI. For most users, the quickest start is:

python -m pip install tosa-tools

This installs the Python APIs and command-line entrypoints from all the components (serialization + reference model + MLIR translator). For a concise list of the Python modules, executables, console scripts and shared libraries installed by the package, see PYTHON_PACKAGE.md.

Prerequisites

Platform support

The following platforms are supported:

Platform Architecture Support level
Linux x86_64 release
Linux aarch64 experimental
Windows (r) x86_64 experimental
macOS (r) aarch64 experimental

For build instructions see README.md for individual components.

System Requirements

Tool Version Note
Python 3.10 or later tested with 3.12.0
CMake 3.18 or later tested with 3.30

External Dependencies

LLVM/MLIR

The TOSA MLIR Translator must be linked against a build of LLVM with the MLIR project enabled. Currently, the TOSA MLIR Translator aims to be compatible with the main branch of LLVM. However, when breaking API changes are introduced in LLVM/MLIR, compatibility may not be guaranteed. We regularly update the tested SHA; see ci/vars/llvm-sha.yml for the current SHA.

Quick Build (POSIX)

Build all projects with default configuration:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Selective Build

Use TOSA_ENABLE_PROJECTS to build specific components:

Build only serialization library:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DTOSA_ENABLE_PROJECTS=serialization
cmake --build build

Build serialization and reference model:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DTOSA_ENABLE_PROJECTS="serialization;reference_model"
cmake --build build

Build MLIR translator:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DTOSA_ENABLE_PROJECTS="mlir_translator" \
    -DMLIR_TOSA_OPT=ON \
    -DMLIR_DIR=${LLVM_BUILD}/lib/cmake/mlir \
    -DLLVM_DIR=${LLVM_BUILD}/lib/cmake/llvm
cmake --build build

Build all projects (including MLIR translator):

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DTOSA_ENABLE_PROJECTS=all \
    -DMLIR_TOSA_OPT=ON \
    -DMLIR_DIR=${LLVM_BUILD}/lib/cmake/mlir \
    -DLLVM_DIR=${LLVM_BUILD}/lib/cmake/llvm
cmake --build build

Note: The MLIR translator requires MLIR to be available on your system. It is not enabled by default. LLVM_BUILD must be absolute path to llvm-project build directory.

Debug Build

For debug symbols:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTOSA_ENABLE_PROJECTS=reference_model
cmake --build build

Build and install with pip

The Python package is built with scikit-build-core, which drives a CMake build under the hood. This means pip install will compile native code and therefore requires a working C/C++ toolchain.

If you just want the prebuilt package, use python -m pip install tosa-tools as shown above. The steps below are for building from source.

Note: Starting with release 2026.05.0, the tooling to build/install the individual component Python packages from subdirectories will be removed. Use the unified tosa-tools package from the repository root (python -m pip install .).

Install default components (serialization + reference model)

This uses the default CMake definitions from pyproject.toml.

python -m venv .venv
source .venv/bin/activate

python -m pip install -U pip

# Build + install from the current checkout
python -m pip install . -v -Cbuild-dir=build/pip-install

Install with MLIR translator enabled

To build the MLIR translator you need a compatible LLVM/MLIR build. The tested LLVM commit is pinned in ci/vars/llvm-sha.yml.

Install tosa-tools with the required CMake config settings:

python -m pip install . -v -Cbuild-dir=build/pip-install \
    --config-settings=cmake.define.TOSA_ENABLE_PROJECTS="serialization;reference_model;mlir_translator" \
    --config-settings=cmake.define.MLIR_TOSA_OPT=ON \
    --config-settings=cmake.define.MLIR_DIR="${LLVM_BUILD}/lib/cmake/mlir" \
    --config-settings=cmake.define.LLVM_DIR="${LLVM_BUILD}/lib/cmake/llvm"

Build a wheel locally (optional)

python -m pip wheel . -w dist -v -Cbuild-dir=build/pip-wheel
python -m pip install --no-deps dist/*.whl

Development Environment

For a consistent setup, use the provided Docker configuration for development. This mirrors the CI environment closely. Please refer to the CI README for more details.

Pre-Commit Checks

Before pushing a commit, pre-commit checks must be run to ensure conformity.

NOTE: All commits pushed to remote must adhere to the structured commit format, please refer to CONTRIBUTING.md for detailed guidelines.

pre-commit install
pre-commit run --all

Versioning

This project uses Calendar Versioning (CalVer) in the format: YYYY.0M.Micro[.Modifier]

  • YYYY – 4-digit release year (e.g., 2025)
  • 0M – 2-digit Zero-padded release month (e.g., 07 for July)
  • Micro – The third and usually final number in the version. Sometimes referred to as the "patch" segment.
  • Modifier - Optional text tag used to signify extra information about the build.
    • no tag (empty string) - builds produced for release will have no tag at all.

The main branch is used as the active development branch for the next version.

Backward Compatibility

The TOSA Specification outlines its own backward compatibility guarantees and rules.

This section focuses on the backward compatibility guarantees of this project, which implements the specification.

"Software" refers to tools provided by this project or otherwise explicitly approved external ones. There are no guarantees when using hand-written files or ones generated by un-vetted tools.

  • Serialization

    • The Serialization library guarantees the ability to load .tosa flatbuffer files produced by earlier versions of the software, within a major TOSA specification version.
    • TOSA Specification features marked as experimental are an exception to the above and we may remove them and the ability to parse them after a notice period.
  • Reference Model & Conformance Tests

    • The Reference Model uses the Serialization library and is able to read flatbuffer files produced by older software.

    Compatibility between versions is determined by what changed in the following three areas: reference model result, compliance rules (defining tolerance), and conformance test content. For details on exact changes please refer to the RELEASE_NOTES.md supplied with each release.

    These changes are applied on a per-operator basis.

    • Reference model result

      • A bug fix to an operator can make it incompatible with conformance tests and numerical tolerances from previous software versions.
    • Compliance rules (Tolerance) With regards to compatibility between reference model results and tolerances, we currently make no guarantees that two versions would be compatible with each other.

      TOSA Specification outlines that changes to the compliance rules are allowed in both directions: tightening and restricting. And as this implementation follows the specification it is possible that a change in tolerance causes incompatibility between two versions.

    • Conformance test content

      • Bug fixes in the CTS can alter generated tests and their values, making new Reference Model implementations potentially incompatible with older Conformance Tests.
  • TOSA MLIR Translator

    • The MLIR Translator uses Serialization library and is able to read flatbuffer files produced by older software.
    • MLIR Translator depends on the TOSA MLIR dialect which can change in incompatible ways and there is no backward compatibility guarantee when reading older TOSA MLIR dialect files and/or generated with a version of LLVM that is earlier than the tested version. Refer LLVM/MLIR for more details.

License

The TOSA Tools components are licensed as follows:

  • TOSA Serialization Library: Apache-2.0
  • TOSA Reference Model: Apache-2.0
  • TOSA MLIR Translator: Apache-2.0 with LLVM Exceptions

See individual component directories for detailed license information and third-party project licenses.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tosa_tools-2026.5.0-cp313-cp313-win_amd64.whl (38.7 MB view details)

Uploaded CPython 3.13Windows x86-64

tosa_tools-2026.5.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (38.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_tools-2026.5.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (34.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_tools-2026.5.0-cp313-cp313-macosx_15_0_arm64.whl (31.7 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

tosa_tools-2026.5.0-cp312-cp312-win_amd64.whl (38.7 MB view details)

Uploaded CPython 3.12Windows x86-64

tosa_tools-2026.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (38.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_tools-2026.5.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (34.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_tools-2026.5.0-cp312-cp312-macosx_15_0_arm64.whl (31.7 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

tosa_tools-2026.5.0-cp311-cp311-win_amd64.whl (38.7 MB view details)

Uploaded CPython 3.11Windows x86-64

tosa_tools-2026.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (38.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_tools-2026.5.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (34.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_tools-2026.5.0-cp311-cp311-macosx_15_0_arm64.whl (31.7 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

tosa_tools-2026.5.0-cp310-cp310-win_amd64.whl (38.7 MB view details)

Uploaded CPython 3.10Windows x86-64

tosa_tools-2026.5.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (38.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_tools-2026.5.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (34.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_tools-2026.5.0-cp310-cp310-macosx_15_0_arm64.whl (31.7 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file tosa_tools-2026.5.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 59b9e93667b2745c563114bbd5c911a19821c557834de18a87101dadbb0cd3b4
MD5 56f8600bb3654c1214ee3b91dec196e5
BLAKE2b-256 276a365f1cbabf45c589779254cdd810feeced9e332d7e6b595c733404d7f99f

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 418392eb7e7d884c39b6b4ce0047b9368a20b4940832c30f6640975870e826d9
MD5 f7a7cb004fe19e4f3d0b1e975dd9c14a
BLAKE2b-256 2d23a86c45d91a7c71e61a2d845b5e2b839da90febe1b278c07e4d5f21000031

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 39280426d531656d1815b1c94f0ccbc4d5cb893e66ceda6618b6220621ced4e8
MD5 028894226b1fd06f9baa160d0d841385
BLAKE2b-256 5941cf5f511f7fbc7b4ee6c94ef62d7bf95298d9dd9290f6d3dba2b74bb9743c

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0606036a7876a101a3c5404abb53bea75fdd4503d4536cbe480f4ec6087c79db
MD5 94346c8d807a072c7db65767328df2d3
BLAKE2b-256 f98e685ebee6f553c5024c2e8a14b628f638c76597276b6f96376245823b9ba3

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ca9eb5263487f4a7e63c7e5bd8d47fc93a9b6041c3416a9916638d6608b5fbe1
MD5 1f7aa42aabaf40662a878d07bd12c1e4
BLAKE2b-256 7a6374a1daa4cff37a5047eb83dce8155ca318c884c899c61d065f0995b5d6bb

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 145ad87ee4b0fb9061bec0c327d33260510fe0939452239bb349507d405bbe5a
MD5 82827f92bad17b002ebdf5337537cffa
BLAKE2b-256 a3d7cbb17fa4f85524c18fa555287f9c5145a7668dbc86312091d6d8b48324d3

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bcb0efc24fa00425e2518991cf872f9628ad0687022872f3c90547309344b967
MD5 d74d62d4cd6c5b115b0599e77f1dd660
BLAKE2b-256 1219a8c633297328c8b19638bb6d4e898e195c15ff304d9505b9b38e38c54e6e

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 50aba2263e4234406bad3730610f6cade18954408e49b43f1acde1886eb34d2d
MD5 4fff06d3be3accab97c324209dddafdd
BLAKE2b-256 c988ee09c4a3c1f9c940a8537e2458c4d96d1c2eefa2e6982b3bdcd8393779b6

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 95e52cd83216101809dd9575753a63807c6b3f4a9c306e0776615c190aa5db48
MD5 070a2b08dd835fb9969dbfeadf46d553
BLAKE2b-256 5fdf0d1f7b6a616a4d85c3c8b5894f5db0048fd7d7baa7ecb10e490c3b5bd8b1

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 db94e2d5513c210b27bc7d707479ed8a6f6db38e2daead7b0d8742d90045c9e6
MD5 605f306953522523d2ffff71dd13227a
BLAKE2b-256 a577c7b1ad1f0261713c9194ae5992dfbc783b3b40c2dfa3e00d36daa0d2a36c

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c775fa5e8ec681b5e28e2ad914050adc40733532bb4f4a562e80cd6a58593fe5
MD5 b4974c37bfca4e8ab07bbe99302aee35
BLAKE2b-256 b730cef18380e22118329b96168f2342c683098c5f8baab7b813e871584b9ec2

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 27842d9b22b9e002399b426782c297ab932e0da455a46296e6263ee8348f5b19
MD5 db30247fb0a6722fd124da1352c9b19f
BLAKE2b-256 e105563549c46331074a653fd3f8c6b550e483c8cf4c456d2f31ff19d3494f81

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 927cba55cf73e1576e24a0a104410ff1b4349df07cf07f77ef11ccdafbcc069c
MD5 edf849c3eda87983d869c0e044af3d1d
BLAKE2b-256 32a2a8d7862d61c81189ab46aaae3df88271e929068533f9e2f81bd8e6c3f1b4

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fe7b9c4e698310c60bbf047eae4741cd4bc458c9df3bedd179f5f2bb8f075bd3
MD5 b806f7f2a6231c1e0263069d3ae21ff5
BLAKE2b-256 4ad084daa906060190f37090d822879dc5ebed2ac4dc5932a47510aa8b9dcf1a

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 485a4968ba29d0ddadadabbe4c740151e1e3f82de3aafed6d488d2ef43cc8570
MD5 a7b53f9035512c535f61cf94e3f67d6c
BLAKE2b-256 29d93d6ac9533c89c67b87ace95b785a21e1a0ab70819e55a3a7d4fd71e30fc8

See more details on using hashes here.

File details

Details for the file tosa_tools-2026.5.0-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for tosa_tools-2026.5.0-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ff599f59cea300a6b77d1ea1620551292cf1c2f941f672615acee4692cd37a49
MD5 085b60489a2fdc17327aed9f7483202e
BLAKE2b-256 574ee8a636b9dfd8285e678b7f244495f545292c3e8f0e9377005224080f9922

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page