The handler, the processor and the engine#
The handler entries#
The 3.x runtime is anira::InferenceHandler of anira/anira.hpp over the C handler of
anira/abi/handler.h (The pipeline and the handler, Real-time processing), with the processor
of anira/abi/processor.h (Custom Pre/Post Processing). It is created on an
anira::Context from an anira::Pipeline (anira::InferenceHandler
handler(context, pipeline) over pipeline.add_inference(cfg)), where the 2.x handler took a
processor, the configuration and a ContextConfig. What each 2.x call becomes (handler is the
anira::InferenceHandler, h the anira_handler of the C entry in brackets; a block
is an anira::Tensor, the anira_tensor of Runtime tensors):
anira 2.x |
anira 3.x |
|---|---|
|
|
|
Two tensors, or |
the |
|
|
|
|
The |
the returned sample count |
|
|
|
|
|
|
|
|
The declared stream latency of an output on the Hard contract,
|
|
|
|
|
|
|
|
|
|
|
The processor#
What each virtual and helper of a custom 2.x PrePostProcessor becomes on the processor (the C
descriptor anira_processor_desc, or anira::Processor in C++):
anira 2.x |
anira 3.x |
|---|---|
|
An |
the members of a processor (a scratch sized in its constructor from the config) |
The prepared object of one handler: |
a static of the processor class, shared by every instance of it |
|
|
|
|
|
|
|
|
|
|
|
|
Nothing: anira materialises a Static input into the model tensor ahead of
|
the sizes of |
The |
the |
The ring accessors state the dtype: another one than the ring’s moves nothing, returns
|
a virtual that throws |
A returned status: the callbacks are |
the audio-thread rule of |
The promise per phase ( |
the hidden-state splice in the hooks (the |
Declared state: |
the FFT of a spectrogram processor |
Stays in |
A 2.x processor also runs unchanged as a 3.x pipeline’s processor through
anira::v2::LegacyProcessor (The classes and what differs from 2.x).
The engine#
What each virtual of a custom anira::BackendBase becomes on the engine (the C descriptor
anira_engine_desc, or anira::Engine in C++; Custom Engines):
anira 2.x |
anira 3.x |
|---|---|
|
An |
|
Two levels. The loaded model: |
|
|
|
|
the instance pool of a processor ( |
|
a hidden state kept inside the backend, cleared by hand |
|
a static of the backend class, shared by every instance of it (a device context, a thread pool) |
|
the destructor |
|
|
|
The removed bridge#
The first alpha carried <anira/compat/v3_to_v2.h> (namespace anira::v3compat), which turned a
3.x configuration into the 2.x classes the 2.x handler took. It is removed with that handler. A host
that wrote its configuration in 3.x and drove the 2.x handler through the bridge hands the same
objects to anira::InferenceHandler:
The bridge |
anira 3.x |
|---|---|
|
|
|
|
|
The Hard contract’s host blocks ( |
|
|
|
|
#include <anira/anira.hpp>
anira::ModelConfig cfg = ...; // usage/models
anira::ContractHandle contract = ...; // usage/contracts
anira::Context context{anira::ContextConfig{}};
anira::Pipeline pipeline;
pipeline.add_inference(cfg);
anira::InferenceHandler handler(context, pipeline);
// prepare, once the host blocks are known
contract.hard_host_blocks(samples_per_block, samples_per_block, sample_rate);
const anira::PlanReport report = handler.prepare(contract);
What the bridge refused because the 2.x runtime could not run it runs on the 3.x handler: a spec
dtype other than float32, a host ring dtype other than float32 (Hard::ring_dtypes), the
UNTIL_STABLE warm-up, a measured budget, an on_miss other than BYPASS, a provider pin and
the provider options, a custom engine under any id. The Async contract and a layout that moves an
axis of extent above 1 (a transpose) are still refused at prepare with ANIRA_ERROR_NOT_SUPPORTED
(What this pre-release does not run yet), as they were by the bridge.