Union anira_memory_handle#

union anira_memory_handle#
#include <tensor.h>

The memory of a tensor, one arm per anira_domain (HOST and HOST_PINNED share host); 24 bytes on every target. Tier 1: frozen. Every arm is typeless memory and every vendor type is replaced by its wire width; image-typed handles (a pixel CVPixelBuffer, a multi-plane dma-buf) are Frames, not tensors. All thirteen arms are declared on every platform; which domains a build consumes is a run-time property (anira_capabilities_domains).

Public Members

void *ptr#

The base of the allocation; the tensor’s byte_offset counts from it.

The device pointer.

struct anira_memory_handle host#

ANIRA_DOMAIN_HOST and ANIRA_DOMAIN_HOST_PINNED.

int32_t device#

CUDA device ordinal.

struct anira_memory_handle cuda#

ANIRA_DOMAIN_CUDA.

uint32_t id#

GLuint buffer name.

uint32_t target#

GLenum binding target.

struct anira_memory_handle gl#

ANIRA_DOMAIN_GL_BUFFER.

uint64_t buffer#

VkBuffer (non-dispatchable, 64-bit on every target).

uint64_t memory#

VkDeviceMemory.

uint64_t offset#

Byte offset of the buffer in the memory.

Byte offset into the buffer.

Byte offset into the exported memory.

struct anira_memory_handle vk#

ANIRA_DOMAIN_VULKAN_BUFFER: native handles of the same process.

int32_t fd#

The exported fd; on Windows the NT handle (32 bits significant).

The dma-buf fd.

uint32_t reserved#

Zero.

uint64_t size#

Size of the exported allocation in bytes.

Size of plane 0 in bytes.

Size of the exported memory in bytes.

struct anira_memory_handle opaque#

ANIRA_DOMAIN_OPAQUE_FD: exported opaque memory.

void *buffer

id<MTLBuffer>.

WGPUBuffer.

AHardwareBuffer*.

struct anira_memory_handle mtl#

ANIRA_DOMAIN_METAL_BUFFER.

void *surface#

IOSurfaceRef.

struct anira_memory_handle iosurface#

ANIRA_DOMAIN_IOSURFACE: plane 0, byte-image encoded packed floats.

struct anira_memory_handle wgpu#

ANIRA_DOMAIN_WGPU_BUFFER: a buffer of the core’s Dawn device, same process.

struct anira_memory_handle dmabuf#

ANIRA_DOMAIN_DMABUF: exported buffer memory, typeless.

struct anira_memory_handle ahb#

ANIRA_DOMAIN_AHARDWAREBUFFER: buffer-typed (BLOB).

void *resource#

ID3D12Resource*.

void *shared_handle#

The NT shared handle of the resource, or NULL.

struct anira_memory_handle d3d12#

ANIRA_DOMAIN_D3D12.

void *const *ptrs#

count plane pointers, plane i at ptrs[i]; the array is borrowed like the memory it names.

uint32_t count#

The number of planes; equals shape[0].

struct anira_memory_handle planes#

ANIRA_DOMAIN_HOST and ANIRA_DOMAIN_HOST_PINNED under ANIRA_TENSOR_PLANAR: one pointer per plane of axis 0. Not a domain of its own: domain stays the planes’ real domain.

uint64_t raw[3]#

The handle as words: copy, compare, key a plan cache (never by the words of a planar handle, which name the caller’s pointer array and not the memory).