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
| Range | Allocation |
|---|---|
0x00 | Reserved (permanently invalid) |
0x01–0x0B | Core named layouts (Tier 1), including the Composite / Virtual head (0x0B, ADR-027) |
0x0C–0x3F | Reserved for future specification versions |
0x40 | Hilbert curve layout (Tier 2) |
0x41–0x7F | Reserved for future specification versions |
0x80–0xEF | Reserved for future specification versions |
0xF0–0xFE | Implementation-private extension layouts |
0xFF | Reserved (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§
- Layout
Descriptor - 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
trueiftagis permanently invalid (0x00or0xFF). - is_
named_ tag - Returns
trueiftaghas a namedLayoutDescriptorvariant in this crate. - is_
private_ tag - Returns
trueiftagis in the private-extension range (0xF0–0xFE). - is_
reserved_ tag - Returns
trueiftagfalls 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.