Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a836f12
chore!: BUmp to hugr-0.20
doug-q May 1, 2025
8dee0ad
fmt
doug-q May 1, 2025
764152a
update extensions
doug-q May 1, 2025
f7c7737
how do you deal with Infallible?
doug-q May 1, 2025
d7178ba
fix
doug-q May 1, 2025
36ba773
Bump to latest rev
mark-koch May 6, 2025
7880723
Regenerate json extensions
mark-koch May 6, 2025
c2b53c3
bump to latest rev
ss2165 May 6, 2025
2fac8ce
Add linearize arrays pass to qsystem pass
mark-koch May 6, 2025
1dda29b
Bump to latest rev
mark-koch May 7, 2025
bf4c50b
gen extensions
ss2165 May 7, 2025
3eee1b5
bump commit
ss2165 May 8, 2025
0bf8515
bump rev
ss2165 May 8, 2025
733e772
feat!: bump msrv to 1.85
ss2165 May 8, 2025
22ce914
Merge branch 'ss/msrv' into update-hugr-202505
ss2165 May 8, 2025
beb408a
Merge branch 'main' into update-hugr-202505
ss2165 May 8, 2025
ec5090e
regenerate eccs
ss2165 May 8, 2025
6e082c2
expect deprecations
ss2165 May 8, 2025
ee6cc09
pin to hugr-py commit
ss2165 May 8, 2025
d6fa53f
wip bump to rc.1
aborgna-q May 13, 2025
d9097a5
fix infinite type recursion in CircuitHash
aborgna-q May 13, 2025
120b290
more test fixes
aborgna-q May 13, 2025
40209c7
recompile eccs
aborgna-q May 13, 2025
5560e5d
squash remaining rust-side errors
aborgna-q May 13, 2025
a3a0817
aborgna-q May 13, 2025
702db23
Update hugr, failing SimpleReplacement::try_new
aborgna-q May 14, 2025
8e5a635
Update hugr with funcdecl private fields
aborgna-q May 14, 2025
bb6ce4c
fix subgraph signature
lmondada May 14, 2025
c008735
use released hugr
aborgna-q May 15, 2025
69840e5
Start lowering implementation
tatiana-s Apr 14, 2025
7f29af7
Add further replacements
tatiana-s Apr 15, 2025
7a38e6f
Rename bool ops
tatiana-s Apr 16, 2025
3b51e36
Various pass improvements
tatiana-s Apr 16, 2025
27f39c0
Change measure op signatures and replace
tatiana-s Apr 16, 2025
a00db20
Fix failing tests
tatiana-s Apr 17, 2025
013e6f1
Improve tests
tatiana-s Apr 17, 2025
1577e83
Minor fixes
tatiana-s Apr 23, 2025
cda725e
Add tag to measure replacements
tatiana-s Apr 25, 2025
e0bca55
Fixes after rebase
tatiana-s May 14, 2025
2e0bffe
Actual bump
tatiana-s May 14, 2025
121e7a0
More rebasing fixes
tatiana-s May 14, 2025
645478c
Update
tatiana-s May 15, 2025
d4370d7
hugr=py dependency link
tatiana-s May 15, 2025
ee09996
fmt
ss2165 May 15, 2025
5597f79
update extension
ss2165 May 15, 2025
30acb3e
Add const lowering
tatiana-s May 15, 2025
9e1bef3
fix: constant sum type
ss2165 May 15, 2025
7b089db
remove comment
ss2165 May 15, 2025
88ffa84
Change pass order
tatiana-s May 19, 2025
c18e683
Merge remote-tracking branch 'origin/main' into ts/replace-bool
tatiana-s May 19, 2025
17cee70
Minor fixes
tatiana-s May 19, 2025
3ecd0d5
More fixes
tatiana-s May 19, 2025
8deef1b
Re-add xor
tatiana-s May 19, 2025
848f256
Merge remote-tracking branch 'origin/main' into ts/replace-bool
tatiana-s May 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 31 additions & 31 deletions tket2-exts/src/tket2_exts/data/tket2/bool.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,21 @@
},
"binary": false
},
"bool_to_sum": {
"eq": {
"extension": "tket2.bool",
"name": "bool_to_sum",
"description": "Convert a tket2.bool into a Hugr unit sum.",
"name": "eq",
"description": "Equality between two tket2.bools.",
"signature": {
"params": [],
"body": {
"input": [
{
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
},
{
"t": "Opaque",
"extension": "tket2.bool",
Expand All @@ -68,36 +75,29 @@
],
"output": [
{
"t": "Sum",
"s": "Unit",
"size": 2
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
}
]
}
},
"binary": false
},
"eq": {
"make_opaque": {
"extension": "tket2.bool",
"name": "eq",
"description": "Equality between two tket2.bools.",
"name": "make_opaque",
"description": "Convert a Hugr bool_t (a unit sum) into an tket2.bool.",
"signature": {
"params": [],
"body": {
"input": [
{
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
},
{
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
"t": "Sum",
"s": "Unit",
"size": 2
}
],
"output": [
Expand Down Expand Up @@ -178,28 +178,28 @@
},
"binary": false
},
"sum_to_bool": {
"read": {
"extension": "tket2.bool",
"name": "sum_to_bool",
"description": "Convert a Hugr unit sum into an tket2.bool.",
"name": "read",
"description": "Convert a tket2.bool into a Hugr bool_t (a unit sum).",
"signature": {
"params": [],
"body": {
"input": [
{
"t": "Sum",
"s": "Unit",
"size": 2
}
],
"output": [
{
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
}
],
"output": [
{
"t": "Sum",
"s": "Unit",
"size": 2
}
]
}
},
Expand Down
16 changes: 10 additions & 6 deletions tket2-exts/src/tket2_exts/data/tket2/qsystem.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@
],
"output": [
{
"t": "Sum",
"s": "Unit",
"size": 2
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
}
]
}
Expand All @@ -114,9 +116,11 @@
"t": "Q"
},
{
"t": "Sum",
"s": "Unit",
"size": 2
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
}
]
}
Expand Down
8 changes: 5 additions & 3 deletions tket2-exts/src/tket2_exts/data/tket2/quantum.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@
],
"output": [
{
"t": "Sum",
"s": "Unit",
"size": 2
"t": "Opaque",
"extension": "tket2.bool",
"id": "bool",
"args": [],
"bound": "C"
}
]
}
Expand Down
12 changes: 7 additions & 5 deletions tket2-hseries/src/extension/qsystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use crate::extension::futures;
use derive_more::Display;
use lazy_static::lazy_static;
use strum::{EnumIter, EnumString, IntoStaticStr};
use tket2::extension::bool::{bool_type, BoolOp};
Copy link
Contributor

