Feat/bp decoder optimizations - #294
Open
aria-googler wants to merge 8 commits into
Open
Conversation
…te posterior update
aria-googler
requested review from
arshpreetmaan and
viathor
and removed request for
a team and
viathor
August 8, 2026 06:08
…nsics" This reverts commit c900f95, returning to GCC ivdep pragmas for auto-vectorization in order to maximize code readability and simplicity. The marginal performance gain in release builds (~2-4%) was deemed not worth the architectural complexity of explicit intrinsics. Also forces -c opt in benchmark.sh to prevent unintentional unoptimized profiling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: High-Performance Belief Propagation (BP) Vectorization & Layered Serial Min-Sum Optimization
Overview
This PR delivers a major performance, scaling, and accuracy overhaul for the Belief Propagation (BP) Min-Sum Decoder and its Ordered Statistic Decoding (OSD) post-processing pipeline in
Tesseract-BP.By redesigning belief data structures into a contiguous 1D interleaved memory layout, transitioning to horizontal layered serial scheduling, accelerating check-node message updates using AVX-512 SIMD intrinsics, and introducing stochastic check-node schedule permutations, the decoder achieves a 2.2x to 5.25x throughput speedup while maintaining strict numerical parity across all standard Quantum Error Correction (QEC) code families.
1. Background & Problems Identified
Architecture Background
The
Tesseract-BPdecoder operates over a bipartite Tanner Graph constructed from a StimDetectorErrorModel(DEM), mapping syndrome detectors (check nodes) to physical error mechanisms (variable nodes). Decoding relies on an iterative Min-Sum message-passing algorithm operating on Log-Likelihood Ratios (LLRs), followed by an optional Ordered Statistic Decoding (OSD) post-processor when BP fails to converge.Key Performance & Architectural Bottlenecks Identified
Non-Interleaved Memory Layout (L1 Cache Flushing):
std::vector<std::vector<LLR_INT>>).2D Message Table Memory Bandwidth Tax:
Compiler Vectorization Latency:
#pragma GCC ivdeploop hints to auto-vectorize minimum LLR tracking (min1andmin2).Deterministic Trapping Set Traversal:
CLI Telemetry Metric Discrepancies:
--threads N), wall-clock execution time was calculated by summing total CPU thread times rather than measuring true elapsed duration.2. Implemented Fixes & Commit Breakdown
This PR consists of 6 clean, un-squashed commits stacked in logical sequence:
565ae1f—feat(bp): add native C++ BP benchmark suite and complete timing metrics in bp_mainsrc/bp_main.cc.devtools/benchmark.shcovering Surface Codes (640f32c—build: add CMake build directory to .gitignore.gitignoreto ignore local CMake build output (build/).bab6616—feat(bp): transition BP decoder to flat interleaved 1D array layoutposteriors_flat[v * 16 + b].BP_BATCH_SIZE = 16) side-by-side. Fetching variableb71c8fa—feat(bp): implement horizontal layered serial scheduling with immediate posterior updatec900f95—feat(bp): vectorize layered serial min-sum with AVX-512 intrinsics_mm512_min_epi32,_mm512_abs_epi32,_mm512_sub_epi32,_mm512_add_epi32,_mm512_mask_blend_epi32,_mm512_movepi32_mask).eac413a—feat(bp): add stochastic check node permutation to break LDPC trapping sets3. Scope & Future Work (What Was Not Fixed)
To maintain focused code reviews, the following items were intentionally left out of this PR for future iterations:
stim::simd_bitsGaussian elimination per shot. Multi-shot batching of the Gaussian elimination solver is deferred to a future PR.4. Benchmark Performance Results
All benchmarks were evaluated on a 48-vCPU Intel Xeon workstation across 100,000 Monte Carlo shots per configuration.
End-to-End Throughput Comparison
serial-batched(BP)serial-batched(BP)serial-batched(BP)serial-batched(BP)serial-batched(BP)serial-batched(BP)serial-batched + OSD-0serial-batched + OSD-1serial-batched + OSD-0serial-batched + OSD-0serial-batched + OSD-05. Verification & Testing
bazel test --jobs=1 src/...mkdir -p build && cd build && cmake .. && cmake --build . --parallel 1 && ctest