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

HDAWG: Iteration dispatch to linspace, step and unroll #863

Open
terrorfisch opened this issue Jun 21, 2024 · 2 comments
Open

HDAWG: Iteration dispatch to linspace, step and unroll #863

terrorfisch opened this issue Jun 21, 2024 · 2 comments
Assignees

Comments

@terrorfisch
Copy link
Member

Currently, the linspace builder just supports iterations that linearly change output voltages (and in principle times) with the loop index of an iteration.

The HDAWG however has three ways to represent iteration that a real world program might mix:

  1. Linspace changes of pulse playback amplitude or hold duration
  2. Indexed stepping through command table entries
  3. Complete unroll

Especially 1 and 2 can coexist in the same iteration, f.i. we can change the constant output of channel one and modify the waveform shape of channel two.

The intended idea behind the program builder interface is that the program builder can inspect upon the first iteration if the body is linspace representable, stepping representable, or must be unrolled.

The bad thing is that the original idea to implement this via exceptions upon invalid expression evaluations is not possible because the program builder cannot catch those.

For linspace vs. stepping we need to distinguish between any scaled playback and a deferred build_waveform evaluation that allows unrolling the waveform building for this particular operation only.

A complete unroll is necessary if the number of operations changes over the iterations. This will occur if a waveform evaluates to zero in only a subset of iterations or an inner loop(iteration or repetition) depends on the index.

We need a way to insert proper branching at waveform build time, i.e. we need a way to interact with the waveform building process. Any simplification of the waveform building currently happens due to dispatch in the pulse template. F.i. the ConstantPT calls hold_voltage instead of play_waveform.

The following could help but increases complexity

class WayveformBuilder:
    def build_waveform(self, parameter, channel_mapping):
        pass

class ProgramBuilder:
    def play_arbitrary_waveform(self, waveform_builder, parameter, channel_mapping):
        # implementation in HDAWG
        try:
            hw_waveform = waveform_builder.build_waveform(parameters, channel_mapping)
        except HWExpressionError:
            stepped_waveform = []
            for multi_idx, inner_scope in self.iter_scopes(parameters):
                stepped_waveform[multi_idx] = waveform_builder.build_waveform(inner_scope, channel_mapping)
```
@terrorfisch
Copy link
Member Author

terrorfisch commented Jun 21, 2024

Maybe this is better classified as a milestone No text in milestone

@hbluhm
Copy link

hbluhm commented Jun 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants