-
Notifications
You must be signed in to change notification settings - Fork 11
test: regenerate guppy_opt examples, and count gates #1249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tket-qsystem/tests/guppy_opt.rs
Outdated
| #[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)) { |
There was a problem hiding this comment.
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
| 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)) { |
tket-qsystem/tests/guppy_opt.rs
Outdated
| #[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))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
tket-qsystem/tests/guppy_opt.rs
Outdated
| load_guppy_circuit("simple_cx") | ||
| } | ||
|
|
||
| fn count_gates(h: &impl HugrView) -> (usize, usize) { |
There was a problem hiding this comment.
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
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
resultops (!).