Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ def _empty_dag_like(

new_dag.name = dag.name
new_dag.metadata = dag.metadata
new_dag.unit = self.property_set["time_unit"] or "dt"
if new_dag.unit != "dt":
raise TranspilerError(
'All blocks must have time units of "dt". '
"Please run TimeUnitConversion pass prior to padding."
)

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there an alternative? Or do we just remove the unit property

Copy link
Collaborator

Choose a reason for hiding this comment

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

There are a couple of alternatives, I think that the key here is making sure that the pass functionality isn't affected by our change... to an extend I guess unit tests should cover this but we should probably reach out to the original authors too to double check.

new_dag.global_phase = dag.global_phase
return new_dag
Expand Down Expand Up @@ -370,7 +364,6 @@ def _visit_block(
prev_block_duration = self._block_duration
prev_block_idx = self._current_block_idx
self._terminate_block(self._block_duration, self._current_block_idx)
new_block_dag.duration = prev_block_duration

# Edge-case: Add a barrier if the final node is a fast-path
if self._prev_node in self._fast_path_nodes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,7 @@ def _pad(

if self._qubits and self._block_dag.qubits.index(qubit) not in self._qubits:
# Target physical qubit is not the target of this DD sequence.
self._apply_scheduled_op(
block_idx, t_start, Delay(time_interval, self._block_dag.unit), qubit
)
self._apply_scheduled_op(block_idx, t_start, Delay(time_interval), qubit)
return

if not self._skip_reset_qubits and qubit not in self._dirty_qubits:
Expand All @@ -424,9 +422,7 @@ def _pad(
if qubit not in self._dirty_qubits or (self._dd_barrier and not enable_dd):
# Previous node is the start edge or reset, i.e. qubit is ground state;
# or dd to be applied before named barrier only
self._apply_scheduled_op(
block_idx, t_start, Delay(time_interval, self._block_dag.unit), qubit
)
self._apply_scheduled_op(block_idx, t_start, Delay(time_interval), qubit)
return

for sequence_idx, _ in enumerate(self._dd_sequences):
Expand Down Expand Up @@ -488,7 +484,8 @@ def _pad(
theta_l, phi_l, lam_l = op.params
op.params = Optimize1qGates.compose_u3(theta, phi, lam, theta_l, phi_l, lam_l)
new_prev_node = self._block_dag.substitute_node(
prev_node, op, propagate_condition=False
prev_node,
op,
)
start_time = self.property_set["node_start_time"].pop(prev_node)
if start_time is not None:
Expand All @@ -499,7 +496,7 @@ def _pad(
self._apply_scheduled_op(
block_idx,
t_start,
Delay(time_interval, self._block_dag.unit),
Delay(time_interval),
qubit,
)
return
Expand Down Expand Up @@ -543,9 +540,7 @@ def _constrained_length(values: np.array) -> np.array:
# Interleave delays with DD sequence operations
for tau_idx, tau in enumerate(taus):
if tau > 0:
self._apply_scheduled_op(
block_idx, idle_after, Delay(tau, self._dag.unit), qubit
)
self._apply_scheduled_op(block_idx, idle_after, Delay(tau), qubit)
idle_after += tau

# Detect if we are on a sequence boundary
Expand All @@ -566,7 +561,5 @@ def _constrained_length(values: np.array) -> np.array:
return

# DD could not be applied, delay instead
self._apply_scheduled_op(
block_idx, t_start, Delay(time_interval, self._block_dag.unit), qubit
)
self._apply_scheduled_op(block_idx, t_start, Delay(time_interval), qubit)
return
Loading