Open mtreinish opened 8 months ago
I think this might be superseded by the suggestions in #11659. If we build out a new transpiler pass to do efficient 2q peephole unitary resynthesis we should do what this is proposing. The only case where I think this wouldn't be the case is if we ran UnitarySynthesis
for basis translation or unrolling >=3q unitaries. So I'll keep this open just in case we want the parallel interface even though the primary utility I envisioned was for peephole optimization.
Once we have #12004 (and also for #12005 too) implemented we can better leverage available CPU resources better by running synthesis in parallel using a rayon iterator. There is no data dependency between doing unitary synthesis for different unitary matrices, it should be fairly straightforward to have a function that takes in a list of unitary matrices with their target qubits and also dict/hashmap of target qubits to the appropriate decomposer class and then have the function return a list of circuit sequences which is computed using a multithreaded rayon iterator. This can be connected #12006 to have the default synthesis plugin prepare a batch of all the 2 qubit unitary matrices to exploit this function.