Skip to content

Put the pecos-neo composite noise DSL behind a composite-noise feature and delete the compiled-primitive prototype - #764

Open
ciaranra wants to merge 3 commits into
devfrom
neo-composite-noise-feature
Open

ciaranra wants to merge 3 commits into
devfrom
neo-composite-noise-feature

Conversation

@ciaranra

Copy link
Copy Markdown
Member

Summary

Puts pecos-neo's composite noise DSL (noise::composite, about 13k lines of Condition / Primitive / GateAction machinery) behind a cargo feature, composite-noise, off by default, and deletes the compiled-primitive prototype that nothing ever wired in. Step 4 of the pecos-neo core-adoption sequence (after #711, #712, #756, #761).

The default stack that sim() will eventually run on uses the plain channels: GeneralNoiseModelBuilder, which the facade maps onto, never constructs a composite type. The DSL stays available to anyone who wants it; it just stops being part of what every downstream compiles, lints and audits.

What changed

  • composite-noise = [] in exp/pecos-neo/Cargo.toml, not in default. Gated as whole items: the noise::composite module, the composite re-export in noise::prelude, NoiseModelBuilder's five with_*_noise(primitive) / with_custom_channel methods and their imports, and in noise::patterns the composite-backed functions (dephasing_only, with_leakage, chain_measurement_crosstalk, grid_measurement_crosstalk, realistic_device_noise, surface_code_noise) together with DeviceNoiseParams. The four plain patterns stay ungated. The feature adds or removes whole items only; no field, parameter or variant changes shape with it.
  • noise/composite/compiled.rs (761 lines) deleted with its re-exports, the bench_dispatch_comparison benchmark, and the documentation section that called a compile() that did not exist. The enum-dispatch idea it prototyped was measured and rejected in Dispatch pecos-neo noise events only to channels that declare the event kind #761.
  • Module docs, the noise quick-start, introspection / topology / general_builder examples rewritten without composite; intra-doc links to composite types are plain text so cargo doc is clean with the feature off. README, user guide, dev docs and docs/experimental/composable-noise.md name the feature.
  • pecos-neo's self dev-dependency enables composite-noise (as it already does qasm), so every test, doctest, bench and example keeps building and running exactly as before. That mechanism means no dev target of this crate can ever be feature-off; the feature-off build is the library, and it is checked by two new lanes: cargo clippy -p pecos-neo --lib -- -D warnings (added to the rust-lint-no-llvm CI job) and cargo doc -p pecos-neo --no-deps with -D warnings.
  • The unified doc-test crate (python/quantum-pecos/tests/docs/rust_crate) is a separate package and does not inherit that dev-dependency, so its manifest enables the feature explicitly; the 176 generated doc tests pass unchanged.

No consumer in crates/pecos, pecos-rslib-exp or pecos-qec uses composite (grepped).

Verification

cargo fmt --all -- --check
cargo clippy --locked -p pecos-neo --lib -- -D warnings                          # feature off
RUSTDOCFLAGS="-D warnings" cargo doc --locked -p pecos-neo --no-deps              # feature off
cargo clippy --locked -p pecos-neo --all-targets --all-features -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --locked -p pecos-neo --no-deps --all-features
cargo clippy --locked -p pecos -p pecos-rslib-exp -p pecos-qec -p benchmarks --all-targets --all-features -- -D warnings
cargo test --locked -p pecos-neo --all-features
cargo test --locked -p pecos --features neo --test neo_routing_test --test neo_emission_test --test neo_v6_example_sweep_test --test neo_equivalence_matrix_test --test neo_hugr_routing_test
cargo test --locked -p pecos-qec --features neo per_gate
cargo bench --locked -p pecos-neo --bench hot_path --no-run
cargo build --locked -p pecos-neo --examples
cargo check --locked --workspace --all-targets --all-features
(cd python/quantum-pecos/tests/docs/rust_crate && cargo test --locked)

All green on a cold build (changed crates cleaned first). Net diff about minus 830 lines.

…e and delete the compiled-primitive prototype
@ciaranra
ciaranra marked this pull request as ready for review September 12, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant