TiledDecodingState

Struct TiledDecodingState 

Source
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:

  1. Dividing the grid into 32x32 tiles (1024 nodes each)
  2. Running the optimized Stride-32 decoder on each tile
  3. 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: usize

Total grid width in nodes.

§height: usize

Total grid height in nodes.

§tiles_x: usize

Number of tiles in X direction.

§tiles_y: usize

Number 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 StaticGraph

Static graph metadata for 32x32 tiles (shared by all tiles).

§ingestion_count: usize

Syndrome ingestion count.

§active_block_mask: u64

Active block mask (for small-grid compatibility).

§edge_dirty_count: usize

Edge dirty count.

§boundary_dirty_count: usize

Boundary dirty count.

§_marker: PhantomData<T>

Phantom marker for topology type.

Implementations§

Source§

impl<'a, T: Topology> TiledDecodingState<'a, T>

Source

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.

Source

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.

Source

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.

Source

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.
Source

pub fn grow_clusters(&mut self)

Expands cluster boundaries until convergence.

Processes tiles in two phases:

  1. Intra-tile growth: Run Stride-32 decoder within each tile
  2. Inter-tile stitching: Connect clusters across tile boundaries
Source

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.

Source

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.

Source

pub fn peel_forest(&mut self, corrections: &mut [EdgeCorrection]) -> usize

Extracts edge corrections from grown clusters.

Traces paths from syndrome nodes through the Union Find forest, converting logical edges to physical corrections.

§Arguments
  • corrections - Output buffer for edge corrections.
§Returns

Number of corrections written to the buffer.

Auto Trait Implementations§

§

impl<'a, T> Freeze for TiledDecodingState<'a, T>

§

impl<'a, T> RefUnwindSafe for TiledDecodingState<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for TiledDecodingState<'a, T>
where T: Send,

§

impl<'a, T> Sync for TiledDecodingState<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for TiledDecodingState<'a, T>
where T: Unpin,

§

impl<'a, T> !UnwindSafe for TiledDecodingState<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.