TensorBuffer Struct
Storage handle for a tensor — opaque container for one of four backing memory kinds. More...
Declaration
Included Headers
Public Member Functions Index
| Mapping | map (MapMode mode) const |
|
Map the buffer for read/write access; returns a scoped Mapping. More... | |
Public Member Attributes Index
| StorageKind | kind = StorageKind::Unknown |
|
How the storage was acquired (CPU-owned, external, GstSample, device). More... | |
| Device | device {} |
|
Where the buffer is accessible. More... | |
| std::size_t | size_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_t | sima_mem_target_flags = ... |
|
SIMA memory target flags (advanced; for accelerator-aware allocators). More... | |
| std::uint64_t | sima_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 421 of file TensorCore.h.
Public Member Functions
map()
| 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 445 of file TensorCore.h.
Public Member Attributes
data
|
Optional direct pointer (some storage kinds set this; others rely on map_fn).
- Initialiser
-
= nullptr
Definition at line 428 of file TensorCore.h.
device
|
holder
|
Lifetime guard (shared_ptr that owns/refcounts the underlying memory).
Definition at line 427 of file TensorCore.h.
kind
|
How the storage was acquired (CPU-owned, external, GstSample, device).
Definition at line 422 of file TensorCore.h.
map_fn
|
Custom map function (set for non-trivial storage kinds).
Definition at line 431 of file TensorCore.h.
sima_mem_flags
|
SIMA memory flags (cache, alignment, etc.).
Definition at line 434 of file TensorCore.h.
sima_mem_target_flags
|
SIMA memory target flags (advanced; for accelerator-aware allocators).
- Initialiser
-
= 0
Definition at line 432 of file TensorCore.h.
sima_segments
|
Named segments for multi-region buffers (composite formats, packed outputs).
Definition at line 435 of file TensorCore.h.
size_bytes
|
Total backing-memory size in bytes.
Definition at line 425 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.