Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instruction duration is parameter agnostic #7315

Closed
eggerdj opened this issue Nov 26, 2021 · 0 comments · Fixed by #7321
Closed

Instruction duration is parameter agnostic #7315

eggerdj opened this issue Nov 26, 2021 · 0 comments · Fixed by #7321
Labels
type: enhancement It's working, but needs polishing

Comments

@eggerdj
Copy link
Contributor

eggerdj commented Nov 26, 2021

What is the expected enhancement?

Summary

The class InstructionDurations in qiskit.transpiler.instruction_durations.py is agnostic to parameter values. This poses problems for gates that have a parameter-dependent duration.

Details

Instruction durations are created using e.g. the following code:

durations = InstructionDurations(
    [("h", 0, 50), ("cx", [0, 1], 700), ("reset", None, 10),
     ("cx", [1, 2], 200), ("cx", [2, 3], 300),
     ("x", None, 50), ("measure", None, 1000)]
)

Here, for each tuple, the first argument is the name of the instruction, the second argument is the qubits it applies to, and the third argument is the duration. The problem with this structure is that it does not have the parameters of the instructions. This is fine for basis gates like ["x", "h", "cx"] and even rz(theta) since it does not have a duration. However, this is not sufficient for cases such as rzx(theta) in which the same instruction on the same pair of qubits can have a different duration depending on the parameter theta.

Proposed solution

We can add an additional entry to the tuples in InstructionDurations that corresponds to the parameters of the instruction. E.g. (inst_name, qubits, params, duration). This will also better reflect the information of the QuantumCircuit.calibrations variable which contains the schedule for a given instruction, qubits, and parameter values of the instruction.

@eggerdj eggerdj added the type: enhancement It's working, but needs polishing label Nov 26, 2021
@mergify mergify bot closed this as completed in #7321 Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement It's working, but needs polishing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant