Skip to content

test: regenerate guppy_opt examples, and count gates#1249

Merged
acl-cqc merged 7 commits intomainfrom
acl/guppy_opt_counts
Nov 12, 2025
Merged

test: regenerate guppy_opt examples, and count gates#1249
acl-cqc merged 7 commits intomainfrom
acl/guppy_opt_counts

Conversation

@acl-cqc
Copy link
Copy Markdown
Contributor

@acl-cqc acl-cqc commented Nov 11, 2025

The first part here is identical to examples from #1221 but I also needed myself. The second part....well, revealed why we need the first (I think updating to include Quantinuum/guppylang#1311 is particularly important) - DCE was taking out the gates because we were not doing anything to keep the result ops (!).

@acl-cqc acl-cqc changed the title tests: regenarate examples, and count gates test: regenerate guppy_opt examples, and count gates Nov 11, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.87%. Comparing base (6bc3c4e) to head (cc91af4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1249      +/-   ##
==========================================
- Coverage   79.06%   78.87%   -0.19%     
==========================================
  Files         160      160              
  Lines       20421    20420       -1     
  Branches    19489    19489              
==========================================
- Hits        16145    16106      -39     
- Misses       3289     3324      +35     
- Partials      987      990       +3     
Flag Coverage Δ
rust 78.19% <ø> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

#[case::simple_cx(guppy_simple_cx(), (4, 2))]
#[cfg_attr(miri, ignore)] // Opening files is not supported in (isolated) miri
fn optimise_guppy(#[case] mut hugr: Hugr) {
fn optimise_guppy(#[case] mut hugr: Hugr, #[case] before: (usize, usize)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to document the tuple values?

It could be two parameters, or a helper Counts struct instead

Suggested change
fn optimise_guppy(#[case] mut hugr: Hugr, #[case] before: (usize, usize)) {
fn optimise_guppy(#[case] mut hugr: Hugr, #[case] before @ (_non_alloc, _alloc): (usize, usize)) {

#[case::nested(guppy_nested(), (6, 3))]
#[case::ranges(guppy_ranges(), (8, 4))]
#[case::simple_cx(guppy_simple_cx(), (0, 0))]
#[case::simple_cx(guppy_simple_cx(), (4, 2))]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

load_guppy_circuit("simple_cx")
}

fn count_gates(h: &impl HugrView) -> (usize, usize) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be nice to have a comment explaining what this is counting and why.

As we dicussed in person it could be nice to have a map with keys as OpType and number of instances of the optypes values

@acl-cqc acl-cqc added this pull request to the merge queue Nov 12, 2025
@acl-cqc acl-cqc removed this pull request from the merge queue due to a manual request Nov 12, 2025
@acl-cqc acl-cqc enabled auto-merge November 12, 2025 15:58
@acl-cqc acl-cqc added this pull request to the merge queue Nov 12, 2025
Merged via the queue into main with commit fffb14a Nov 12, 2025
25 checks passed
@acl-cqc acl-cqc deleted the acl/guppy_opt_counts branch November 12, 2025 16:02
@hugrbot hugrbot mentioned this pull request Nov 11, 2025
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2026
## 🤖 New release

* `tket`: 0.16.0 -> 0.17.0 (✓ API compatible changes)
* `tket-qsystem`: 0.22.0 -> 0.23.0 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `tket`

<blockquote>

##
[0.17.0](tket-v0.16.0...tket-v0.17.0)
- 2026-02-02

### Bug Fixes

- *(encoded-circ)* Track unsupported wires between input and output
([#1224](#1224))
- Multiple fixes to the pytket encoder
([#1226](#1226))
- Don't use opgroup in pytket barrier encoding
([#1251](#1251))
- guppy_to_circuit always returns num_operations = 0
([#1200](#1200))
- *(pytket-decoder)* Avoid QAllocating and immediately freeing qubits
([#1256](#1256))
- Encoding of opaque subgraphs with no associated qubit/bit
([#1295](#1295))
- [**breaking**] Don't rely on command params for pytket barriers
([#1298](#1298))
- Track output qubits in CircuitInfo
([#1304](#1304))
- Wrongly reused qubit IDs in pytket encoding
([#1358](#1358))

### New Features

- Deprecate local find_tuple_unpack rewrite
([#1188](#1188))
- Add CopyableExpressionAST
([#1209](#1209))
- `NormalizeGuppy` pass to simplify generated structure
([#1220](#1220))
- [**breaking**] pytket EncodedCircuit struct for in-place pytket
optimisation ([#1211](#1211))
- [**breaking**] Interval is independent of resource IDs and scope
position ([#1205](#1205))
- Don't translate usizes to pytket
([#1241](#1241))
- BorrowSquashPass to elide redundant borrow/return ops
([#1159](#1159))
- [**breaking**] Bump hugr to 0.25.0
([#1325](#1325))
- Remove order edges in NormalizeGuppy pass
([#1326](#1326))
- [**breaking**] Remove deprecated unpack tuple pass
([#1387](#1387))

### Refactor

- Remove contain_qubits, use TypeUnpacker
([#1283](#1283))
- [**breaking**] Replace Subcircuit with SiblingSubgraph
([#1288](#1288))
- *(metadata)* [**breaking**] Migrate all metadata keys onto the new
metadata traits ([#1328](#1328))
</blockquote>

## `tket-qsystem`

<blockquote>

##
[0.23.0](tket-qsystem-v0.22.0...tket-qsystem-v0.23.0)
- 2026-02-02

### Bug Fixes

- [**breaking**] Don't rely on command params for pytket barriers
([#1298](#1298))
- Wrongly reused qubit IDs in pytket encoding
([#1358](#1358))

### New Features

- `NormalizeGuppy` pass to simplify generated structure
([#1220](#1220))
- Allow running arbitrary serializable pytket passes on hugrs
([#1266](#1266))
- BorrowSquashPass to elide redundant borrow/return ops
([#1159](#1159))
- [**breaking**] Bump hugr to 0.25.0
([#1325](#1325))
- Remove order edges in NormalizeGuppy pass
([#1326](#1326))
- hide new public funcs introduced by linearization
([#1333](#1333))

### Testing

- regenerate guppy_opt examples, and count gates
([#1249](#1249))
- run pytket on guppy_opt tests, measure (very limited) success
([#1250](#1250))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
@hugrbot hugrbot mentioned this pull request Feb 5, 2026
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.

3 participants