Migrating from anira 2.x#
anira 3 replaces the 2.x classes with a versioned C ABI: the handles of anira/abi/, the C++
builders of anira/anira.hpp over them, and three JSON files. The guides describe the 3.x API
only; these pages collect what a 2.x user needs on top: what each 2.x entity became, what the
loaders do with a 2.x JSON file, and how long the 2.x classes stay.
You have |
Start with |
|---|---|
an |
|
a 2.x JSON configuration file |
|
calls on the 2.x |
|
a custom |
|
a custom |
|
2.x code that must keep compiling for now |
|
the 2.x TypeScript classes of Anira Web |
Where the 2.x API stands#
``<anira/anira.h>`` is the C11 umbrella of the C ABI (every promised header of
anira/abi/), no longer the umbrella of the 2.x classes. A 2.x program replaces it with#include <anira/compat/v2.hpp>and addsusing namespace anira::v2;(The shim); C++ against the 3.x API includes<anira/anira.hpp>.Configuration is the 3.x handles (Models and tensors, Contracts, The context) and the JSON files (The three files). The library’s own 2.x classes are removed:
anira::InferenceConfigwithModelData,TensorShapeandProcessingSpec(<anira/InferenceConfig.h>),anira::HostConfig(<anira/utils/HostConfig.h>),anira::InferenceBackend,anira::BackendBase(<anira/backends/BackendBase.h>),anira::PrePostProcessor,anira::Buffer/BufferF/MemoryBlock,<anira/utils/helperFunctions.h>,anira::ContextConfigwith itsLogConfigand theLogLevel/LogDrain/WaitStrategyenums (<anira/ContextConfig.h>), the 2.xanira::Contextandanira::JsonConfigLoader.anira/compat/v2.hppdeclares the ones a 2.x host’s code names innamespace anira::v2(The classes and what differs from 2.x), with noBuffertemplate, noMemoryBlockand nothing ofhelperFunctions.h: a host buffer is the host’s own container, ananira_tensordescribes it.anira::ContextConfigofanira/anira.hppis the 3.x context configuration, the same role under the same name.The runtime is
anira::InferenceHandlerofanira/anira.hpp, the C++ face of the C handler ofanira/abi/handler.h: created on a context from a pipeline, prepared with the contract, the Hard entries over host tensors (The pipeline and the handler, Real-time processing). The 2.x class of that name and itsfloat***forms are removed (The handler entries), andanira::InferenceManager, a public header in 2.x, is private (src/scheduler/), itsfloat***functions gone. A customPrePostProcessorbecomes the pipeline’s processor (Custom Pre/Post Processing), a customBackendBasea registered engine (Custom Engines), which runs like a built-in one. A 2.x host that keeps its code compiles againstanira/compat/v2.hpp, which runs it on the same C handler (The shim).The bundled models. The 2.x fixture headers with their
anira::InferenceConfigstatics (cnn_config,hybridnn_config,rnn_config,gain_config,stereo_gain_config,rave_funk_drum_configand the encoder and decoder) are gone. Every bundled model ships a model file and a contract file next to its model directory (extras/models/**/*.model.json,*.contract.json;extras/models/model_files.hnames them), which the examples load withModelConfig::from_fileandContractHandle::from_file.CNNConfig.h,HybridNNConfig.handStatefulRNNConfig.hkeep builders (cnn_model_config(hop, size),hybridnn_model_config(batches),rnn_model_config(chunk)) for the benchmark sweeps alone. A project that included the old headers (the nn-inference-template, for one) loads the files instead. The files set no instance ceiling, so the count is the pool’s (ANIRA_INSTANCES_AUTO; the 2.x statics ran half the hardware threads, the default pool’s size); a configuration that wants fewer setsmax_instances. The per-model CMake variables (GUITARLSTM_MODELS_PATH_*,STEERABLENAFX_MODELS_PATH_*,STATEFULLSTM_MODELS_PATH_*,SIMPLEGAIN_MODEL_PATH,RAVE_MODEL_DIR,*_JSON_CONFIG_PATH) are gone with them;ANIRA_EXTRAS_MODELS_DIR, the root of the model tree at run time, is the one left. The bundled contract files run the 3.x defaults (a measured budget,UNTIL_STABLE), so their latency depends on the machine; pin"budget": {"ms": x}for a fixed one (The three files).
When the 2.x classes go#
The library’s 2.x classes and their headers are removed (above), the transitional bridge of the
first alpha with them (The removed bridge). anira/compat/v2.hpp is what 2.x code compiles
against, and it is removed one minor release after 3.0.0. No [[deprecated]] attribute marks it
through the alpha releases; every entity gains one before 3.0.0. The 2.x JSON document is read by
the 3.x loaders for as long as the 3.x line lives (JSON files).