Skip to content

Commit 00f889e

Browse files
qciaranciaranra
andauthored
Surf dems (#293)
* Wire Selene HUGR programs through the QIS path * Make surface native DEM generation ancilla-budget aware * Normalize Rust doc test README casing * Improve Selene parity checks and surface DEM tooling * Align traced-QIS DEM sampling with gate-level reference * Profile and optimize PECOS sim hot paths * Optimize PECOS sim control-path overhead * Speed up byte message builder fast paths * Remove PECOS profiling API cleanup * Handle implicit static QIS qubit handles * Restore surface metadata descriptors and DEM behavior * Restore DEM bindings and docs compatibility * Tighten Python test setup and DEM parity * lint * Address code review: dedupe, doc fixes, BTreeMap, alias cleanup, loud Selene * Lint * Fix Windows path separator mismatch in selene plugin workspace test * Restore three ignored doctests to compiling examples * Drop dangling selene_runtime re-export from pecos.engines * Bump pytest from 8.3.3 to 9.0.3 * Bump hypothesis to 6.152.1 for pytest 9 compatibility * Bump pytest-cov to 7.1.0 alongside pytest 9 * Align sub-package pyproject pins with workspace (maturin, pytest) * Separate dev/test/examples dependency groups properly * Document optional dependency groups in DEVELOPMENT.md * Pin all workspace test deps to exact versions for reproducibility * Rename tests/pecos/slr/ast to ast_tests to avoid shadowing stdlib ast * Add matplotlib to test group for surface-patch render tests * Refresh Cargo.lock and uv.lock with upstream patch-level bumps * Apply second-round review fixes: notebook alias, doc comments * Mirror lookup-only memo comment on search_decomposition cache * Replace remaining HashMap/HashSet with BTreeMap/BTreeSet in dem_builder::types * Add DEM build/render benchmarks for decomposition hot paths * Swap BTreeMap to Vec<Vec<_>> for dense candidates_by_detector hot path * Lift SingletonDecompositionIndex out of per-call hot path * Apply Vec<Vec<_>> pattern to GraphlikeDecompositionIndex for consistency * Rename Error* types to Fault* in dem_builder (ErrorMechanism, ErrorContribution, ErrorSourceType, DecomposedError) * Add profiling binary for DEM decomposition hot path * Fix clippy format_push_string in DEM benchmark and profiler * Address dependabot alerts: rand in isolated lockfiles, drop orphan cuda uv.lock --------- Co-authored-by: ciaranra <ciaranra@gmail.com>
1 parent 7651dce commit 00f889e

115 files changed

Lines changed: 10815 additions & 2307 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python-test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,17 @@ jobs:
218218
- name: Run Python tests
219219
run: just pytest
220220

221+
- name: Run slow Python tests
222+
# Only run on the primary Linux/newest-Python cell to keep the full
223+
# matrix fast. Dropping this entirely would let the `slow` lane
224+
# silently atrophy, which is exactly what the `slow` marker is
225+
# supposed to prevent.
226+
#
227+
# The `3.14` literal below must track the newest entry of the
228+
# `python-version` matrix at the top of this file (line ~34). Bump
229+
# both together.
230+
if: runner.os == 'Linux' && matrix.python-version == '3.14'
231+
run: just pytest-slow
232+
221233
- name: Run linting
222234
run: just lint check

Cargo.lock

Lines changed: 34 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ members = [
44
"python/pecos-rslib",
55
"python/pecos-rslib-cuda",
66
"python/pecos-rslib-llvm",
7-
"python/selene-plugins/pecos-selene-*",
7+
"python/selene-plugins/pecos-selene-clifford-rz",
8+
"python/selene-plugins/pecos-selene-stabilizer",
9+
"python/selene-plugins/pecos-selene-statevec",
810
"julia/pecos-julia-ffi",
911
"go/pecos-go-ffi",
1012
"crates/pecos*",

Justfile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pytest *args:
156156
else
157157
uv run pytest python/pecos-rslib/tests -m "not performance"
158158
uv run --group numpy-compat pytest python/pecos-rslib/tests -m "numpy and not performance"
159-
uv run pytest python/quantum-pecos/tests -m "not optional_dependency"
159+
uv run pytest python/quantum-pecos/tests -m "not optional_dependency and not slow"
160160
uv run pytest python/selene-plugins
161161
fi
162162

@@ -481,6 +481,11 @@ pytest-dep:
481481
uv run pytest python/pecos-rslib/tests -m "optional_dependency"
482482
uv run pytest python/quantum-pecos/tests -m "optional_dependency"
483483

484+
# Run the slower integration lane (excluded from the default fast lane)
485+
[group('test')]
486+
pytest-slow:
487+
uv run pytest python/quantum-pecos/tests -m "slow and not optional_dependency"
488+
484489

485490

486491

@@ -497,20 +502,28 @@ setup-quiet:
497502
sync-deps:
498503
#!/usr/bin/env bash
499504
set -euo pipefail
500-
# Quick check: if quantum-pecos is importable, deps are likely fine
501-
if uv run --frozen python -c "import pecos" 2>/dev/null; then
505+
# Quick check: ensure the packages used by the default dev/test lane are importable.
506+
# This catches newly added workspace members that an older .venv may be missing.
507+
if uv run --frozen python -c "import importlib.util, sys; required = ('pecos', 'pecos_rslib', 'pecos_selene_clifford_rz', 'pecos_selene_stabilizer', 'pecos_selene_statevec'); missing = [name for name in required if importlib.util.find_spec(name) is None]; sys.exit(1 if missing else 0)" 2>/dev/null; then
502508
exit 0
503509
fi
504-
echo "Python deps not installed, running uv sync..."
510+
echo "Python deps incomplete, running uv sync..."
505511
uv sync --project . --all-packages
506512

507513
[private]
508514
build-selene:
509515
#!/usr/bin/env bash
510516
set -euo pipefail
517+
PLUGIN_DIRS=()
518+
for DIR in python/selene-plugins/pecos-selene-*/; do
519+
[ -d "$DIR" ] || continue
520+
[ -f "$DIR/Cargo.toml" ] || continue
521+
[ -f "$DIR/pyproject.toml" ] || continue
522+
PLUGIN_DIRS+=("$DIR")
523+
done
511524
# Check if any selene source changed since last install
512525
NEEDS_BUILD=false
513-
for DIR in python/selene-plugins/pecos-selene-*/; do
526+
for DIR in "${PLUGIN_DIRS[@]}"; do
514527
PKG=$(basename "$DIR")
515528
DEST="$DIR/python/${PKG//-/_}/_dist/lib/"
516529
SO=$(find "$DEST" -name "*.so" 2>/dev/null | head -1 || true)
@@ -531,7 +544,7 @@ build-selene:
531544
fi
532545
echo "Building Selene plugins..."
533546
CARGO_ARGS=""
534-
for DIR in python/selene-plugins/pecos-selene-*/; do
547+
for DIR in "${PLUGIN_DIRS[@]}"; do
535548
CARGO_ARGS="$CARGO_ARGS -p $(basename "$DIR")"
536549
done
537550
if [ -n "$CARGO_ARGS" ]; then

crates/benchmarks/benches/benchmarks.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod modules {
1919
pub mod allocation_overhead;
2020
pub mod clifford_rz;
2121
pub mod cpu_stabilizer_comparison;
22+
pub mod dem_builder;
2223
pub mod dem_sampler;
2324
pub mod dod_statevec;
2425
pub mod quizx_eval;
@@ -51,10 +52,10 @@ use modules::gpu_influence_sampler;
5152
#[cfg(feature = "cppsparsestab")]
5253
use modules::sparse_stab_vs_cpp;
5354
use modules::{
54-
allocation_overhead, clifford_rz, cpu_stabilizer_comparison, dem_sampler, dod_statevec,
55-
measurement_sampling, native_statevec_comparison, noise_models, pecos_neo_comparison,
56-
quizx_eval, rng, set_ops, sparse_stab_w_vs_y, sparse_state_vec, stabilizer_sims,
57-
state_vec_sims, surface_code, trig,
55+
allocation_overhead, clifford_rz, cpu_stabilizer_comparison, dem_builder, dem_sampler,
56+
dod_statevec, measurement_sampling, native_statevec_comparison, noise_models,
57+
pecos_neo_comparison, quizx_eval, rng, set_ops, sparse_stab_w_vs_y, sparse_state_vec,
58+
stabilizer_sims, state_vec_sims, surface_code, trig,
5859
};
5960

6061
fn all_benchmarks(c: &mut Criterion) {
@@ -64,6 +65,7 @@ fn all_benchmarks(c: &mut Criterion) {
6465
quizx_eval::benchmarks(c);
6566
#[cfg(feature = "cuquantum")]
6667
cuquantum::benchmarks(c);
68+
dem_builder::benchmarks(c);
6769
dem_sampler::benchmarks(c);
6870
dod_statevec::benchmarks(c);
6971
#[cfg(feature = "gpu-sims")]

0 commit comments

Comments
 (0)