Expand description
.10d Tensor10D NODE section — the 40-byte epistemic atom in the container
(P0.5).
A NODE section wraps a set of Tensor10D records (the 40-byte
[q,v,w,x,y,z,t,α,μ,σ] stride) as a self-describing .10d section. It
supports two byte-equivalent layouts:
- AoS (array-of-structs):
N × Tensor10Drecords back-to-back — the naturalTensor10Dlayout, identical to whattensor/buffer_export.rs::write_tensor_bufferproduces (minus its 32-byteQ42*header, which the.10dcontainer header replaces). - SoA (structure-of-arrays): ten contiguous lanes, one per axis —
lane 0 = all
qvalues, lane 1 = allvvalues, …, lane 9 = allσvalues. This is the “page-friendly” layout the design doc §4.1 names: “any single axis is a contiguous strided read.”
AoS↔SoA is byte-identical (lossless transpose): converting AoS→SoA→AoS
(or SoA→AoS→SoA) reproduces the original bytes exactly, because the
transpose is just a reordering of the same N×10 f32 values with no
precision loss. Per-axis SoA lane reads match AoS field reads: reading
axis i for node j from the SoA layout yields the same f32 as reading
field i from the j-th Tensor10D in the AoS layout.
write_tensor_q_at semantics: the wavefunction-collapse write (setting
q for one node, returning the previous q) works on the NODE section in
either layout — for AoS it writes the first f32 of the j-th record; for
SoA it writes lane 0 (q) at position j. The semantics match
tensor/buffer_export.rs::write_tensor_q_at exactly (same return-the-prev-q
contract), with the only difference being the byte offset (the NODE section
has a 16-byte mini-header where buffer_export.rs has a 32-byte Q42*
header).
Determinism + CRC: two encodes of the same tensor set in the same layout are byte-identical (the AoS/SoA transpose is deterministic). The per-section CRC-32C (P0.2) catches a flipped bit in the payload. The whole-file CRC-32C (P0.3) catches header corruption.
Spec-reserved (NOT yet implemented): the mini-header’s reserved bytes
are reserved for future per-axis SoA lane offset table, a q-superposition
render/export mask (the design doc’s “render/export default to a
ground-truth-only mask; Sandbox nodes not citable as provenance until
collapsed”), and a GSR-result back-pointer. These are governance/attestation
concerns (the SpecReservedGovernance / SpecReservedTemporalIndex
section types) and are NOT wired here — P0.5 is the atom, not the
attestation layer.
Structs§
- Node
Mini Header - The 16-byte NODE-section mini-header.
repr(C), naturally aligned, no padding.
Enums§
- Node
Section Error - NODE-section read/write error.
Constants§
- AXIS_
COUNT - Number of axes (lanes).
- LAYOUT_
AOS - Layout tag: 0 = AoS (array-of-structs), 1 = SoA (structure-of-arrays).
- LAYOUT_
SOA - MAX_
NODE_ COUNT - Maximum node count the NODE section will accept. Bounds against a
hostile/malformed file: the 42MB Sentinel ceiling / 40 bytes per node
= ~1M nodes max; 1M is a comfortable upper bound for a single section
while keeping the mini-header’s
node_countfield well within range. - NODE_
MINI_ HEADER_ SIZE - Section payload mini-header size in bytes.
- TENSO
R10D_ SIZE Tensor10Drecord size in bytes (10 × f32).
Functions§
- parse_
node_ header - Parse and validate the NODE-section mini-header. Returns the header and the total payload byte length it claims.
- read_
node - Read one
Tensor10Dby index from a NODE section payload (dispatches on layout). Zero-heap. - read_
node_ aos - Read one
Tensor10Dby index from an AoS-layout NODE section. Zero-heap. - read_
node_ soa - Read one
Tensor10Dby index from an SoA-layout NODE section (assembles from ten lane reads). Zero-heap. - read_
node_ soa_ lane - Read one
f32lane value (axisaxis, nodeindex) from an SoA-layout NODE section. Zero-heap. This is the “per-axis SoA lane read” the P0.5 acceptance gate names. - transpose_
aos_ to_ soa - Transpose an AoS-layout NODE section payload to SoA into a caller-supplied
output buffer. The output buffer must be at least
totalbytes. Zero-heap. This is the primary AoS→SoA path. - transpose_
soa_ to_ aos - Transpose an SoA-layout NODE section payload to AoS into a caller-supplied
output buffer. The output buffer must be at least
totalbytes. Zero-heap. - write_
node_ q_ at - Write the
qfield (axis 0) for one node in a NODE section — the wavefunction-collapse semantics matchingtensor/buffer_export.rs:: write_tensor_q_at. Returns the previousqvalue. Works on either layout. Zero-heap. - write_
node_ section_ aos - Write a tensor set as a NODE section in AoS layout into a caller-supplied buffer. Returns the bytes written. Zero-heap.
- write_
node_ section_ soa - Write a tensor set as a NODE section in SoA layout into a caller-supplied buffer. Returns the bytes written. Zero-heap.