#[non_exhaustive]pub enum Error {
Show 79 variants
UnsupportedElementType(String),
InvalidShape(String),
AlignmentError {
expected: usize,
actual: usize,
},
AlignmentNotPowerOfTwo {
alignment: u32,
},
AlignmentBelowMinimum {
alignment: u32,
minimum: u32,
},
InvalidDeviceTag(u8),
ReservedDeviceTag(u8),
DeviceTagMismatch {
expected: u8,
found: u8,
},
EmptyBufferList,
InvalidMemoryClass(u8),
ReservedMemoryClass(u8),
MemoryClassMismatch {
expected: u8,
found: u8,
},
InvalidQuantization(String),
QuantizationDescriptorTooShort {
found: usize,
needed: usize,
},
InvalidQuantizationSchemeTag(u8),
ReservedQuantizationSchemeTag(u8),
PrivateQuantizationSchemeTag(u8),
UnknownQuantizationSchemeTag(u8),
UnsupportedSchemeVersion {
tag: u8,
version: u8,
supported: u8,
},
ReservedQuantizationFlagsBits {
flags: u16,
mask: u16,
},
InvalidBlockSize {
scheme_tag: u8,
block_size: u32,
min: u32,
max: u32,
},
InvalidStorageTypeForScheme {
scheme_tag: u8,
type_tag: u8,
},
QuantizationAxisOutOfBounds {
axis: u32,
rank: u32,
},
QuantizationShapeMismatch {
axis: u32,
shape_axis: u64,
block_size: u32,
reason: &'static str,
},
ZeroPointOutOfRange {
type_tag: u8,
zero_point: i32,
min: i64,
max: i64,
},
QuantizationBufferAliasesData {
index: u32,
},
QuantizationBufferIndexOutOfRange {
index: u32,
buffer_count: u32,
},
InvalidTypeTag(u8),
ReservedTypeTag(u8),
UnknownTypeTag(u8),
RankExceedsMaximum {
rank: u32,
max: u32,
},
InvalidLayoutTag(u8),
ReservedLayoutTag(u8),
NamedLayoutTag(u8),
PrivateLayoutTag(u8),
UnknownLayoutTag(u8),
InvalidLayout(String),
IndexRankMismatch {
index_rank: usize,
shape_rank: usize,
},
IndexOutOfRange {
dim: u32,
index: u64,
size: u64,
},
AddressOverflow,
ByteAddressOverflow {
buffer_size: u64,
},
LayoutRequiresMultiBuffer {
layout_tag: u8,
},
SubpavingNestingTooDeep,
DynamicDimInIndexing {
dim: u32,
},
IndexArithmeticOverflow,
InvalidSyncMode(u8),
InvalidMagic {
got: [u8; 4],
},
UnsupportedDescriptorVersion {
major: u8,
minor: u8,
},
DescriptorTooShort {
length: u32,
},
DescriptorTruncated {
offset: usize,
needed: usize,
available: usize,
},
ReservedDescriptorFlagBitsSet {
flags: u32,
mask: u32,
},
ReservedBytesNonZero {
field: &'static str,
},
EmptyBufferTable,
ExtensionTypeFlagMismatch {
flag_set: bool,
type_tag: u8,
type_tag_in_range: &'static str,
},
ExtensionTypePackingInvalid {
bit_width: u32,
packing_factor: u8,
},
ExtensionTypeFieldInvalid {
reason: &'static str,
},
ShardOutOfBounds {
dim: usize,
offset: u64,
size: u64,
parent: u64,
},
StatisticsReservedMaskBitsSet {
mask: u32,
},
DescriptorLengthMismatch {
declared: u32,
actual: usize,
},
CompositeHeadHasBuffers {
count: u8,
},
CompositeHeadHasByteOffset {
byte_offset: u64,
},
CompositeHeadHasQuantization,
InvalidCompositionRule(u8),
ReservedCompositionRule(u8),
PrivateCompositionRule(u8),
InvalidCombineOp {
rule: u8,
combine_op: u8,
},
OpenCompositeReserved,
InvalidMemberRole(u8),
CompositeMemberFlagMismatch {
rule: u8,
has_flag: bool,
},
CompositeMemberCountMismatch {
declared: u32,
actual: usize,
},
CompositeMemberMissingShard {
index: usize,
},
CompositeMemberParentShapeMismatch {
index: usize,
},
CompositeMemberTypeMismatch {
index: usize,
member: u8,
head: u8,
},
CompositeOverlayBaseNotFirst,
CompositeOverlayBaseNotSpanning,
CompositeOverlayEmpty,
CompositePartitionGap,
CompositePartitionOverlap {
a: usize,
b: usize,
},
LayoutIsVirtual {
layout_tag: u8,
},
}Expand description
Crate-level error type for hurray-core.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnsupportedElementType(String)
An element type is not supported or recognized.
InvalidShape(String)
A shape or stride value is invalid.
AlignmentError
A buffer alignment requirement was not satisfied.
This variant is preserved for callers that check alignment against an
externally observed value (e.g., checking the actual base-address
alignment of a pointer). For descriptor-level validation, prefer
Error::AlignmentNotPowerOfTwo and Error::AlignmentBelowMinimum.
AlignmentNotPowerOfTwo
The alignment field is not a power of two.
The spec requires that alignment is always a power of two
(see docs/spec/buffer-protocol.md § Alignment).
AlignmentBelowMinimum
The alignment field is below the minimum required for a non-empty buffer.
Non-empty buffers (those with byte_size > 0) MUST declare an alignment
of at least crate::MIN_BUFFER_ALIGNMENT (64 bytes) to guarantee
compatibility with all current SIMD instruction sets.
InvalidDeviceTag(u8)
The device tag byte 0xFF is permanently invalid.
This sentinel is reserved by the spec and MUST be rejected by all
conforming readers (see docs/spec/buffer-protocol.md § Device Tags).
ReservedDeviceTag(u8)
The device tag falls in the range 0x04–0xEF reserved for future spec versions.
Implementations MUST NOT assign semantics to tags in this range.
DeviceTagMismatch
All buffers in a tensor descriptor must reside on the same device.
The expected and found fields are raw wire bytes so that the error
message is independent of which device tags the current implementation
recognises.
Fields
EmptyBufferList
Buffer list is empty; at least one buffer handle is required.
Returned by crate::validate_colocation when called with an empty
slice — there is no device tag to validate against.
InvalidMemoryClass(u8)
The memory class byte is 0xFF, which is permanently reserved by the spec.
Readers MUST reject a buffer handle whose memory_class is 0xFF.
ReservedMemoryClass(u8)
The memory class byte falls in the range 0x04–0xEF reserved for future spec versions.
Readers MUST reject a buffer handle with a memory_class in this range.
MemoryClassMismatch
All buffers in a tensor descriptor must share the same memory class.
The expected and found fields are raw wire bytes so that the error
message is independent of which memory classes the current implementation
recognises.
Fields
InvalidQuantization(String)
A quantization descriptor is malformed.
QuantizationDescriptorTooShort
The quantization descriptor payload is shorter than the minimum required.
InvalidQuantizationSchemeTag(u8)
The scheme tag 0x00 or 0xFF is permanently reserved by the spec.
A reader MUST reject any descriptor whose scheme_tag is 0x00 or 0xFF.
ReservedQuantizationSchemeTag(u8)
The scheme tag falls in a range reserved for future specification versions.
Ranges: 0x60–0xEF. Implementations MUST NOT assign semantics to these tags.
PrivateQuantizationSchemeTag(u8)
The scheme tag is in the implementation-private range 0xF0–0xFE.
Private scheme tags have unconstrained payloads beyond the 4-byte header;
hurray-core cannot interpret them. Callers that need private scheme
support must handle the raw bytes at a higher layer.
WHY rejected here: the payload beyond the 4-byte header is unconstrained for private tags, giving this crate nothing useful to return. Callers that need private schemes handle the raw bytes at a higher layer (design decision #1).
UnknownQuantizationSchemeTag(u8)
The scheme tag is in an allocated range but not assigned to any known scheme.
UnsupportedSchemeVersion
The scheme_version field exceeds the highest version this implementation supports.
Per the spec, a reader MUST reject a descriptor whose scheme_version exceeds
the highest version defined for the given scheme_tag.
Fields
ReservedQuantizationFlagsBits
Reserved flags bits are set in the quantization descriptor header.
Per the spec, a reader MUST reject a descriptor with any reserved flags bit set.
Fields
InvalidBlockSize
The block_size field is out of range or not a power of two for the given scheme.
Fields
InvalidStorageTypeForScheme
The tensor’s storage type_tag is not valid for the given quantization scheme.
Each quantization scheme defines a fixed set of permitted storage types.
Fields
QuantizationAxisOutOfBounds
The quantization axis index is out of bounds for the tensor’s rank.
Per the spec, axis MUST satisfy axis < rank.
Fields
QuantizationShapeMismatch
The tensor shape along the quantization axis is incompatible with the block size.
For MXFP, shape[axis] must be a positive multiple of block_size.
For per-block-affine and NF4, block_size must not exceed shape[axis]
when shape[axis] > 0.
Fields
ZeroPointOutOfRange
The zero_point value is outside the representable range of the storage type.
Per the spec, zero_point MUST lie within the representable range of the
storage type (e.g., [0, 255] for uint8).
Fields
QuantizationBufferAliasesData
A quantization-parameter buffer index aliases the tensor data buffer.
Per the spec, quantization-parameter buffers MUST occupy distinct indices from the tensor data buffer.
QuantizationBufferIndexOutOfRange
A quantization-parameter buffer index is out of range.
The index must be less than buffer_count in the tensor descriptor’s
buffer table.
Fields
InvalidTypeTag(u8)
The type tag 0x00 or 0xFF is explicitly invalid per the spec.
These two sentinels are permanently reserved and MUST be rejected by all conforming readers regardless of operating mode.
ReservedTypeTag(u8)
The type tag falls in a range reserved for future specification versions.
Reserved ranges: 0x47 and 0x80–0xEF. Implementations MUST NOT
assign semantics to these tags.
UnknownTypeTag(u8)
The type tag is not recognized by this implementation.
This covers the private-extension range 0xF0–0xFE and any other
unassigned tag value not covered by Error::InvalidTypeTag or
Error::ReservedTypeTag.
RankExceedsMaximum
The tensor rank exceeds the maximum of 64 defined by the spec.
InvalidLayoutTag(u8)
Layout tag 0x00 or 0xFF is permanently invalid.
These sentinels are reserved by the spec and MUST be rejected by all
conforming readers regardless of operating mode
(see docs/spec/memory-layout.md § Layout Taxonomy).
ReservedLayoutTag(u8)
Layout tag is in a range reserved for future specification versions.
Reserved ranges: 0x0C–0x3F, 0x41–0x7F, 0x80–0xEF.
(0x0B is the composite / virtual head (ADR-027) and 0x40 is Hilbert;
both are named tags in this crate.)
Implementations MUST NOT assign semantics to these tags in strict mode.
NamedLayoutTag(u8)
A tag with a named layout descriptor was passed to the permissive
UnknownLayout constructor.
“Unknown” is what lets a permissive reader relay a tag it does not
understand. Applied to a tag this implementation does understand, it
becomes a bypass: Unknown has no buffer count and no shape constraints,
so such a descriptor would skip every check the named variant applies and
then encode to a wire tag a conforming reader parses as that named layout.
PrivateLayoutTag(u8)
Layout tag is in the private-extension range 0xF0–0xFE.
Private extension layouts have unconstrained payloads beyond the standard
header fields; strict-mode readers reject them unless both parties have
agreed on semantics out of band (see docs/spec/memory-layout.md § Extension Layouts).
UnknownLayoutTag(u8)
Layout tag is not recognized by this implementation.
Covers any allocated but unassigned tag not already matched by
Error::InvalidLayoutTag or Error::ReservedLayoutTag.
InvalidLayout(String)
A layout descriptor field is invalid.
The inner message describes the specific field and the constraint violated.
IndexRankMismatch
The number of index components does not match the tensor rank.
IndexOutOfRange
An index component exceeds the dimension size.
AddressOverflow
Arithmetic overflow when computing an element or byte address.
ByteAddressOverflow
The computed byte address falls outside the buffer bounds.
LayoutRequiresMultiBuffer
This layout requires multi-buffer access via an inherent method, not the trait.
SubpavingNestingTooDeep
Recursive layout nesting depth exceeded the implementation limit of 8 levels.
Despite the name, this guards recursion depth for every recursive
structure in the crate: crate::layout::TiledLayout’s nested layout
payload, and crate::composite::CompositeTensor’s cross-descriptor
nesting (a member whose own layout is itself Composite). Kept as
SubpavingNestingTooDeep for wire/API stability rather than renamed
as part of the subpaving removal.
DynamicDimInIndexing
A DYNAMIC dimension cannot be used for element addressing.
IndexArithmeticOverflow
Arithmetic overflow in Morton or Hilbert index computation.
InvalidSyncMode(u8)
The sync mode byte is not a recognized value.
Valid sync mode bytes are 0x00 (ProducerSynced), 0x01 (Event),
and 0x02 (ConsumerStream). Bytes 0x03–0xFF are reserved or
permanently invalid; all conforming readers MUST reject them.
See docs/spec/buffer-protocol.md § Synchronization Mode and ADR-018.
InvalidMagic
Magic bytes are not "HRRY" (0x48 0x52 0x52 0x59).
UnsupportedDescriptorVersion
version_major exceeds the supported major version (1).
DescriptorTooShort
descriptor_length is less than the minimum valid size (20).
DescriptorTruncated
Cursor ran out of bytes before a field could be read.
Fields
ReservedDescriptorFlagBitsSet
A reserved flag bit is set.
Fields
ReservedBytesNonZero
A reserved field that MUST be 0x00 contains a non-zero byte.
EmptyBufferTable
buffer_count is 0 (minimum is 1).
ExtensionTypeFlagMismatch
HAS_EXTENSION_TYPE flag ↔ type_tag range disagree.
Fields
ExtensionTypePackingInvalid
Extension type bit_width / packing_factor is invalid.
Fields
ExtensionTypeFieldInvalid
An extension type field carries a value the spec forbids for its family.
ShardOutOfBounds
shard_offset[k] + shape[k] > parent_shape[k].
Fields
StatisticsReservedMaskBitsSet
computed_mask has reserved bits set (bits ≥ 6).
DescriptorLengthMismatch
descriptor_length declared in the header does not match the actual encoded length.
Fields
CompositeHeadHasBuffers
A composite head (layout_tag = 0x0B) declared a non-empty buffer table.
CompositeHeadHasByteOffset
A composite head declared a non-zero byte_offset.
CompositeHeadHasQuantization
A composite head set the HAS_QUANTIZATION flag, but a virtual head owns no stored data.
InvalidCompositionRule(u8)
The composition_rule byte 0xFF is permanently invalid.
ReservedCompositionRule(u8)
The composition_rule byte falls in the range reserved for future specification
versions (0x00 and 0x04–0xEF).
PrivateCompositionRule(u8)
The composition_rule byte is in the implementation-private range 0xF0–0xFE.
InvalidCombineOp
The combine_op byte is not legal for the given composition_rule.
OpenCompositeReserved
The member_count sentinel 0xFFFFFFFF (open composite) is RESERVED and not usable in v1.0.
InvalidMemberRole(u8)
The Composite Member section’s member_role byte is not 0x00 or 0x01.
CompositeMemberFlagMismatch
A member’s HAS_COMPOSITE_MEMBER flag disagrees with what its composition rule requires.
Overlay members MUST carry a Composite Member section; partition and group members MUST NOT.
Fields
CompositeMemberCountMismatch
The number of members actually supplied does not match the head’s declared member_count.
Fields
CompositeMemberMissingShard
A partition or overlay member did not carry a shard section (HAS_SHARD).
CompositeMemberParentShapeMismatch
A member’s shard parent_shape does not equal the composite head’s shape.
CompositeMemberTypeMismatch
A member’s decoded value type does not equal the composite head’s type_tag.
Fields
CompositeOverlayBaseNotFirst
An overlay composite’s first member is not the base, or a base member appeared at a position other than first.
CompositeOverlayBaseNotSpanning
An overlay composite’s base member does not span the whole index space.
CompositeOverlayEmpty
An overlay composite head declared member_count = 0 (no base member available).
CompositePartitionGap
A partition composite’s members leave a gap in the head’s index space.
CompositePartitionOverlap
Two partition members’ boxes overlap.
Fields
LayoutIsVirtual
A layout is virtual (owns no data buffer) and does not support element addressing.
Currently only the composite head (layout_tag = 0x0B) is virtual; addressing a
composite requires resolving to a member first (see hurray_core::composite).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()