Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
e242e55
Remove condition/c_if, duration, and unit from instructions
mtreinish Nov 29, 2024
0775d3f
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Jan 8, 2025
325fe27
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Jan 8, 2025
d4323fa
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Jan 9, 2025
49205b8
Update random_circuit
mtreinish Jan 9, 2025
7542251
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Jan 16, 2025
df717cd
Update more tests
mtreinish Jan 16, 2025
d6c1851
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Jan 23, 2025
4b886a5
Fix new scheduling pass implementation
mtreinish Jan 23, 2025
fdbef78
Fix clippy::redundant_closure
mtreinish Jan 23, 2025
b538242
Add release note for new args
mtreinish Jan 23, 2025
642eafd
Remove unused ExtraAttributes struct
mtreinish Jan 23, 2025
44c8774
Remove unused propagate_condition argument
mtreinish Jan 23, 2025
b632b75
Update legacy scheduling pass
mtreinish Jan 23, 2025
0bcb9f8
Remove AlignMeasures which was deprecated and can not work without pe…
mtreinish Jan 23, 2025
61da431
Fix lint
mtreinish Jan 23, 2025
9fcc2ed
Remove deleted pass from init modules
mtreinish Jan 23, 2025
c315075
Update qasm2 import to use IfElse instead of c_if
mtreinish Jan 23, 2025
c9ee6c1
Use if_test instead of c_if for backwards compat qpy tests
mtreinish Jan 23, 2025
5f87e8c
Update more tests
mtreinish Jan 24, 2025
d6329d7
More test updates
mtreinish Jan 24, 2025
99e2f7a
Fix handling of lack of dt
mtreinish Jan 24, 2025
775773d
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Jan 24, 2025
fdcd409
More test upgrades
mtreinish Jan 24, 2025
1076737
Update more tests
mtreinish Jan 25, 2025
7eb4d92
Fix DAGCircuit::compose() panic
mtreinish Jan 25, 2025
8113e1b
Fix more tests
mtreinish Jan 25, 2025
2bff580
Fix lint
mtreinish Jan 25, 2025
cc65dba
Fix clippy
mtreinish Jan 25, 2025
af163f9
Fix MARS pass tests
mtreinish Jan 25, 2025
a5bad51
Fix timeline drawer core
mtreinish Jan 25, 2025
3bb2beb
Update last c_if usage in tests
mtreinish Jan 25, 2025
2b87710
Adjust qpy tests to use c_if in old versions
mtreinish Jan 25, 2025
83207f2
Fix typo in qpy backwards compat test changes
mtreinish Jan 25, 2025
7b4fd30
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Jan 27, 2025
334c821
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Jan 28, 2025
6a91b9d
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Jan 28, 2025
2c17077
Fix register capture test
mtreinish Jan 28, 2025
c4ab136
Fix the worst test to debug in the world
mtreinish Jan 28, 2025
eb8fb6f
Update release notes
mtreinish Jan 28, 2025
5e84717
Fix qpy hard failures
mtreinish Jan 28, 2025
ade053d
Fix rust tests
mtreinish Jan 29, 2025
024415a
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Feb 6, 2025
c5fdecf
Fix rust tests
mtreinish Feb 6, 2025
8ddaf1c
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Feb 6, 2025
f39098e
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Feb 6, 2025
514f271
Fix scheduled circuit tests
mtreinish Feb 6, 2025
69111da
Fix lint
mtreinish Feb 6, 2025
2a2b72e
Remove visual tests that are no longer valid
mtreinish Feb 6, 2025
d4ab9a4
More test fixes
mtreinish Feb 6, 2025
b9b326f
Time unit conversion only applies to delay now
mtreinish Feb 7, 2025
e156da7
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Feb 7, 2025
4b9acca
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Feb 7, 2025
99707ab
Fix lint
mtreinish Feb 7, 2025
fe5b245
Update reference images with removed c_if
mtreinish Feb 7, 2025
07cd06a
Try to fix equality failure in qpy tests
mtreinish Feb 7, 2025
f4b2cb7
Fix small oversight in qpy tests
mtreinish Feb 7, 2025
133b8e0
More qpy test tweaks
mtreinish Feb 7, 2025
9090b5b
Add missing arg to qpy tests
mtreinish Feb 7, 2025
8a1305b
Remove c_if references in docs
mtreinish Feb 7, 2025
1514c16
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Feb 11, 2025
b1dde0b
Remove unused imports
mtreinish Feb 11, 2025
dadd8cf
Update docs
mtreinish Feb 11, 2025
49526ff
Add target to legacy dd pass docs
mtreinish Feb 13, 2025
c43eedd
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Feb 14, 2025
9bf0500
Restore propagate_condition arg for compatibility
mtreinish Feb 14, 2025
78a7ee4
More docs updates
mtreinish Feb 14, 2025
9ad7e9e
Add back test lift legacy condition
mtreinish Feb 14, 2025
1ae2e91
Remove unnecessary controlflow builder method
mtreinish Feb 14, 2025
e325526
Code simplification
mtreinish Feb 14, 2025
cd28d59
Add warning to qpy load about condition in payload becoming if_else
mtreinish Feb 14, 2025
3558f29
Remove unused import
mtreinish Feb 14, 2025
8987734
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Feb 14, 2025
b39d580
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Feb 18, 2025
d66d9c5
Apply suggestions from code review
mtreinish Feb 18, 2025
c8086ef
Handle delay duration in legacy scheduler
mtreinish Feb 18, 2025
d0087de
Document no control-flow basic simulator
mtreinish Feb 18, 2025
ead0e87
Apply suggestions from code review
mtreinish Feb 18, 2025
2592c2a
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Feb 18, 2025
0549e55
Merge remote-tracking branch 'origin/main' into drop-instruction-dead…
mtreinish Feb 19, 2025
3e47130
Fix errant commas
jakelishman Feb 21, 2025
aea1218
Remove dead condition check
jakelishman Feb 21, 2025
505d28b
Clarify reason for exception suppression
jakelishman Feb 21, 2025
33dafd5
Merge remote-tracking branch 'ibm/main' into drop-instruction-dead-we…
jakelishman Feb 21, 2025
13b6814
Simplify time-unit conversions
jakelishman Feb 21, 2025
95581c1
Restore overly eager test removal from test_circuit_operations
mtreinish Feb 23, 2025
720dbe8
Restore dag dep drawer test
mtreinish Feb 23, 2025
6f3861a
Restore text drawer tests
mtreinish Feb 23, 2025
b47f82c
Restore removed tests in test_circuit_drawer
mtreinish Feb 23, 2025
a0442de
Merge branch 'main' into drop-instruction-dead-weight
mtreinish Feb 23, 2025
bb50647
Control fold in restored test for variable terminal width in CI
mtreinish Feb 23, 2025
0047a81
Remove bugged tests in backend v1 primitives implementation
mtreinish Feb 24, 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
3 changes: 1 addition & 2 deletions crates/accelerate/src/barrier_before_final_measurement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use pyo3::prelude::*;
use rayon::prelude::*;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use qiskit_circuit::circuit_instruction::ExtraInstructionAttributes;
use qiskit_circuit::dag_circuit::{DAGCircuit, NodeType};
use qiskit_circuit::operations::{OperationRef, StandardInstruction};
use qiskit_circuit::packed_instruction::{PackedInstruction, PackedOperation};
Expand Down Expand Up @@ -150,7 +149,7 @@ pub fn barrier_before_final_measurements(
qargs.as_slice(),
&[],
None,
ExtraInstructionAttributes::new(label, None, None, None),
label,
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub(super) fn compose_transforms<'a>(
} else {
Some(gate_obj.params)
},
gate_obj.extra_attrs,
gate_obj.label.map(|x| *x),
#[cfg(feature = "cache_pygates")]
Some(gate.into()),
)?;
Expand Down Expand Up @@ -121,7 +121,7 @@ pub(super) fn compose_transforms<'a>(
op_node.bind(py),
&replace_dag,
None,
true,
None,
)?;
}
}
Expand Down
27 changes: 6 additions & 21 deletions crates/accelerate/src/basis/basis_translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ fn apply_translation(
} else {
Some(new_op.params)
},
new_op.extra_attrs,
new_op.label.map(|x| *x),
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand All @@ -543,7 +543,7 @@ fn apply_translation(
.collect(),
)
},
node_obj.extra_attrs.clone(),
node_obj.label.as_ref().map(|x| x.as_ref().clone()),
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand Down Expand Up @@ -571,7 +571,7 @@ fn apply_translation(
.collect(),
)
},
node_obj.extra_attrs.clone(),
node_obj.label.as_ref().map(|x| x.as_ref().clone()),
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand All @@ -595,7 +595,7 @@ fn apply_translation(
.collect(),
)
},
node_obj.extra_attrs.clone(),
node_obj.label.as_ref().map(|x| x.as_ref().clone()),
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand Down Expand Up @@ -667,27 +667,12 @@ fn replace_node(
} else {
inner_node.op.clone()
};
if node.condition().is_some() {
match new_op.view() {
OperationRef::Gate(gate) => {
gate.gate.setattr(py, "condition", node.condition())?
}
OperationRef::Instruction(inst) => {
inst.instruction
.setattr(py, "condition", node.condition())?
}
OperationRef::Operation(oper) => {
oper.operation.setattr(py, "condition", node.condition())?
}
_ => (),
}
}
let new_params: SmallVec<[Param; 3]> = inner_node
.params_view()
.iter()
.map(|param| param.clone_ref(py))
.collect();
let new_extra_props = node.extra_attrs.clone();
let new_extra_props = node.label.as_ref().map(|x| x.as_ref().clone());
dag.apply_operation_back(
py,
new_op,
Expand Down Expand Up @@ -802,7 +787,7 @@ fn replace_node(
} else {
Some(new_params)
},
inner_node.extra_attrs.clone(),
inner_node.label.as_ref().map(|x| x.as_ref().clone()),
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand Down
2 changes: 0 additions & 2 deletions crates/accelerate/src/commutation_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ pub(crate) fn analyze_commutations_inner(
py,
&op1,
params1,
&packed_inst0.extra_attrs,
qargs1,
cargs1,
&op2,
params2,
&packed_inst1.extra_attrs,
qargs2,
cargs2,
MAX_NUM_QUBITS,
Expand Down
18 changes: 2 additions & 16 deletions crates/accelerate/src/commutation_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use pyo3::types::{PyBool, PyDict, PySequence, PyTuple};
use pyo3::BoundObject;

use qiskit_circuit::bit_data::BitData;
use qiskit_circuit::circuit_instruction::{ExtraInstructionAttributes, OperationFromPython};
use qiskit_circuit::circuit_instruction::OperationFromPython;
use qiskit_circuit::dag_node::DAGOpNode;
use qiskit_circuit::imports::QI_OPERATOR;
use qiskit_circuit::operations::OperationRef::{Gate as PyGateType, Operation as PyOperationType};
Expand Down Expand Up @@ -178,12 +178,10 @@ impl CommutationChecker {
py,
&op1.instruction.operation.view(),
&op1.instruction.params,
&op1.instruction.extra_attrs,
&qargs1,
&cargs1,
&op2.instruction.operation.view(),
&op2.instruction.params,
&op2.instruction.extra_attrs,
&qargs2,
&cargs2,
max_num_qubits,
Expand Down Expand Up @@ -215,12 +213,10 @@ impl CommutationChecker {
py,
&op1.operation.view(),
&op1.params,
&op1.extra_attrs,
&qargs1,
&cargs1,
&op2.operation.view(),
&op2.params,
&op2.extra_attrs,
&qargs2,
&cargs2,
max_num_qubits,
Expand Down Expand Up @@ -285,12 +281,10 @@ impl CommutationChecker {
py: Python,
op1: &OperationRef,
params1: &[Param],
attrs1: &ExtraInstructionAttributes,
qargs1: &[Qubit],
cargs1: &[Clbit],
op2: &OperationRef,
params2: &[Param],
attrs2: &ExtraInstructionAttributes,
qargs2: &[Qubit],
cargs2: &[Clbit],
max_num_qubits: u32,
Expand Down Expand Up @@ -321,12 +315,10 @@ impl CommutationChecker {
let commutation: Option<bool> = commutation_precheck(
op1,
params1,
attrs1,
qargs1,
cargs1,
op2,
params2,
attrs2,
qargs2,
cargs2,
max_num_qubits,
Expand Down Expand Up @@ -576,21 +568,15 @@ impl CommutationChecker {
fn commutation_precheck(
op1: &OperationRef,
params1: &[Param],
attrs1: &ExtraInstructionAttributes,
qargs1: &[Qubit],
cargs1: &[Clbit],
op2: &OperationRef,
params2: &[Param],
attrs2: &ExtraInstructionAttributes,
qargs2: &[Qubit],
cargs2: &[Clbit],
max_num_qubits: u32,
) -> Option<bool> {
if op1.control_flow()
|| op2.control_flow()
|| attrs1.condition().is_some()
|| attrs2.condition().is_some()
{
if op1.control_flow() || op2.control_flow() {
return Some(false);
}

Expand Down
11 changes: 5 additions & 6 deletions crates/accelerate/src/consolidate_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use rustworkx_core::petgraph::stable_graph::NodeIndex;
use smallvec::smallvec;

use qiskit_circuit::circuit_data::CircuitData;
use qiskit_circuit::circuit_instruction::ExtraInstructionAttributes;
use qiskit_circuit::dag_circuit::DAGCircuit;
use qiskit_circuit::gate_matrix::{ONE_QUBIT_IDENTITY, TWO_QUBIT_IDENTITY};
use qiskit_circuit::imports::{QI_OPERATOR, QUANTUM_CIRCUIT};
Expand Down Expand Up @@ -125,7 +124,7 @@ pub(crate) fn consolidate_blocks(
inst_node,
PackedOperation::from_unitary(Box::new(unitary_gate)),
smallvec![],
ExtraInstructionAttributes::default(),
None,
)?;
continue;
}
Expand Down Expand Up @@ -199,7 +198,7 @@ pub(crate) fn consolidate_blocks(
&block,
PackedOperation::from_unitary(Box::new(unitary_gate)),
smallvec![],
ExtraInstructionAttributes::default(),
None,
false,
&block_index_map,
&clbit_pos_map,
Expand Down Expand Up @@ -238,7 +237,7 @@ pub(crate) fn consolidate_blocks(
&block,
PackedOperation::from_unitary(Box::new(unitary_gate)),
smallvec![],
ExtraInstructionAttributes::default(),
None,
false,
&qubit_pos_map,
&clbit_pos_map,
Expand Down Expand Up @@ -276,7 +275,7 @@ pub(crate) fn consolidate_blocks(
first_inst_node,
PackedOperation::from_unitary(Box::new(unitary_gate)),
smallvec![],
ExtraInstructionAttributes::default(),
None,
)?;
continue;
}
Expand Down Expand Up @@ -320,7 +319,7 @@ pub(crate) fn consolidate_blocks(
&run,
PackedOperation::from_unitary(Box::new(unitary_gate)),
smallvec![],
ExtraInstructionAttributes::default(),
None,
false,
&block_index_map,
&clbit_pos_map,
Expand Down
8 changes: 4 additions & 4 deletions crates/accelerate/src/elide_permutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ fn run(py: Python, dag: &mut DAGCircuit) -> PyResult<Option<(DAGCircuit, Vec<usi
let mut new_dag = dag.copy_empty_like(py, "alike")?;
for node_index in dag.topological_op_nodes()? {
if let NodeType::Operation(inst) = &dag[node_index] {
match (inst.op.name(), inst.condition()) {
("swap", None) => {
match inst.op.name() {
"swap" => {
let qargs = dag.get_qargs(inst.qubits);
let index0 = qargs[0].index();
let index1 = qargs[1].index();
mapping.swap(index0, index1);
}
("permutation", None) => {
"permutation" => {
if let Param::Obj(ref pyobj) = inst.params.as_ref().unwrap()[0] {
let pyarray: PyReadonlyArray1<i32> = pyobj.extract(py)?;
let pattern = pyarray.as_array();
Expand Down Expand Up @@ -88,7 +88,7 @@ fn run(py: Python, dag: &mut DAGCircuit) -> PyResult<Option<(DAGCircuit, Vec<usi
&mapped_qargs,
cargs,
inst.params.as_deref().cloned(),
inst.extra_attrs.clone(),
inst.label.as_ref().map(|x| x.as_ref().clone()),
#[cfg(feature = "cache_pygates")]
inst.py_op.get().map(|x| x.clone_ref(py)),
)?;
Expand Down
9 changes: 4 additions & 5 deletions crates/accelerate/src/gate_direction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use qiskit_circuit::operations::OperationRef;
use qiskit_circuit::packed_instruction::PackedOperation;
use qiskit_circuit::{
circuit_instruction::CircuitInstruction,
circuit_instruction::ExtraInstructionAttributes,
converters::{circuit_to_dag, QuantumCircuitData},
dag_circuit::DAGCircuit,
dag_node::{DAGNode, DAGOpNode},
Expand Down Expand Up @@ -360,7 +359,7 @@ where
.bind(py)
.call_method1("replace_blocks", (op_blocks,))?;

dag.py_substitute_node(dag.get_node(py, node)?.bind(py), &new_op, false, false)?;
dag.py_substitute_node(py, dag.get_node(py, node)?.bind(py), &new_op, false, None)?;
}

for (node, replacemanet_dag) in nodes_to_replace {
Expand All @@ -369,7 +368,7 @@ where
dag.get_node(py, node)?.bind(py),
&replacemanet_dag,
None,
true,
None,
)?;
}

Expand All @@ -394,7 +393,7 @@ fn has_calibration_for_op_node(
qubits: py_args.unbind(),
clbits: PyTuple::empty(py).unbind(),
params: packed_inst.params_view().iter().cloned().collect(),
extra_attrs: packed_inst.extra_attrs.clone(),
label: packed_inst.label.clone(),
#[cfg(feature = "cache_pygates")]
py_op: packed_inst.py_op.clone(),
},
Expand Down Expand Up @@ -467,7 +466,7 @@ fn apply_operation_back(
qargs,
&[],
param,
ExtraInstructionAttributes::default(),
None,
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand Down
7 changes: 3 additions & 4 deletions crates/accelerate/src/split_2q_unitaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use pyo3::prelude::*;
use rustworkx_core::petgraph::stable_graph::NodeIndex;
use smallvec::{smallvec, SmallVec};

use qiskit_circuit::circuit_instruction::ExtraInstructionAttributes;
use qiskit_circuit::dag_circuit::{DAGCircuit, NodeType, Wire};
use qiskit_circuit::operations::{ArrayType, Operation, OperationRef, Param, UnitaryGate};
use qiskit_circuit::packed_instruction::PackedOperation;
Expand Down Expand Up @@ -148,7 +147,7 @@ pub fn split_2q_unitaries(
&[Qubit::new(mapping[index0])],
&[],
None,
ExtraInstructionAttributes::default(),
None,
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand All @@ -158,7 +157,7 @@ pub fn split_2q_unitaries(
&[Qubit::new(mapping[index1])],
&[],
None,
ExtraInstructionAttributes::default(),
None,
#[cfg(feature = "cache_pygates")]
None,
)?;
Expand All @@ -180,7 +179,7 @@ pub fn split_2q_unitaries(
&mapped_qargs,
cargs,
inst.params.as_deref().cloned(),
inst.extra_attrs.clone(),
inst.label.as_ref().map(|x| x.to_string()),
#[cfg(feature = "cache_pygates")]
inst.py_op.get().map(|x| x.clone_ref(py)),
)?;
Expand Down
10 changes: 4 additions & 6 deletions crates/accelerate/src/target_transpiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use pyo3::{
IntoPyObjectExt,
};

use qiskit_circuit::circuit_instruction::{ExtraInstructionAttributes, OperationFromPython};
use qiskit_circuit::circuit_instruction::OperationFromPython;
use qiskit_circuit::operations::{Operation, OperationRef, Param};
use qiskit_circuit::packed_instruction::PackedOperation;
use smallvec::SmallVec;
Expand Down Expand Up @@ -775,17 +775,15 @@ impl Target {
let out_inst = match inst {
TargetOperation::Normal(op) => match op.operation.view() {
OperationRef::StandardGate(standard) => standard
.create_py_op(py, Some(&op.params), &ExtraInstructionAttributes::default())?
.create_py_op(py, Some(&op.params), None)?
.into_any(),
OperationRef::StandardInstruction(standard) => standard
.create_py_op(py, Some(&op.params), &ExtraInstructionAttributes::default())?
.create_py_op(py, Some(&op.params), None)?
.into_any(),
OperationRef::Gate(gate) => gate.gate.clone_ref(py),
OperationRef::Instruction(instruction) => instruction.instruction.clone_ref(py),
OperationRef::Operation(operation) => operation.operation.clone_ref(py),
OperationRef::Unitary(unitary) => unitary
.create_py_op(py, &ExtraInstructionAttributes::default())?
.into_any(),
OperationRef::Unitary(unitary) => unitary.create_py_op(py, None)?.into_any(),
},
TargetOperation::Variadic(op_cls) => op_cls.clone_ref(py),
};
Expand Down
Loading