Expand description
Buffer protocol types for the Hurray tensor format.
A buffer handle is the unit by which a tensor descriptor references a contiguous region of memory. This module defines the in-memory representation of buffer handles, the device tag that identifies where a buffer resides, and a colocation validator that enforces the spec’s rule that all buffers within a single tensor descriptor must reside on the same device.
The binary encoding of a buffer handle in the descriptor wire format is
defined in docs/spec/metadata.md § Buffer Table. The normative rules
governing alignment, device tags, ownership, and zero-copy invariants are
in docs/spec/buffer-protocol.md.
§Quick reference
| Item | Description |
|---|---|
DeviceTag | Identifies the memory space a buffer resides in |
SyncMode | Describes how the producer–consumer memory ordering is established |
BufferHandle | Declares a buffer’s size, alignment, device, and sync mode |
validate_colocation | Checks that a set of handles all share the same device |
MIN_BUFFER_ALIGNMENT | 64-byte SIMD minimum for non-empty buffers |
PAGE_ALIGNMENT | 4096-byte recommendation for GPU / IPC buffers |
Structs§
- Buffer
Handle - A declaration of a buffer’s size, alignment, device location, and sync mode.
- Private
Memory Class - An implementation-private memory class byte, guaranteed to be in
0xF0–0xFE. - Private
Tag - An implementation-private device tag byte, guaranteed to be in
0xF0–0xFE.
Enums§
- Device
Tag - Identifies the memory space in which a buffer resides.
- Memory
Class - The memory access class of a buffer handle.
- Sync
Mode - Describes how the producer–consumer memory ordering guarantee is established for a buffer.
Constants§
- MIN_
BUFFER_ ALIGNMENT - Minimum buffer alignment for SIMD compatibility (64 bytes).
- PAGE_
ALIGNMENT - Recommended alignment for GPU, IPC, and RDMA buffers (one host page = 4096 bytes).
Functions§
- validate_
colocation - Checks that all buffer handles in
handlesshare the sameDeviceTagandMemoryClass.