Skip to content

Commit 979d414

Browse files
authored
Delete the direct HUGR interpreter and shrink pecos-hugr to the static loader and result-tag helpers (#733)
* Run Guppy and HUGR programs on the Selene QIS route by default and remove the HUGR interpreter from the Python API * Fold the review findings for the QIS-route default: migrate the optional-lane Guppy tests, refuse neo after an explicit engine, route every HUGR entry through one lowering helper * Drop the manual runner that set a log filter for the deleted interpreter module * Delete the direct HUGR interpreter and shrink pecos-hugr to the static loader and result-tag helpers * Keep the CRz full-matrix DAG-conversion test in pecos-quantum and correct the fixture generator's stated purpose
1 parent 2095279 commit 979d414

53 files changed

Lines changed: 90 additions & 17075 deletions

Some content is hidden

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

Cargo.lock

Lines changed: 1 addition & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ dev-preflight: _msvc-bootstrap
581581
LINK_MODE=$("$LLVM_DIR/bin/llvm-config" --shared-mode 2>/dev/null || echo "unknown")
582582
if [ "$LINK_MODE" != "shared" ]; then
583583
echo "PECOS dev preflight failed: LLVM at $LLVM_DIR reports '$LINK_MODE' link mode."
584-
echo "Full workspace HUGR tests need shared LLVM 21.1 to avoid high-memory static links."
584+
echo "Full workspace LLVM tests need shared LLVM 21.1 to avoid high-memory static links."
585585
print_llvm_hint
586586
exit 1
587587
fi

crates/pecos-cli/src/cli/install_cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn confirm_managed_llvm_install(yes: bool) -> Result<()> {
150150
);
151151
println!("Expect a large download and several GB of extracted files.");
152152
println!("The managed install is shared-first; static LLVM is not accepted for");
153-
println!("the full workspace HUGR test lane because LLVM 21.1 static links can");
153+
println!("the full workspace LLVM test lane because LLVM 21.1 static links can");
154154
println!("use substantial memory.");
155155
println!();
156156
println!("To use your own LLVM instead, run:");

crates/pecos-cli/src/cli/rust_cmd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn reject_static_llvm_workspace_test() -> Result<()> {
124124
);
125125

126126
Err(Error::Config(format!(
127-
"Refusing full workspace HUGR tests with {mode} LLVM at {}. \
127+
"Refusing full workspace LLVM tests with {mode} LLVM at {}. \
128128
LLVM 21.1 static workspace tests can spawn many multi-GB linker jobs. \
129129
{setup_hint}",
130130
llvm_path.display()
@@ -491,7 +491,7 @@ fn run_test(profile: super::BuildProfile, include_ffi: bool) -> Result<()> {
491491

492492
println!("Testing workspace packages...");
493493
// runtime = sim + qasm + phir (format parsers)
494-
// hugr = qis (includes llvm) + hugr compilation
494+
// hugr = static HUGR/DAG conversion (no LLVM)
495495
// neo = sim() routing to the pecos-neo stack (contract tests)
496496
// pecos-cli is excluded here and tested separately below with --features=runtime
497497
// to ensure the pecos binary has PHIR/QIS support for integration tests.

crates/pecos-cli/src/cli/setup_cmd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ fn setup_llvm(mode: PromptMode) -> Result<()> {
358358
if let Some(reason) = pecos_build::llvm::installer::managed_install_unavailable_reason() {
359359
println!(" LLVM 21.1 not found.");
360360
println!(" {reason}");
361-
println!(" QIR/HUGR features will not be available until LLVM is configured.");
361+
println!(" QIR/HUGR compilation will not be available until LLVM is configured.");
362362
return Ok(());
363363
}
364364

@@ -372,7 +372,7 @@ fn setup_llvm(mode: PromptMode) -> Result<()> {
372372
) {
373373
pecos_build::llvm::installer::install_llvm(false, false)?;
374374
} else {
375-
println!(" Skipping LLVM. QIR/HUGR features will not be available.");
375+
println!(" Skipping LLVM. QIR/HUGR compilation will not be available.");
376376
}
377377

378378
Ok(())

crates/pecos-hugr/Cargo.toml

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,12 @@ repository.workspace = true
99
license.workspace = true
1010
keywords.workspace = true
1111
categories.workspace = true
12-
description = "Guppy HUGR interpreter engine for PECOS quantum simulator"
13-
14-
[features]
15-
default = ["wasm"]
16-
wasm = ["pecos-wasm/wasm"]
12+
description = "Static HUGR loading and result-tag analysis for PECOS"
1713

1814
[dependencies]
19-
# Logging
20-
log.workspace = true
21-
22-
# Error handling
2315
anyhow.workspace = true
24-
thiserror.workspace = true
25-
26-
# Serialization
27-
serde_json.workspace = true
28-
29-
# HUGR support
3016
tket.workspace = true
3117
tket-qsystem.workspace = true
3218

33-
# Workspace dependencies
34-
pecos-core.workspace = true
35-
pecos-engines.workspace = true
36-
pecos-quantum = { workspace = true, features = ["hugr"] }
37-
pecos-wasm = { workspace = true, optional = true }
38-
39-
[dev-dependencies]
40-
env_logger.workspace = true
41-
tempfile.workspace = true
42-
# For creating test HUGRs from DagCircuit
43-
pecos-quantum = { workspace = true, features = ["hugr"] }
44-
# For integration testing with quantum simulator
45-
pecos-simulators.workspace = true
46-
# For compiling WAT to WASM in tests
47-
wat.workspace = true
48-
4919
[lints]
5020
workspace = true

crates/pecos-hugr/README.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
# pecos-hugr
22

3-
Direct HUGR interpreter for PECOS.
3+
Static HUGR loading and result-tag analysis for PECOS.
44

5-
## Purpose
5+
The loader validates HUGR envelopes. The result-tag helpers recover structural
6+
measurement provenance and detect nontrivial control flow for the Guppy detector
7+
error model bindings. HUGR execution belongs to Selene and Guppy.
68

7-
Executes HUGR (Hierarchical Unified Graph Representation) programs directly without compilation to LLVM IR. Provides a classical control engine that interprets HUGR operations.
9+
## Public helpers
810

9-
## Key Types
10-
11-
- `HugrEngine` - Classical control engine for HUGR programs
12-
- `HugrEngineBuilder` - Builder pattern for engine construction
13-
- `hugr_engine()` - Convenience function to start building
14-
15-
## Relationship to pecos-hugr-qis
16-
17-
- **pecos-hugr**: Direct interpretation of HUGR (this crate)
18-
- **pecos-hugr-qis**: Compiles HUGR to LLVM IR for execution via QIS pipeline
19-
20-
## Usage
21-
22-
```rust
23-
use pecos_hugr::{hugr_engine, hugr_sim};
24-
use pecos_programs::Hugr;
25-
26-
let hugr = Hugr::from_file("program.hugr")?;
27-
let results = hugr_sim(hugr).seed(42).run(100)?;
28-
```
11+
- `load_hugr_from_bytes` and `load_hugr_from_file`
12+
- `extract_result_tag_measurements`
13+
- `measurement_op_count`
14+
- `has_nontrivial_control_flow`
2915

3016
## Acknowledgements
3117

0 commit comments

Comments
 (0)