qiboteam / qibolab

Quantum hardware module and drivers for Qibo.
https://qibo.science
Apache License 2.0
40 stars 10 forks source link

Pulse deduplication #716

Open alecandido opened 7 months ago

alecandido commented 7 months ago

This is already spanned by all (or most of) the drivers, but it is implemented in an inconsistent way.

(the only one about which I know nothing is QICK)

This became especially relevant after #618

Proposal

This feature could be implemented consistently across all drivers, and it will be pretty simple after the rework in #683

The idea is to apply a strategy similar to Qblox one, consisting in a comparison:

If there is no other sensible equality for Pulse (something distinguishing Pulse with the same waveform) this will be their equality. Otherwise we could make a wrapper, just to define the equality, or store the waveform parameters in the .waveform attribute, and compare those.

Once we have objects that will compare equal if and only if the waveform is the same, we can just use the built-in mechanics of set(), and let Python deduplicate them.

This can be used simply in a series of contexts:

It's just a matter of comparing the suitable pulses once they are generated.

alecandido commented 7 months ago

At least for Qblox, it might be slightly more complex than that.

Currently, the sequencers assigned to a port are playing a connected piece of a sequence. That's an extra constraint, and the motivation for the current pulse-assignment algorithm (try if it fits the memory of the current sequencer, otherwise try with the next one).

Deduplicating the whole sequence is not generally possible, because if pulses with the same waveform will land on different sequencers, they will have to uploaded multiple times. However, if interleaved sequencers are possible ([seq1] + [seq2] + [seq1]) then we could deduplicate globally. Otherwise we could just apply the Qblox algorithm in general (or make it optional/enable for the case of multiple sequencers).

Do QM and Zurich have similar issues? @stavros11 @Jacfomg

Jacfomg commented 7 months ago

I don't think Zurich works like that.