Struct anira_tensor#

struct anira_tensor#

Inheritance diagram for anira_tensor:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="anira::Tensor" tooltip="anira::Tensor"]
    "1" [label="anira_tensor" tooltip="anira_tensor" fillcolor="#BFBFBF"]
    "2" -> "1" [dir=forward tooltip="public-inheritance"]
}

Collaboration diagram for anira_tensor:

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

The runtime tensor: a descriptor of memory, never the memory itself. 216 bytes, align 8, identical on wasm32, LP64 and LLP64, trivially copyable. Tier 1: frozen; a new shape is a new struct with new functions. Zero the record before filling it by hand (the factories do): the high half of an ANIRA_PTR slot is otherwise undefined on a 32-bit target.

Subclassed by anira::Tensor

Public Members

uint32_t domain#

anira_domain: which arm of handle is live.

anira_dtype dtype#

The element type; 0 is not a type.

uint32_t ndim#

The rank, 0 to ANIRA_MAX_RANK; rank 0 is one element.

uint32_t flags#

anira_tensor_flags bits; the factories leave it 0, except anira_tensor_init_host_planar, which sets ANIRA_TENSOR_PLANAR.

int64_t shape[ANIRA_MAX_RANK]#

The extents: counts, never ANIRA_DYNAMIC; zero from ndim on.

int64_t strides[ANIRA_MAX_RANK]#

In elements; all-zero = packed row-major. Under ANIRA_TENSOR_PLANAR strides[0] is ignored and the rest apply inside each plane.

uint64_t byte_offset#

Byte offset of the first element from the base of handle (under ANIRA_TENSOR_PLANAR: from each plane pointer); what a view slices with.

anira_memory_handle handle#

The memory: the arm domain names.

void *manager_ctx#

Producer bookkeeping only (a pool slot, a refcounted view parent): what release reads, and nothing else reads it; never edge state.

anira_tensor_release_proc *release#

NULL = borrowed: the memory is the caller’s and stays valid until the ticket is terminal (Async) or the call returns (Hard). Else unmaps, unregisters, recycles or frees; see anira_tensor_release_proc.

anira_sync_token acquire#

An input: the data is valid once this signals. A bound output: the buffer is free to write once this signals.