You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #330 adds RNGadvance(delta) (relative stream movement / rewind) to the Python RNGModel (python/quantum-pecos/src/pecos/engines/cvm/rng_model.py). The logic is correct and well-tested, but that RNGModel is reached only by the legacy hybrid_engine_old.py. We're treating #330 as a contained fix for that legacy workflow.
The broader picture: program-level RNG platform functions (RNGseed, RNGbound, RNGindex, RNGnum, RNGadvance) are fragmented and mostly absent from the newer workflows.
(.seed() on sim()/sim_neo() is the Monte-Carlo noise sampling seed — a separate mechanism from program RNG.)
Strategic direction
Per the pecos-neo default transition (strangler-fig: route sim() to pecos-neo, then collapse the other workflows onto it; see #151 for the canonical Rust RNGModel), we should not scatter RNG implementations across pecos-qasm / pecos-phir-json / pecos-hugr — those classical paths are on the retirement track. Investing there is throwaway work.
Instead: program RNG (including RNGadvance) should land once, in the canonical Rust RNGModel (#151) consumed by the pecos-neo classical path, so it's there when the other workflows migrate.
Proposed work
Establish program RNG as a tracked item in the neo transition (sibling to the existing G-series gaps), with the Rust RNGModel as the single source of truth.
Port set_relative_index/RNGadvance (rejection-sampling-aware rewind via replay of the historical bound sequence) into the Rust RNGModel; wire the pecos-neo classical path to all RNG platform functions.
Resolve the cross-engine semantic that fix: add RNGadvance support to legacy Python CVM #330 introduced: Python set_seed now resets count and clears bound history; Rust set_seed (rng_pcg.rs:311) does not — pick one and make the canonical model match.
Add end-to-end tests (program → RNG functions incl. advance → assert draws) against the neo path.
Leave the retiring engines (pecos-qasm, pecos-phir-json, pecos-hugr) as-is for RNG; let migration carry them onto the neo implementation rather than back-porting.
Context
PR #330 adds
RNGadvance(delta)(relative stream movement / rewind) to the PythonRNGModel(python/quantum-pecos/src/pecos/engines/cvm/rng_model.py). The logic is correct and well-tested, but thatRNGModelis reached only by the legacyhybrid_engine_old.py. We're treating #330 as a contained fix for that legacy workflow.The broader picture: program-level RNG platform functions (
RNGseed,RNGbound,RNGindex,RNGnum,RNGadvance) are fragmented and mostly absent from the newer workflows.RNGadvancehybrid_engine_old.py(legacy)RNGModelhybrid_engine.pyRustPhirClassicalInterpreter(pecos-phir-json)sim()— QASMpecos-qasmenginesim()— PHIR/HUGR/Guppypecos-phir-json/pecos-hugrsim_neo()pecos_rslib_exp/ pecos-neo(
.seed()onsim()/sim_neo()is the Monte-Carlo noise sampling seed — a separate mechanism from program RNG.)Strategic direction
Per the pecos-neo default transition (strangler-fig: route
sim()to pecos-neo, then collapse the other workflows onto it; see #151 for the canonical RustRNGModel), we should not scatter RNG implementations acrosspecos-qasm/pecos-phir-json/pecos-hugr— those classical paths are on the retirement track. Investing there is throwaway work.Instead: program RNG (including
RNGadvance) should land once, in the canonical RustRNGModel(#151) consumed by the pecos-neo classical path, so it's there when the other workflows migrate.Proposed work
RNGModelas the single source of truth.set_relative_index/RNGadvance(rejection-sampling-aware rewind via replay of the historical bound sequence) into the RustRNGModel; wire the pecos-neo classical path to all RNG platform functions.set_seednow resetscountand clears bound history; Rustset_seed(rng_pcg.rs:311) does not — pick one and make the canonical model match.advance→ assert draws) against the neo path.pecos-qasm,pecos-phir-json,pecos-hugr) as-is for RNG; let migration carry them onto the neo implementation rather than back-porting.Refs: #330, #151