Skip to content

Build pecos-stab-tn at opt-level 2 in dev and test profiles like the other simulation crates - #709

Open
ciaranra wants to merge 1 commit into
devfrom
ci-stab-tn-opt-level
Open

Build pecos-stab-tn at opt-level 2 in dev and test profiles like the other simulation crates#709
ciaranra wants to merge 1 commit into
devfrom
ci-stab-tn-opt-level

Conversation

@ciaranra

@ciaranra ciaranra commented Sep 4, 2026

Copy link
Copy Markdown
Member

Why

After #683/#684 the PR gate's critical path is pr-core-rust, and inside it the workspace test phase: 2486 CPU-seconds of test work on a 4-core runner, ~10.4 min however it is scheduled (a nextest trial, #698, confirmed the phase is CPU-bound, not serialization-bound). The two largest contributors are the surface-code LER equivalence test and the pecos-stab-tn test binaries. The root Cargo.toml already builds the simulation crates at opt-level = 2 in dev/test builds for exactly this reason, but pecos-stab-tn was not on the list, so its tensor-network code ran unoptimized under test.

Measured locally (14 cores):

opt-level 0 (today) opt-level 2
pecos-stab-tn lib tests (352) 159 s 5.6 s
all pecos-stab-tn test targets (lib, verification, exact_default_measurement) ~220 s serial on CI 8 s
extra compile for the crate ~33 s

Also tried [profile.dev.package."*"] opt-level = 2 for every external dependency: no further gain on stab-tn, 6% on the LER test, and every dependency recompiles slower. Not taken.

What

One entry in the existing [profile.dev.package.*] block plus a comment with the numbers. profile.test inherits the per-package overrides (verified by reading the rustc invocations: -C opt-level=2 for the listed crates in cargo test builds). Debug assertions stay on. Crates that depend on pecos-stab-tn (the stab-mps and mast Selene plugins, pecos-rslib-exp, benchmarks) get the optimized crate in their debug builds.

Verification

  • cargo test --locked -p pecos-stab-tn with the change: lib 352 passed / 8 ignored, verification 95 passed / 9 ignored, exact_default_measurement 9 passed / 20 ignored; 46 s wall including the 37 s compile.
  • pre-commit on Cargo.toml: clean.
  • Measured on CI (gate run 33901282224, warm Rust cache): pr-core-rust 17 min end to end, down from 25 min on the previous warm-cache run and ~30 min before Cut ~20 min of wasted native builds from the Python CI lanes and make the PR-gate Rust caches restorable #683. Workspace test phase 5.1 min (per-binary times sum to 284 s, was 656 s; longest binary is now the LER test at 191 s), follow-up phases 1.6 min, compile 6.6 min.

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