Threading implementation and ownership#
The root-level onnx_threads/ project is an independent C++20 library.
The dependency direction is:
platform threading facilities
^
onnx_threads
^
onnx_proto
^
onnx_light
It contains queued I/O workers and their lazy batch adapter, persistent computation workers, CPU topology and affinity policies, compatible-executor sharing, nested dispatch, thread-local executor/profiling scopes, hardware counter collection, completion state, and the bounded fork/join implementation used by the BLAKE3 adapter.
Existing proto and runtime headers forward to the same definitions. There is no dependency from the threading library to serialization, ONNX model types, Python, or the model runtime. The generic CPU descriptor lives with the topology-dependent execution policies; runtime tuning still consumes that descriptor through its existing include path.
ONNX-specific integration#
Streams retain ownership of read/write lifetimes, adaptive I/O policy and tensor materialization. Sessions retain graph execution and kernel integration. Persistent-value transactions retain their publication logic while using the generic completion primitive. BLAKE3 retains its hash-specific callback and parallelization threshold, delegating worker admission and joining.
See Standalone threading for the implementation API and
onnx_threads/README.rst for standalone build, install, consumption, ownership,
and binary deployment requirements. Existing CMake package targets propagate
the dependency; shared deployments must also ship the new threading library.