Skip to content

Commit

Permalink
fix(sharder): treat conditional as shards
Browse files Browse the repository at this point in the history
Since conditionals depend on classical bits in their condition,
we should create shards for each of them, instead of completely
ignoring any dependency that may occur on those classical bits.
Fixes: #150

A side effect:
	We were previously emitting a Skip mop (introduced in #138)
	for conditional global phase operations, but now they
	correctly get filtered out by `_is_command_global_phase`
  • Loading branch information
qartik committed Mar 24, 2024
1 parent c6bb114 commit d7730c7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2,216 deletions.
2 changes: 1 addition & 1 deletion pytket/phir/sharding/sharder.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def should_op_create_shard(op: Op) -> bool:
"""
return (
op.type in SHARD_TRIGGER_OP_TYPES
or (isinstance(op, Conditional) and op.op.type in SHARD_TRIGGER_OP_TYPES)
or (isinstance(op, Conditional))
or (op.is_gate() and op.n_qubits > 1)
)

Expand Down
Loading

0 comments on commit d7730c7

Please sign in to comment.