-
Notifications
You must be signed in to change notification settings - Fork 126
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
Fast transpile with MixIn #1455
Conversation
... | ||
|
||
|
||
class SimpleCircuitExtenderMixin: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we want to make this a feature of BaseExperiment
rather than a mixin. I am not sure what the variable should be called but experiments could set something like layout_and_translate_only = True
and if BaseExperiment._transpiled_circuits
could just do the code here in that case.
): | ||
# In Qiskit provider model barrier is not included in target. | ||
# Use standard circuit transpile when circuit is not ISA. | ||
return transpile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you at least want to set optimization_level
? Better than that, could we create a pass manager with just BasisTranslator
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we quickly check for custom pulse gates as well? I think that is the one other pass that users sometimes want for QE (though in the future that will probably go away).
p_qregs = QuantumRegister(n_qubits) | ||
v_p_map = {q: p_qregs[self.physical_qubits[i]] for i, q in enumerate(v_circ.qubits)} | ||
p_circ = QuantumCircuit(p_qregs, *v_circ.cregs) | ||
p_circ.metadata = v_circ.metadata | ||
for inst, v_qubits, clbits in v_circ.data: | ||
p_qubits = list(map(v_p_map.get, v_qubits)) | ||
p_circ._append(inst, p_qubits, clbits) | ||
return p_circ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the equivalent of this make sense in Qiskit as a SimpleLayout
pass? I have not understood why the simplest layout in Qiskit has to be four stages and involve ancilla expansion like it does.
close this in favor of #1459 |
Summary
Call to Qiskit transpiler is overkill for simple experiment that directly creates ISA circuits, like T1 and T2 experiment. This PR adds a mixin class that automatically implements
_transpiled_circuits()
method that only maps virtual qubit index to physical qubit index without invoking the computationally heavy transpiler.Details and comments