pub struct TiledDecodingState<'a, T: Topology> {Show 26 fields
pub width: usize,
pub height: usize,
pub tiles_x: usize,
pub tiles_y: usize,
pub blocks_state: &'a mut [BlockStateHot],
pub parents: &'a mut [u32],
pub defect_mask: &'a mut [u64],
pub path_mark: &'a mut [u64],
pub block_dirty_mask: &'a mut [u64],
pub active_mask: &'a mut [u64],
pub queued_mask: &'a mut [u64],
pub ingestion_list: &'a mut [u32],
pub edge_bitmap: &'a mut [u64],
pub edge_dirty_list: &'a mut [u32],
pub edge_dirty_mask: &'a mut [u64],
pub boundary_bitmap: &'a mut [u64],
pub boundary_dirty_list: &'a mut [u32],
pub boundary_dirty_mask: &'a mut [u64],
pub bfs_pred: &'a mut [u16],
pub bfs_queue: &'a mut [u16],
pub tile_graph: &'a StaticGraph,
pub ingestion_count: usize,
pub active_block_mask: u64,
pub edge_dirty_count: usize,
pub boundary_dirty_count: usize,
pub _marker: PhantomData<T>,
}Expand description
A tiled decoder that manages large grids by breaking them into 32x32 tiles.
For grids larger than ~4096 nodes, the standard decoder’s cache utilization
degrades. TiledDecodingState addresses this by:
- Dividing the grid into 32x32 tiles (1024 nodes each)
- Running the optimized Stride-32 decoder on each tile
- Stitching tiles together at boundaries using Union Find
§When to Use
Use TiledDecodingState for grids larger than 64x64 nodes. For smaller grids,
the standard DecodingState is more efficient.
§Tile Layout
Global grid (96x64):
+--------+--------+--------+
| Tile 0 | Tile 1 | Tile 2 | (each 32x32)
+--------+--------+--------+
| Tile 3 | Tile 4 | Tile 5 |
+--------+--------+--------+Each tile contains 16 blocks of 64 nodes, arranged in Stride-32 format.
Fields§
§width: usizeTotal grid width in nodes.
height: usizeTotal grid height in nodes.
tiles_x: usizeNumber of tiles in X direction.
tiles_y: usizeNumber of tiles in Y direction.
blocks_state: &'a mut [BlockStateHot]Block state for all tiles (16 blocks per tile).
parents: &'a mut [u32]Union Find parent pointers for all nodes.
defect_mask: &'a mut [u64]Defect mask per block.
path_mark: &'a mut [u64]Path marking for peeling.
block_dirty_mask: &'a mut [u64]Dirty block tracking for sparse reset.
active_mask: &'a mut [u64]Currently active blocks.
queued_mask: &'a mut [u64]Blocks queued for next iteration.
ingestion_list: &'a mut [u32]Syndrome ingestion worklist.
edge_bitmap: &'a mut [u64]Edge correction bitmap.
edge_dirty_list: &'a mut [u32]Dirty edge word list.
edge_dirty_mask: &'a mut [u64]Dirty edge mask.
boundary_bitmap: &'a mut [u64]Boundary correction bitmap.
boundary_dirty_list: &'a mut [u32]Dirty boundary block list.
boundary_dirty_mask: &'a mut [u64]Dirty boundary mask.
bfs_pred: &'a mut [u16]BFS predecessor array for path tracing.
bfs_queue: &'a mut [u16]BFS queue for path tracing.
tile_graph: &'a StaticGraphStatic graph metadata for 32x32 tiles (shared by all tiles).
ingestion_count: usizeSyndrome ingestion count.
active_block_mask: u64Active block mask (for small-grid compatibility).
edge_dirty_count: usizeEdge dirty count.
boundary_dirty_count: usizeBoundary dirty count.
_marker: PhantomData<T>Phantom marker for topology type.
Implementations§
Source§impl<'a, T: Topology> TiledDecodingState<'a, T>
impl<'a, T: Topology> TiledDecodingState<'a, T>
Sourcepub fn new(arena: &mut Arena<'a>, width: usize, height: usize) -> Self
pub fn new(arena: &mut Arena<'a>, width: usize, height: usize) -> Self
Creates a new tiled decoder for the given grid dimensions.
§Arguments
arena- Arena allocator for all internal allocations.width- Total grid width in nodes.height- Total grid height in nodes.
§Tile Calculation
The grid is divided into ceil(width/32) x ceil(height/32) tiles. Each tile contains 1024 nodes (32x32) in 16 blocks.
Sourcepub fn initialize(&mut self)
pub fn initialize(&mut self)
Initializes or reinitializes the decoder state.
Sets up valid masks for all tiles based on actual grid dimensions and resets all dynamic state.
Sourcepub fn sparse_reset(&mut self)
pub fn sparse_reset(&mut self)
Resets only modified blocks for efficient reuse.
Similar to DecodingState::sparse_reset, this only resets blocks
that were touched during the previous decoding cycle.
Sourcepub fn load_dense_syndromes(&mut self, syndromes: &[u64])
pub fn load_dense_syndromes(&mut self, syndromes: &[u64])
Loads syndrome measurements from a dense row-major bitarray.
Converts from row-major input format to the internal tiled format.
§Arguments
syndromes- Dense bitarray in row-major order with power-of-2 stride.
Sourcepub fn grow_clusters(&mut self)
pub fn grow_clusters(&mut self)
Expands cluster boundaries until convergence.
Processes tiles in two phases:
- Intra-tile growth: Run Stride-32 decoder within each tile
- Inter-tile stitching: Connect clusters across tile boundaries
Sourcepub fn find(&mut self, i: u32) -> u32
pub fn find(&mut self, i: u32) -> u32
Finds the cluster root for node i with path compression.
Uses path halving compression for O(α(n)) amortized complexity.
Sourcepub fn union(&mut self, u: u32, v: u32) -> bool
pub fn union(&mut self, u: u32, v: u32) -> bool
Merges clusters containing nodes u and v.
Returns true if clusters were different and got merged.