Struct anira::Hard#

struct Hard#

Collaboration diagram for anira::Hard:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="anira::Budget" tooltip="anira::Budget"]
    "1" [label="anira::Hard" tooltip="anira::Hard" fillcolor="#BFBFBF"]
    "4" [label="anira_memory_handle" tooltip="anira_memory_handle"]
    "5" [label="anira_sync_token" tooltip="anira_sync_token"]
    "3" [label="anira_tensor" tooltip="anira_tensor"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "1" -> "3" [dir=forward tooltip="usage"]
    "3" -> "4" [dir=forward tooltip="usage"]
    "3" -> "5" [dir=forward tooltip="usage"]
}

The real-time stream: host blocks, budget, warmup, miss policy, wait ratio.

Public Members

double host_block_min = 0#

The host blocks: the smallest and largest block the host passes per call, in elements of the model’s anchor tensor (ModelConfig::anchor), both 0 (unset) or both finite and > 0, a fractional block included (0.25: one element every fourth call; the rules of anira_contract_create_hard). An integer converts: .host_block_max = 512. The contract file’s keys of the same names. What the host must provide carries the host_ prefix.

double host_block_max = 0#
double host_rate = 0#

The anchor’s elements per second the host runs at: the sample rate for an audio anchor, sample_rate / 2048.0 for a control-rate one. The contract file’s “host_rate”.

Budget budget#

The per-inference budget: measured by the warm-up pass by default, explicit from a duration (.budget = 5ms).

anira_warmup_mode warmup = ANIRA_WARMUP_UNTIL_STABLE#
uint32_t warmup_iterations = 0#

Fixed only.

anira_miss_policy on_miss = ANIRA_MISS_BYPASS#
anira_miss_fn miss_fn = nullptr#

ANIRA_MISS_CALLBACK only: the backup function that fills a missed block, and the pointer it is handed. A raw function pointer, called on the driver thread; it and what miss_user_data points at must outlive the prepared handler. Under clang the function must be declared ANIRA_NONBLOCKING.

void *miss_user_data = nullptr#
double wait_ratio = 0#

v2 blocking_ratio

std::map<std::string, DType> ring_dtypes = {}#

The ring dtype per Streamed tensor by canonical name (anira_contract_hard_set_ring_dtype; the spec’s dtype for every tensor not named): the element type of the host’s samples, set only where it differs from the model’s and a converting processor goes with it.

std::map<std::string, uint32_t> latencies = {}#

The declared stream latency per Streamed output by canonical name, in samples of that output (anira_contract_hard_set_latency): it replaces the computed figure and primes the receive ring; every output not named keeps the computed one.

std::optional<anira_edge_class> edge_cost = {}#

The worst edge class a plan may take for any slot (anira_contract_set_edge_cost, the contract file’s “edge_cost”): prepare drops a plan above it. A class of the cost scale is a limit: ANIRA_EDGE_DEDICATED_TRANSFER admits every known edge, ANIRA_EDGE_UNIFIED_TRANSFER crossings between the CPU and a device within unified memory only (no bus), ANIRA_EDGE_COPY no crossing between domains, ANIRA_EDGE_ZERO_COPY no copy at all, and every limit refuses an ANIRA_EDGE_UNKNOWN edge. std::nullopt, the default, is no limit: every edge, an unknown one included (the C value ANIRA_EDGE_UNKNOWN).