-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Tune LitinskiTransformation pass #15315
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
base: main
Are you sure you want to change the base?
Conversation
This commit optimizes the implementation of the LitinskiTransformation pass. The improvements fall into a couple of categories, but most of the runtime performance improvements will come from removing unecessary allocations. From a quick glance the Clifford struct looks like it could also use a similar once over, mostly to get it to leverage Qiskit's types more effectively if nothing else. But I kept the changes there minimal for this commit and only modified the method used by The LitinskiTransformation directly.
|
One or more of the following people are relevant to this code:
|
|
To benchmark this I used the benchmark @alexanderivrii described in the PR summary on #14753 with this script: import statistics
import time
from qiskit.converters import circuit_to_dag
from qiskit.circuit.library import QFTGate
from qiskit.transpiler.passes import LitinskiTransformation
from qiskit.transpiler import Target
from qiskit import transpile, QuantumCircuit
litinski = LitinskiTransformation()
i = 2
while i <= 1024:
qft = QuantumCircuit(i)
qft.append(QFTGate(i), qft.qubits)
target = Target.from_configuration(["cx", "sx", "rz"], i)
tqft = transpile(qft, target=target)
dag = circuit_to_dag(tqft, False)
times = []
for _ in range(10):
start = time.perf_counter()
litinski.run(dag)
stop = time.perf_counter()
times.append(stop - start)
print(f"nqubits: {i}, runtime: {statistics.geometric_mean(times)}")
i = i * 2 |
Pull Request Test Coverage Report for Build 19208500951Details
💛 - Coveralls |
|
Thanks @mtreinish! I have just now run your script for the most problematic case of In any case, for the interest of helping @Cryoris to prepare for QDC, I would suggest merging #15217 first, and then merging your PR. |
Besides adapting to the rebase this also improves the SparseObservable construction.

Summary
This commit optimizes the implementation of the LitinskiTransformation pass. The improvements fall into a couple of categories, but most of the runtime performance improvements will come from removing unnecessary allocations.
From a quick glance the Clifford struct looks like it could also use a similar once over, mostly to get it to leverage Qiskit's types more effectively if nothing else. But I kept the changes there minimal for this commit and only modified the method used by The LitinskiTransformation directly.
Details and comments