How the toolkit is built
See which layer your code talks to, where the Rust core sits, and which part of the stack is closed source.
The toolkit is a Rust library with two front doors, a Python API and a C API. Both call the same Rust core. The core talks to the Q.ANT driver through a C interface, and the driver is the only closed-source layer.
The layers
| Layer | What it does | Source |
|---|---|---|
| Python API | Exposes the toolkit to Python with PyO3. Maturin builds it into the qant_native_computing_toolkit wheel you install. Functions such as init_npu, upload and linear_fprop_preloaded are defined here. | src/python_bridge.rs |
| C API | The same operations as extern "C" functions, for C and C++ programs. The headers sit next to it in src/c_bridge/. | src/c_bridge/mod.rs |
| Toolkit core | Checks arguments and builds each layer, such as linear, convolution, batch norm and pooling, from driver calls. The DFT, new in 2.5.0, lives in dft.rs. | src/, for example linear.rs and conv.rs |
| Driver interface | The C ABI between the core and the driver. Since 2.5.0 it has one part per card generation, gen2/ and gen2p/, and a device manager that knows each NPU’s capabilities and resolves device_id=-1 to a device that supports the operation. A build flag picks the backend behind each part. | src/qant_driver_import/ |
| Driver | Runs the physical NPU. Closed source. | Not public |
Two backends behind one interface
Each card generation has two backends, and the choice is made when you build the toolkit:
- Default build:
gen2/backend_driver.rsandgen2p/backend_driver.rslink against the Q.ANT driver library. You need a card and its driver. -F cpu-backend:gen2/backend_cpu.rsandgen2p/backend_cpu.rsreplace the driver with CPU code and simulate three Gen2 and three Gen2+ devices. Everything above them runs unchanged. Emulator and hardware explains what it computes.
What this means for you
- Python and C give the same results. Both APIs are thin wrappers over one Rust core, so an operation behaves the same from either language.
- Python version limits come from the Python API layer. PyO3 decides which Python versions the wheel supports. Since 2.5.0 the toolkit uses PyO3 0.29 with one
abi3wheel for Python 3.11 and newer. The older Python 3.15 workaround only ever touched the Python side, not the C library. - To see how an operation works, read the core. The open-source layers cover everything down to the driver interface.