Phase 3: fused DemSampler.decode() with a frozen reproducibility ABI - #535
Open
ciaranra wants to merge 1 commit into
Open
Phase 3: fused DemSampler.decode() with a frozen reproducibility ABI#535ciaranra wants to merge 1 commit into
ciaranra wants to merge 1 commit into
Conversation
ciaranra
force-pushed
the
unified-decode-p2a
branch
from
August 16, 2026 19:03
e546401 to
d2d811d
Compare
ciaranra
force-pushed
the
unified-decode-p3
branch
from
August 16, 2026 19:03
c5044ff to
f6b3d06
Compare
ciaranra
force-pushed
the
unified-decode-p3
branch
from
August 16, 2026 19:25
f6b3d06 to
71eb287
Compare
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 3 of the unified batch-decode API, stacked on #530 (phases 1-2 merge first).
sampler.decode(dem, num_shots, decoder=..., *, seed=None, workers=None, predictions=False, timing=False)— the fused sample-and-decode entry point returning the sharedDecodeResult, withsampling_seed_usedpopulated (entropy draws are returned so any run can be replayed).ksamples fromPecosRngseeded with the k-th SplitMix64 output ofseed XOR 0x5045434F5344454D("PECOSDEM"), one single-shotDemSampler::samplecall per shot. The hard guarantee: a fixed(seed, num_shots)yields an identical shot and prediction stream for every worker count, sequential and native execution included. Golden pin tests freeze the derivation (owner-computed literals, independently re-derived three times) and an end-to-end fused stream spanning both chunk boundaries; a consequence pinned by test: the stream for N shots is a prefix of the stream for M > N.sampling_chunk_rng) feeds all three execution paths so the ABI's load-bearing lines cannot drift apart.SampleBatch's guard; unconditional decoder build + dimension preflight happens before dispatch, including at zero shots.sample_decode_count(documented, including the deliberate asymmetry withSampleBatch.decode).sample_decode_count/sample_batchstreams are byte-untouched, pinned by per-shot row regression literals, and remain until the migration phase.Verification
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings; test suites for pecos-random (ABI pins), pecos-decoders, pecos-decoder-core, pecos-pymatching;cargo fmt --check;just lint.