Struct anira_processor_ctx#
-
struct anira_processor_ctx#
What a phase callback of a processor sees. Tier 1: 64 bytes, frozen, identical on every target; no struct_size. anira fills one on its own stack per call: the record and the frame it names are valid until the callback returns, and a record kept beyond it must not be handed to an accessor. Every scalar but phase has the same value in all four phases of a chunk. The tensors and the rings are not in the record: a processor asks for them per slot through anira_processor_input_role, anira_processor_input_ring, anira_processor_input_tensor and their output twins, handing over the ctx as it received it. What a phase exposes: pre_process the input rings and the model’s input tensors (a State input has no host end and is not exposed), before_inference the input tensors, after_inference the output tensors, post_process the output tensors (State outputs excepted) and the output rings, reset (ANIRA_PHASE_RESET, the processor’s reset slot) the roles alone.
Public Members
-
uint32_t phase#
anira_phase: the phase this call runs in.
-
uint32_t engine#
anira_engine of the plan the chunk was submitted under; ANIRA_ENGINE_CUSTOM for a custom engine, whose id anira_processor_engine reads.
-
uint32_t provider#
anira_provider of that plan; ANIRA_PROVIDER_CUSTOM for a custom provider, whose name anira_processor_provider reads.
-
uint32_t variant#
The variant of that plan; 0 in this pre-release.
-
uint32_t num_inputs#
The tensors of the model’s input list, State tensors included: the slots the input accessors answer for. A slot is the tensor’s position in the model config’s input list: the number every entry of anira_handler and every row of the plan report uses.
-
uint32_t num_outputs#
The tensors of the model’s output list, State tensors included: the slots the output accessors answer for, each the tensor’s position in the model config’s output list.
-
uint32_t ticket#
The anira_ticket of the submitting job under an Async contract; ANIRA_TICKET_INVALID under a Hard contract.
-
uint32_t entry#
The chunk’s position in the handler’s chunk pool: 0 .. anira_handler_num_entries() - 1 (anira_prepare_info.num_entries), the same value in every phase of the chunk, its reset included, reused by a later chunk once this one has completed (under an Async contract the slot part of the ticket). Chunks of one handler may be in flight on several inference threads at once, and one entry holds one chunk at a time: the index of a per-chunk scratch the processor sized at prepare with anira_handler_num_entries, so that what pre_process pops or computes for a chunk is found again by before_inference, and what before_inference keeps is found again by after_inference (the two halves of an overlap-add, for one), without an allocation.
-
const void *frame#
anira’s own: what the accessors read. Valid for the duration of the callback. A processor never dereferences it and never writes it.
-
const char *engine_id#
anira’s own: what anira_processor_engine reads beside the engine field (the plan’s custom engine id, NULL for a built-in engine). Valid for the duration of the callback. A processor reads it through the accessor and never writes it.
-
const char *provider_id#
anira’s own: what anira_processor_provider reads beside the provider field (the plan’s custom provider name, NULL for a provider of the enum). Valid for the duration of the callback. A processor reads it through the accessor and never writes it.
-
void *reserved_ptr2#
NULL.
-
uint32_t phase#