Skip to main content

Module layout

Module layout 

Source
Expand description

Layout descriptors for the Hurray tensor interchange format.

Every tensor descriptor includes a layout tag (uint8) and a layout-specific payload that together describe how elements are arranged in memory. This module provides the LayoutDescriptor enum and all per-layout payload structs.

§Layout tag space

RangeAllocation
0x00Reserved (permanently invalid)
0x01–0x0BCore named layouts (Tier 1), including the Composite / Virtual head (0x0B, ADR-027)
0x0C–0x3FReserved for future specification versions
0x40Hilbert curve layout (Tier 2)
0x41–0x7FReserved for future specification versions
0x80–0xEFReserved for future specification versions
0xF0–0xFEImplementation-private extension layouts
0xFFReserved (permanently invalid)

§Strict vs permissive mode

The LayoutDescriptor enum’s named variants (everything except LayoutDescriptor::Unknown) correspond to tags this implementation understands. A decoder operating in strict mode must reject any tag not covered by a named variant; a decoder operating in permissive mode may wrap unrecognised tags in LayoutDescriptor::Unknown.

LayoutDescriptor::tag and LayoutDescriptor::buffer_count work on all variants including Unknown.

See docs/spec/memory-layout.md for the normative definition.

Re-exports§

pub use addressing::byte_address_from_element_offset;
pub use addressing::ElementAddress;
pub use block_paged::BlockPagedLayout;
pub use block_paged::BlockTableIndexType;
pub use block_paged::KvRole;
pub use composite::CombineOp;
pub use composite::CompositeLayout;
pub use composite::CompositionRule;
pub use coo::CooLayout;
pub use csc::CscLayout;
pub use csf::CsfLayout;
pub use csr::CsrLayout;
pub use hilbert::HilbertLayout;
pub use morton::MortonLayout;
pub use private_extension::PrivateExtensionLayout;
pub use private_extension::PRIVATE_LAYOUT_TAG_MAX;
pub use private_extension::PRIVATE_LAYOUT_TAG_MIN;
pub use strided::StridedLayout;
pub use tiled::InnerStrides;
pub use tiled::OuterStrides;
pub use tiled::TiledLayout;
pub use tiled::MAX_TILED_DEPTH;
pub use unknown::UnknownLayout;

Modules§

addressing
Layout address-computation traits and shared helpers.
block_paged
Block-paged layout descriptor.
col_major
Column-major (Fortran-order) layout descriptor.
composite
Composite / Virtual layout descriptor — the head payload for a composite tensor.
coo
COO (Coordinate) sparse layout descriptor.
csc
CSC (Compressed Sparse Column) layout descriptor.
csf
CSF (Compressed Sparse Fiber) layout descriptor.
csr
CSR (Compressed Sparse Row) layout descriptor.
hilbert
Hilbert curve layout descriptor.
morton
Morton (Z-order curve) layout descriptor.
private_extension
Private extension layout descriptor.
row_major
Row-major (C-order) layout descriptor.
strided
Strided layout descriptor.
tiled
Tiled / blocked layout descriptor.
unknown
Unknown layout descriptor — permissive-mode fallback.

Enums§

LayoutDescriptor
The memory layout of a tensor’s data buffer.

Constants§

TAG_BLOCK_PAGED
Layout tag for block-paged indirect layout.
TAG_COL_MAJOR
Layout tag for column-major (Fortran-order) layout.
TAG_COMPOSITE
Layout tag for the composite / virtual head (ADR-027). See docs/spec/layouts/composite.md.
TAG_COO
Layout tag for COO (Coordinate) sparse layout.
TAG_CSC
Layout tag for CSC (Compressed Sparse Column) layout.
TAG_CSF
Layout tag for CSF (Compressed Sparse Fiber) layout.
TAG_CSR
Layout tag for CSR (Compressed Sparse Row) layout.
TAG_HILBERT
Layout tag for Hilbert curve layout.
TAG_MORTON
Layout tag for Morton (Z-order) layout.
TAG_ROW_MAJOR
Layout tag for row-major (C-order) layout.
TAG_STRIDED
Layout tag for strided layout.
TAG_TILED
Layout tag for tiled / blocked layout.

Functions§

is_invalid_tag
Returns true if tag is permanently invalid (0x00 or 0xFF).
is_named_tag
Returns true if tag has a named LayoutDescriptor variant in this crate.
is_private_tag
Returns true if tag is in the private-extension range (0xF0–0xFE).
is_reserved_tag
Returns true if tag falls in a range reserved for future specification versions (0x0C–0x3F, 0x41–0x7F, 0x80–0xEF).
validate_layout_tag_strict
Validates a layout tag in strict mode, returning the appropriate error for tags that are invalid, reserved, or private.