Loading...
Searching...
No Matches
HydroCouple::BufferDescriptor Struct Reference

BufferDescriptor describes a typed, possibly strided, possibly device-resident multi-dimensional array. More...

#include <hydrocouple.h>

Collaboration diagram for HydroCouple::BufferDescriptor:

Public Attributes

void * data = nullptr
 Base address of element (0, 0, ..., 0).
 
DataKind kind = DataKind::Unknown
 Element type.
 
int32_t rank = 0
 Number of dimensions; 0 denotes a scalar.
 
const int64_t * shape = nullptr
 Extent per dimension; length == rank.
 
const int64_t * stridesBytes = nullptr
 Byte step per dimension; nullptr => C-contiguous.
 
int64_t itemSizeBytes = 0
 Size of one element; 0 => the kind's natural size (illegal for Opaque).
 
MemorySpace space = MemorySpace::Host
 Memory space holding the bytes.
 
DeviceBackend backend = DeviceBackend::None
 Runtime owning the device memory when space is Device/Unified.
 
int32_t deviceId = 0
 Device ordinal within the backend when space is Device/Unified.
 
void * queue = nullptr
 Opaque backend stream/queue for asynchronous transfers; nullptr => default stream, synchronous.
 

Detailed Description

BufferDescriptor describes a typed, possibly strided, possibly device-resident multi-dimensional array.

It is the sole currency of field data exchange.

The layout model follows the DLPack/NumPy buffer protocol: element (i0, i1, ..., i[rank-1]) lives at data + sum(ik * stridesBytes[k]). A null stridesBytes means C-contiguous row-major layout. The descriptor does not own its memory or its shape/stride arrays; the caller guarantees they outlive the call. Dimension semantics (which axis is time, entity, layer, ...) are supplied by the owning IComponentDataItem's dimensions() metadata, not by this struct.

Element size. itemSizeBytes is the size of one element. For every kind with a fixed size it must equal Helpers::dataKindSize(kind) (a value of 0 is accepted as shorthand for "the kind's natural size" so that fixed-size buffers can be described without repeating it); for DataKind::Opaque it is mandatory and positive; for DataKind::String it is sizeof(std::string). Every byte-extent computation in the standard uses this field, never the kind alone.

Device buffers. space, backend and deviceId together name the address space; queue is an opaque, backend-specific stream/queue handle (a cudaStream_t, hipStream_t or sycl::queue*) on which an implementation may enqueue the copy instead of synchronizing the device. A null queue means the default stream and a synchronous transfer. Ownership of the queue stays with the caller. A device buffer's pointer must remain valid and stable between the owning component's prepare() and finish() so that kernels may operate on it directly.

This is a plain aggregate: the interface standard carries no executable code. Non-normative helper functions for descriptors (element counts, contiguity checks, byte offsets, factories) are provided separately in hydrocouplehelpers.h.

Member Data Documentation

◆ backend

DeviceBackend HydroCouple::BufferDescriptor::backend = DeviceBackend::None

Runtime owning the device memory when space is Device/Unified.

◆ data

void* HydroCouple::BufferDescriptor::data = nullptr

Base address of element (0, 0, ..., 0).

◆ deviceId

int32_t HydroCouple::BufferDescriptor::deviceId = 0

Device ordinal within the backend when space is Device/Unified.

◆ itemSizeBytes

int64_t HydroCouple::BufferDescriptor::itemSizeBytes = 0

Size of one element; 0 => the kind's natural size (illegal for Opaque).

◆ kind

DataKind HydroCouple::BufferDescriptor::kind = DataKind::Unknown

Element type.

◆ queue

void* HydroCouple::BufferDescriptor::queue = nullptr

Opaque backend stream/queue for asynchronous transfers; nullptr => default stream, synchronous.

◆ rank

int32_t HydroCouple::BufferDescriptor::rank = 0

Number of dimensions; 0 denotes a scalar.

◆ shape

const int64_t* HydroCouple::BufferDescriptor::shape = nullptr

Extent per dimension; length == rank.

◆ space

MemorySpace HydroCouple::BufferDescriptor::space = MemorySpace::Host

Memory space holding the bytes.

◆ stridesBytes

const int64_t* HydroCouple::BufferDescriptor::stridesBytes = nullptr

Byte step per dimension; nullptr => C-contiguous.


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