Choose a reason for hiding this comment

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

bool_type is not new or even touched in this PR but I have to wonder whether bool_type (opaque) vs bool_t (Hugr prelude / Sum) is the best naming scheme ;-). Might this be a good time to consider renaming bool_type to e.g. opaque_bool(_t), tket2_bool, something like that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, this is going to be annoying. I think my preference is opaque_bool_t


use super::futures::future_type;

Expand Down Expand Up @@ -110,12 +111,12 @@ impl MakeOpDef for QSystemOp {
LazyMeasureReset => Signature::new(qb_t(), vec![qb_t(), future_type(bool_t())]),
Reset => Signature::new(one_qb_row.clone(), one_qb_row),
ZZPhase => Signature::new(vec![qb_t(), qb_t(), float64_type()], two_qb_row),
Measure => Signature::new(one_qb_row, bool_t()),
Measure => Signature::new(one_qb_row, bool_type()),
Rz => Signature::new(vec![qb_t(), float64_type()], one_qb_row),
PhasedX => Signature::new(vec![qb_t(), float64_type(), float64_type()], one_qb_row),
TryQAlloc => Signature::new(type_row![], Type::from(option_type(one_qb_row))),
QFree => Signature::new(one_qb_row, type_row![]),
MeasureReset => Signature::new(one_qb_row.clone(), vec![qb_t(), bool_t()]),
MeasureReset => Signature::new(one_qb_row.clone(), vec![qb_t(), bool_type()]),
}
.into()
}
Expand Down Expand Up @@ -452,8 +453,9 @@ pub trait QSystemOpBuilder: Dataflow + UnwrapBuilder + ArrayOpBuilder {
/// Build a projective measurement with a conditional flip.
fn build_measure_flip(&mut self, qb: Wire) -> Result<[Wire; 2], BuildError> {
let [qb, b] = self.add_measure_reset(qb)?;
let sum_b = self.add_dataflow_op(BoolOp::read, [b])?.out_wire(0);
let mut conditional = self.conditional_builder(
([type_row![], type_row![]], b),
([type_row![], type_row![]], sum_b),
[(qb_t(), qb)],
vec![qb_t()].into(),
)?;
Expand All @@ -470,7 +472,7 @@ pub trait QSystemOpBuilder: Dataflow + UnwrapBuilder + ArrayOpBuilder {
case1.finish_with_outputs([qb])?;

let [qb] = conditional.finish_sub_container()?.outputs_arr();
Ok([qb, b])
Ok([qb, sum_b])
}

/// Build a qalloc operation that panics on failure.
Expand Down Expand Up @@ -591,7 +593,7 @@ mod test {
let hugr = {
let mut func_builder = FunctionBuilder::new(
"all_ops",
Signature::new(vec![qb_t(), float64_type()], vec![bool_t()]),
Signature::new(vec![qb_t(), float64_type()], vec![bool_type()]),
)
.unwrap();
let [q0, angle] = func_builder.input_wires_arr();
Expand Down
4 changes: 2 additions & 2 deletions tket2-hseries/src/extension/qsystem/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ mod test {
assert_eq!(lowered.len(), 6);
// dfg, input, output, alloc + (10 for unwrap), phasedx, rz, toturns, fmul, phasedx, free +
// 5x(float + load), measure_reset, conditional, case(input, output) * 2, flip
// (phasedx + 2*(float + load))
// (phasedx + 2*(float + load)), tket2.read
// + 19 for the barrier array wrapping, popping and option unwrapping
assert_eq!(h.descendants(h.module_root()).count(), 82);
assert_eq!(h.descendants(h.module_root()).count(), 83);
assert_eq!(check_lowered(&h), Ok(()));
if let Err(e) = h.validate() {
panic!("{}", e);
Expand Down
Loading
Loading