Phase 2: typed decoder-spec factories and SampleBatch.decode() with DecodeResult - #530
Open
ciaranra wants to merge 3 commits into
Open
Phase 2: typed decoder-spec factories and SampleBatch.decode() with DecodeResult#530ciaranra wants to merge 3 commits into
ciaranra wants to merge 3 commits into
Conversation
…deResult, and a wide native batch primitive
ciaranra
force-pushed
the
unified-decode-p2a
branch
from
August 16, 2026 19:03
e546401 to
d2d811d
Compare
…per forwarding, full-range seeds
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.
Summary
Phase 2 of the unified batch-decode API, stacked on #527 (merge that first). Two commits: the Python spec-factory layer, then the scoring entry point.
Commit 1 — typed decoder-spec factories
DecoderSpecas a frozen Python value object:parse(),history_dependent/wall_clock_dependent, equality, informative repr.pecos.decoderswith eager validation;pymatching(correlated=...)is required with no default (either default silently flips one of the two existing user cohorts). Composites takeDecoderSpecobjects, not string DSL.Commit 2 — SampleBatch.decode() and DecodeResult
batch.decode(dem=None, decoder=spec_or_legacy_string, *, workers=None, predictions=False, timing=False, allow_dem_mismatch=False).pecos_decoders::batch::plan_execution): explicitworkers>1errors for history-dependent decoders and records a reproducibility warning for wall-clock-bounded ones; auto selection never parallelizes either, uses PyMatching's native vectorized path when eligible, and falls back sequential below a documented small-batch threshold.Vec<ObsMask>): PyMatching's 64-observable rejection is gone, bit-packing crosses the limb boundary correctly, and every workspace caller was migrated. Narrowing wrappers were audited: each family either produces wide masks or fails loudly at construction (guards verified per family; the windowed family gained one shared guard at its common constructor).DecodeResult: counts, empirical LER, Jeffreysinterval()with prevalidated domain (alpha in [1e-6, 0.5], shots in (0, 1e8]),execution_path,workers_used,reproducibility_warnings,sampling_seed_used(always None here; the fused sampler phase populates it), optional per-shot predictions (arbitrary-precision) and timing stats (wall_elapsed/summed_decode_elapsed, named for whatInstantmeasures).Verification
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings(the CI lane), plus per-crate test suites for pecos-decoders (both feature configurations), pecos-decoder-core, pecos-pymatching;cargo fmt --check;just lint.