Skip to content

Conversation

@lmondada
Copy link
Contributor

@lmondada lmondada commented Jun 24, 2025

This requires Quantinuum/hugr#2349 and Quantinuum/hugr#2402 to be merged in, as well as a breaking hugr release before it can be merged.

@lmondada lmondada changed the title feat(badgerv2): Add RewriteStateSpace feat: Add badgerv2_unstable feature, RewriteSpace and CommitFactory Jun 24, 2025
@lmondada lmondada force-pushed the lm/commit-factory branch 3 times, most recently from a5d0a42 to c288a39 Compare June 24, 2025 09:45
@codecov
Copy link

codecov bot commented Jun 24, 2025

Codecov Report

Attention: Patch coverage is 23.50746% with 410 lines in your changes missing coverage. Please review.

Please upload report for BASE (lm/hugr-v21@2ac9eed). Learn more about missing BASE report.

Files with missing lines Patch % Lines
tket2/src/rewrite_space/max_sat.rs 0.00% 92 Missing ⚠️
tket2/src/rewrite_space/factory/commute_cz.rs 42.94% 89 Missing ⚠️
tket2/src/rewrite_space.rs 0.00% 86 Missing ⚠️
tket2/src/rewrite_space/factory/explore.rs 35.65% 74 Missing ⚠️
tket2/src/rewrite_space/factory.rs 21.42% 44 Missing ⚠️
tket2/src/rewrite_space/factory/boxed.rs 19.35% 25 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##             lm/hugr-v21     #928   +/-   ##
==============================================
  Coverage               ?   76.61%           
==============================================
  Files                  ?       98           
  Lines                  ?    11709           
  Branches               ?    11435           
==============================================
  Hits                   ?     8971           
  Misses                 ?     2119           
  Partials               ?      619           
Flag Coverage Δ
python 81.75% <ø> (?)
rust 76.49% <23.50%> (?)

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.

@lmondada lmondada force-pushed the lm/commit-factory branch from c288a39 to d77a0c2 Compare June 24, 2025 09:49
@lmondada lmondada force-pushed the lm/commit-factory branch 3 times, most recently from f881e07 to 00ba8e0 Compare June 29, 2025 09:01
zrho and others added 2 commits June 30, 2025 14:46
This replaces `TypeArg::Tuple` with `TypeArg::List` in the construction
of a function type. It also changes the `Cargo.toml` to use the main
branch of `hugr` so that Quantinuum/hugr#2378 is
integrated, fixing more test failures.

There's now one remaining test failure, related to
Quantinuum/hugr#2387. It's unclear to me whether
that is to be fixed in `tket2` or in `hugr`.
@lmondada lmondada force-pushed the lm/commit-factory branch 5 times, most recently from 158ff4e to 7f5eb85 Compare July 4, 2025 08:02
@lmondada
Copy link
Contributor Author

lmondada commented Jul 4, 2025

After trying out a lot of approaches, I've chosen to pull the z3 compiled libraries from the z3 GitHub release (rather than asking the user to install it system-wide, or compiling them from scratch).

This required changes to the z3-sys crate. I've created a pull request on that project to merge in these changes, but for the time being I suggest we pull z3 from my fork.

z3-sys pull request: prove-rs/z3.rs#352
z3 releases: https://github.com/Z3Prover/z3/releases

@lmondada lmondada marked this pull request as ready for review July 4, 2025 08:25
@lmondada lmondada requested a review from a team as a code owner July 4, 2025 08:25
@lmondada lmondada requested review from doug-q and removed request for a team July 4, 2025 08:25
@lmondada lmondada force-pushed the lm/commit-factory branch from 7f5eb85 to a874669 Compare July 4, 2025 08:47
@lmondada lmondada requested review from aborgna-q and removed request for doug-q July 4, 2025 09:44
@lmondada lmondada force-pushed the lm/commit-factory branch from 2db27ab to 0eca259 Compare July 8, 2025 10:26
Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

Adding some comments, I still need to read through rewrite_space/

Comment on lines +52 to +54
hugr = { git = "https://github.com/CQCL/hugr", rev = "544759f4f472ddc4620c6679e11fe7551b46624c" }
hugr-core = { git = "https://github.com/CQCL/hugr", rev = "544759f4f472ddc4620c6679e11fe7551b46624c" }
hugr-cli = { git = "https://github.com/CQCL/hugr", rev = "544759f4f472ddc4620c6679e11fe7551b46624c" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to set the "patch" above if setting a rev here.

Will this work with hugr 0.21 once released?


[build-dependencies]
cc = "1.2"
cc = "1.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

drive-by: Can you move the explicit dependency versions in this file to the workspace toml?

Comment on lines +80 to +84
[dependencies.z3] # Currently using a fork of z3.rs to install from GH releases
git = "https://github.com/lmondada/z3.rs.git"
rev = "d1ca853678c"
features = ["gh-release"]
optional = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Merging this will prevent us from publishing tket2 releases.
Should we wait for your change to be published upstream?

Comment on lines +138 to +141
/// TKET2 extensions.
#[serde_as]
#[derive(Debug, Clone, From, Into, serde::Serialize, serde::Deserialize)]
pub struct HugrWithExts(#[serde_as(as = "AsStringTk2Envelope")] Hugr);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add a doc comment saying that this is not intendeed to be used directly, in case someone tries to use it as a HugrView?

Comment on lines +43 to +44
// DAN: If you need to produce serialised HUGRs, you can use this test
// and run it with `cargo test dummy_test_to_save_hugr`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if we want to keep this comment :)

Comment on lines +131 to +134
for children_pair in children.combinations(2) {
let &[c1, c2] = children_pair.as_slice() else {
panic!("Expected 2 children, got {}", children_pair.len());
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
for children_pair in children.combinations(2) {
let &[c1, c2] = children_pair.as_slice() else {
panic!("Expected 2 children, got {}", children_pair.len());
};
for &[c1, c2] in children.array_combinations() {

Comment on lines +131 to +134
for children_pair in children.combinations(2) {
let &[c1, c2] = children_pair.as_slice() else {
panic!("Expected 2 children, got {}", children_pair.len());
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

How much do we expect the set of children to grow? Is it worth trying to reduce the quadratic cost?
(there's some tradeoffs we could take vs. the size of the invalidation sets)

As a starter, we should probably take the invalidation_set(c1, commit_id).collect()s out of the double-loop, and using BTreeSet::is_disjoint inside.

@aborgna-q aborgna-q self-requested a review July 8, 2025 16:21
Base automatically changed from lm/hugr-v21 to main July 10, 2025 11:40
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.

5 participants