Repository Structure and CI Workflows#

This page explains how the source code is organized and how the continuous-integration workflows are structured for each component of yet-another-onnx-builder (yobx).

Overview#

The repository is organized as a set of mostly-independent optional sub-packages under yobx/. Each sub-package has its own unit-test directory under unittests/ and typically a dedicated CI workflow. The table below summarizes the mapping:

Library

Source

Tests

CI Workflows

Core / Builder

yobx/xbuilder/, yobx/builder/onnxlight/, yobx/xshape/, yobx/container/, yobx/helpers/, yobx/reference/

unittests/ (excluding library sub-directories)

core_tests.yml

scikit-learn (and xgboost, lightgbm, perpetual)

yobx/sklearn/

unittests/sklearn/

ci_sklearn.yml, ci_perpetual.yml

PyTorch / Transformers

yobx/torch/

unittests/torch/

torch_tests.yml, ci_transformers_dev.yml, ci_transformers_releases.yml

TensorFlow

yobx/tensorflow/

unittests/tensorflow/

tensorflow_tests.yml

On top of the per-library workflows there are cross-cutting quality checks that run on every push:

Workflow

Purpose

build.yml

Builds and uploads the Python package (python -m build).

docs.yml

Builds the Sphinx documentation (triggered by .rst / .md changes only). TensorFlow gallery examples are built first in a dedicated single-threaded pass (sphinx_gallery_conf.filename_pattern=/tensorflow/), then the full documentation is built in a second pass.

mypy.yml

Static type-checking of the whole yobx/ package.

style.yml

Linting with ruff.

spelling.yml

Spell-checking of documentation strings with codespell.

pyrefly.yml

Experimental type-analysis with pyrefly.

Core / Builder#

The core of the library lives in several tightly-coupled sub-packages:

  • yobx/xbuilder/ — GraphBuilder, the main API for constructing and optimizing ONNX graphs. See GraphBuilder for a full description.

  • yobx/builder/onnxlight/ — native graph builder bridge that exposes the published onnx-light GraphGraph optimizer through OptimizationOptions.

  • yobx/xshape/ — symbolic shape-expression system used internally by GraphBuilder. See Native symbolic shape inference.

  • yobx/builder/ — lightweight builder helpers and the native onnx-light bridge. The former Spox and onnxscript bridges are no longer supported because they require reference ONNX.

  • yobx/container/ — ModelContainer for grouping several ONNX models that share initializers.

  • yobx/helpers/ — general ONNX and runtime utilities shared by all sub-packages.

  • yobx/reference/ — reference evaluators (onnxruntime, torch).

Tests#

Core tests live directly under unittests/. Each library has its own subfolder and CI file.

See Environment Variables for Unit Tests for a reference of all environment variables that can be set to control test execution and enable extra diagnostic output.

Native wheel installation#

The shared install-onnx-light action reads the onnx-light requirement from pyproject.toml and downloads the full GitHub release wheel for its minimum version. Updating that dependency updates CI’s selected release without editing workflow version numbers. The installer retains a --version override for explicit release testing. Its --check-installed option validates the installed distribution against the same project requirement after other dependencies are installed.

ONNX Runtime compatibility#

Conversion defaults track the latest opset exposed by onnx-light, which can be newer than the opset or IR version supported by ONNX Runtime. Execution tests and runnable examples therefore request an explicit runtime-compatible opset (opset 26 with IR version 13 for ONNX Runtime 1.31.1, the minimum required version). The runtime evaluator and shared parity tests use these versions. Tests covering older operators retain their explicit versions. Default-selection tests separately check the latest opset without passing those models to ONNX Runtime. The same explicit version is needed in shared tracing helpers and in tests that execute through InputObserver.check_discrepancies or validate_model(do_run=True). These paths still create ONNX Runtime sessions, even when the test does not instantiate a session directly.

Native fusion coverage and remaining regressions#

Tests previously skipped pending onnx-light 0.1.33 are exercised with the minimum required 0.2.7 release. Nested conditional functions and dynamic grouped matrix multiplication work with that release. The grouped matrix multiplication test checks both retained and inlined Scan functions. The reshape/MatMul composition tests run Cast elimination before the fusion pass because 0.2.0 canonicalizes Identity nodes at optimization entry. Tiny-LLM fusion tests use opset 24 and run without version-based expected failures, including float16 exports and transformer patches. They check the standard Attention and RMSNormalization operators and a retained native rotary fusion.

Native Attention and RotaryEmbedding patterns already exist in 0.1.32. The export bridge previously expanded optimizer-generated functions again when inlining converter functions, undoing these fusions. It now inlines only the original converter functions and retains functions introduced by native optimization, including their nested dependencies. Shape inference expands a copy of the model without removing fusions from the exported model. Selective inlining uses the native graph operation to keep function opsets and value-lifetime metadata consistent. Explicit inlining also removes discarded imported definitions from the bridge’s function registry.

Structural checks distinguish converter functions from native onnx.light.rewriting initializer helpers and allow fused Gemm nodes for Dense layers. When independently optimized functions reuse a generated name for different bodies, the bridge renames the incoming helper and its calls, including calls inside nested subgraphs. Conflicting user-defined nested functions still raise an error.

Focused numerical regressions check the native rewrite reports for FunctionAttention, FunctionHalfRotaryEmbedding and RotaryEmbedding, including repeated exports and nested function exports. The standard RotaryEmbedding pattern requires unshared doubled cosine/sine caches. Tiny-LLM shares caches between query and key and may instead retain the native HalfRotaryEmbedding function.

The native regressions fixed in 0.1.33 run without expected failures:

  • Tiny-LLM submodule export preserves unknown dimensions instead of INT64_MAX (xadupre/onnx-light#5298).

  • The sequence-splitting optimization emits split sizes that cover the input dimension (xadupre/onnx-light#5299). The regression also checks numerical outputs.

Their conditional pytest.mark.xfail markers apply only to older releases; the minimum required 0.2.7 release no longer allows these failures.