Skip to content

Conversation

@acl-cqc
Copy link
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

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
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
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
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
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.

4 participants