본문으로 건너뛰기

TensorBuffer Struct

Storage handle for a tensor — opaque container for one of four backing memory kinds. More...

Declaration​

struct simaai::neat::TensorBuffer { ... }

Included Headers​

#include <TensorCore.h>

Public Member Functions Index​

Mappingmap (MapMode mode) const

Map the buffer for read/write access; returns a scoped Mapping. More...

Public Member Attributes Index​

StorageKindkind = StorageKind::Unknown

How the storage was acquired (CPU-owned, external, GstSample, device). More...

Devicedevice {}

Where the buffer is accessible. More...

std::size_tsize_bytes = 0

Total backing-memory size in bytes. More...

std::shared_ptr< void >holder

Lifetime guard (shared_ptr that owns/refcounts the underlying memory). More...

void *data = ...

Optional direct pointer (some storage kinds set this; others rely on map_fn). More...

std::function< Mapping(MapMode)>map_fn

Custom map function (set for non-trivial storage kinds). More...

std::uint64_tsima_mem_target_flags = ...

SIMA memory target flags (advanced; for accelerator-aware allocators). More...

std::uint64_tsima_mem_flags = 0

SIMA memory flags (cache, alignment, etc.). More...

std::vector< Segment >sima_segments

Named segments for multi-region buffers (composite formats, packed outputs). More...

Description​

Storage handle for a tensor — opaque container for one of four backing memory kinds.

TensorBuffer is the abstraction over the four StorageKinds. The map_fn callback unifies the access path: regardless of where the bytes live (CPU heap, GStreamer pool, accelerator scratch), map(mode) returns a Mapping you can read or write. The holder shared_ptr keeps the underlying memory alive for the lifetime of the buffer (and any Mapping derived from it).

Multi-segment buffers (sima_segments) carry several named regions in one allocation — used for composite formats like NV12 (Y + UV) and packed multi-tensor MLA outputs.

Definition at line 503 of file TensorCore.h.

Public Member Functions​

map()​

Mapping simaai::neat::TensorBuffer::map (MapMode mode)
inline

Map the buffer for read/write access; returns a scoped Mapping.

If the storage has a custom map_fn, calls it. Otherwise, returns a Mapping wrapping the bare data pointer. Always sets keepalive to the buffer's holder so the Mapping safely outlives buffer destruction.

Definition at line 527 of file TensorCore.h.

Public Member Attributes​

data​

void* simaai::neat::TensorBuffer::data

Optional direct pointer (some storage kinds set this; others rely on map_fn).

Initialiser
= nullptr

Definition at line 510 of file TensorCore.h.

device​

Device simaai::neat::TensorBuffer::device {}

Where the buffer is accessible.

Definition at line 506 of file TensorCore.h.

holder​

std::shared_ptr<void> simaai::neat::TensorBuffer::holder

Lifetime guard (shared_ptr that owns/refcounts the underlying memory).

Definition at line 509 of file TensorCore.h.

kind​

StorageKind simaai::neat::TensorBuffer::kind = StorageKind::Unknown

How the storage was acquired (CPU-owned, external, GstSample, device).

Definition at line 504 of file TensorCore.h.

map_fn​

std::function<Mapping(MapMode)> simaai::neat::TensorBuffer::map_fn

Custom map function (set for non-trivial storage kinds).

Definition at line 513 of file TensorCore.h.

sima_mem_flags​

std::uint64_t simaai::neat::TensorBuffer::sima_mem_flags = 0

SIMA memory flags (cache, alignment, etc.).

Definition at line 516 of file TensorCore.h.

sima_mem_target_flags​

std::uint64_t simaai::neat::TensorBuffer::sima_mem_target_flags

SIMA memory target flags (advanced; for accelerator-aware allocators).

Initialiser
= 0

Definition at line 514 of file TensorCore.h.

sima_segments​

std::vector<Segment> simaai::neat::TensorBuffer::sima_segments

Named segments for multi-region buffers (composite formats, packed outputs).

Definition at line 517 of file TensorCore.h.

size_bytes​

std::size_t simaai::neat::TensorBuffer::size_bytes = 0

Total backing-memory size in bytes.

Definition at line 507 of file TensorCore.h.


The documentation for this struct was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.