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

Reproduce 0.1 snapshot #1159

Closed
wants to merge 20 commits into from
Closed

Reproduce 0.1 snapshot #1159

wants to merge 20 commits into from

Conversation

alecandido
Copy link
Member

@alecandido alecandido commented Feb 25, 2025

With the last modifications in #1088, I'm pretty sure that the sequence uploaded is fully equivalent to the 0.1 (exact same waveforms' samples, the only differences in instructions are loops of length 1, or set_ph 0 right after a reset_ph).

So, I'm now attempting to reproduce the exact same cluster snapshot (obtainable with cluster.print_readable_snapshot(), to avoid parsing manually all the Qcodes structures).

Here are the current snapshots being compared, before this PR.
0.1-snapshot.txt
0.2-snapshot.txt

The plan is to include all the differences, to make the 0.2 snapshot identical. The patches will be applied:

  • directly in Qblox #1088, for those acknowledged to be required (i.e. whose role is explicitly understood) - and I will keep rebasing this branch
  • or in here, if it is not clear how/why the change is affecting

Known differences

Cluster level

  • reference_source, reference clock

Module level

  • outX_offset, to replace what is currently Sequencer.offset_awg_path0
    • I know the second can be affected in real time, but I'm not sure how the value set via Qcodes acts differently from the module level one
  • apply default values for _path, _offset, and scope_

Unused modules

They are not being configured in any way currently.

Sequencer level

  • connect_outX, sometimes unset instead of I/Q/IQ/off
  • marker_ovr_en, sometimes None instead of True
  • marker_ovr_value, sometimes 0 instead of 15
  • mod_en_awg, sometimes False instead of True
  • nco_freq, sometimes None instead of 0
  • sync_en, sometimes None instead of True
  • thresholded_acq_threshold for the used qrm_rf sequencer disagrees (0.0060097 instead of 2.8846)
  • thresholded_acq_rotation and thresholded_acq_threshold set for unused module (270.14 (Degrees) and -7.3504e-05)

Unused sequencers

They are not being configured in any way currently.

  • default for all sequencers (cont_mode_..., mixer_..., ...) not applied

Updated snapshot

0.2-updated.txt

Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 0% with 86 lines in your changes missing coverage. Please review.

Project coverage is 45.43%. Comparing base (0864f9a) to head (db8b79d).
Report is 1 commits behind head on qblox.

Files with missing lines Patch % Lines
src/qibolab/_core/instruments/qblox/config.py 0.00% 77 Missing ⚠️
src/qibolab/_core/instruments/qblox/cluster.py 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            qblox    #1159      +/-   ##
==========================================
- Coverage   46.21%   45.43%   -0.78%     
==========================================
  Files          96       96              
  Lines        4490     4567      +77     
==========================================
  Hits         2075     2075              
- Misses       2415     2492      +77     
Flag Coverage Δ
unittests 45.43% <0.00%> (-0.78%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alecandido
Copy link
Member Author

Until 16aeec2, no difference with #1088

@alecandido alecandido force-pushed the qblox-repro branch 3 times, most recently from ebd8602 to 0102e71 Compare February 26, 2025 17:09
@alecandido
Copy link
Member Author

alecandido commented Feb 26, 2025

@stavros11 I obtained virtually identical snapshots

Residual differences

The remaining differences are due to two crossed sequencers, since I'm using them incrementally (0, 1, 2, ...), while the 0.1 driver was using a default port assignment. However, these crossed sequencers are only seen for flux channels, which are not even involved in single shot.
The port assignment is also supposed to be crossed consistently, by the following invocation:

seq.connect_sequencer(address.local_address)

The other differences are the mod 12 seq 1, which is missing some default properties in 0.1. However, this sequencer is supposed to be inactive, and I did not bother implementing the logic "set these configs on all default QCM-RF sequencers (i.e. seq < 2) but not on those on module where there are other default sequencers, if the current one is inactive".

The remaining present: False may be dropped, but they are not set explicitly by the 0.2 driver, but just indirectly by checking the module presence in the default round of settings. However, the difference is a None for a False in the snapshot for absent modules, which I'm pretty sure should not affect anything at all.

image image image

The image is obtained by:

  • printing a cluster.print_readable_snapshot() just before beginning the execution
  • manually replacing the name of the cluster in 0.2 (to make it equal to the 0.1 one, and reducing the subsequent diff)
  • using difft, to obtain a more readable result

However, the reports are still significantly different.

Reports

You can notice some resemblance in the two pictures, and it seems clear that in the 0.2 one the ground state is being measured twice.

0.1 0.2
image image

So, following the diff and the reports, it seems that there is no discrepancy in the configurations, and the acquisition is also good enough.

At this point, it seems that the drive is not being properly sent, and it's likely to be on the sequence side, rather than a configuration problem.

@alecandido
Copy link
Member Author

alecandido commented Feb 26, 2025

And here are the comparisons for the drivers' sequences

Programs

0.1 0.2
  # setup

  move 0, R1                 # navgs loop
  nop
  loop_R1:

      move 0, R0             # nshots loop
      nop
      loop_R0:

          wait_sync 4
          reset_ph

          set_ph 0           # set 
                  # relative phase 0 rads
          play  0,1,40       # play 
                  # waveforms DrivePulse(0, 40, 
                  # 0.355315, 4_103_156_133,
                  # 0, Gaussian(5), L4-15, 0)

          # wait 200700 ns
          move 3, R3
          wait_loop_R3:
              wait 65532
              loop R3, @wait_loop_R3
          wait 4104

      add R0, 1, R0
      nop
      jlt R0, 5000, @loop_R0 # nshots loop

  add R1, 1, R1
  nop
  jlt R1, 1, @loop_R1        # navgs loop

  # cleanup
  stop

*partially doctored, removing some whitespaces and wrapping some comments (just for the sake of readability side-by-side)

       move      0,R0      # init bin counter
       move      0,R1      # init bin reset
       move      5000,R2   # init shots counter
       wait_sync 4
start: wait      4
       play      0,1,40
       wait      3395      # relaxation
       move      3,R3
wait3: wait      65535
       loop      R3,@wait3
       reset_ph            # phase reset
       add       R0,1,R0   # bin increment
       loop      R2,@start # loop over shots
       stop

Sequencer snapshots

0.1 0.2
qblox_controller_module12_sequencer0:
        parameter                       value
------------------------------------------------------------
connect_out0                     :      IQ
connect_out1                     :      off
cont_mode_en_awg_path0           :      False
cont_mode_en_awg_path1           :      False
cont_mode_waveform_idx_awg_path0 :      0
cont_mode_waveform_idx_awg_path1 :      0
gain_awg_path0                   :      None
gain_awg_path1                   :      None
marker_ovr_en                    :      True
marker_ovr_value                 :      15
mixer_corr_gain_ratio            :      1
mixer_corr_phase_offset_degree   :      0
mod_en_awg                       :      True
nco_freq                         :      -202252867 (Hz)
nco_phase_offs                   :      0 (Degrees)
nco_prop_delay_comp              :      None (ns)
nco_prop_delay_comp_en           :      None (ns)
offset_awg_path0                 :      0
offset_awg_path1                 :      0
sync_en                          :      True
trigger10_count_threshold        :      None
trigger10_threshold_invert       :      None
trigger11_count_threshold        :      None
trigger11_threshold_invert       :      None
trigger12_count_threshold        :      None
trigger12_threshold_invert       :      None
trigger13_count_threshold        :      None
trigger13_threshold_invert       :      None
trigger14_count_threshold        :      None
trigger14_threshold_invert       :      None
trigger15_count_threshold        :      None
trigger15_threshold_invert       :      None
trigger1_count_threshold         :      None
trigger1_threshold_invert        :      None
trigger2_count_threshold         :      None
trigger2_threshold_invert        :      None
trigger3_count_threshold         :      None
trigger3_threshold_invert        :      None
trigger4_count_threshold         :      None
trigger4_threshold_invert        :      None
trigger5_count_threshold         :      None
trigger5_threshold_invert        :      None
trigger6_count_threshold         :      None
trigger6_threshold_invert        :      None
trigger7_count_threshold         :      None
trigger7_threshold_invert        :      None
trigger8_count_threshold         :      None
trigger8_threshold_invert        :      None
trigger9_count_threshold         :      None
trigger9_threshold_invert        :      None
upsample_rate_awg_path0          :      0
upsample_rate_awg_path1          :      0
iqm5q_qblox_module12_sequencer0:
  value
-----------------------------
  IQ
  off
  False
  False
  0
  0
  None
  None
  True
  15
  1
  0
  True
  -202252867 (Hz)
  0 (Degrees)
  None (ns)
  None (ns)
  0
  0
  True
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  0
  0

Waveforms

0.1

{
    'Envelope_Waveform_I(num_samples = 40, amplitude = 0.355315, shape = Gaussian(5))': {
        'data': [
            0.018216030410612587,
            0.024512348186780185,
            0.032473585278501534,
            0.04235353963840072,
            0.054383021382398256,
            0.06874658057406086,
            0.08555650186458075,
            0.10482601734711296,
            0.12644431305041612,
            0.15015633703066492,
            0.17555054343179538,
            0.20205743692669842,
            0.22896107208413613,
            0.255424533524822,
            0.28052896964037005,
            0.3033241386392847,
            0.3228868648375512,
            0.3383825290191143,
            0.34912394352834497,
            0.3546218456516639,
            0.3546218456516639,
            0.34912394352834497,
            0.3383825290191143,
            0.3228868648375512,
            0.3033241386392847,
            0.28052896964037005,
            0.255424533524822,
            0.22896107208413613,
            0.20205743692669842,
            0.17555054343179538,
            0.15015633703066492,
            0.12644431305041612,
            0.10482601734711296,
            0.08555650186458075,
            0.06874658057406086,
            0.054383021382398256,
            0.04235353963840072,
            0.032473585278501534,
            0.024512348186780185,
            0.018216030410612587
        ],
        'index': 0
    },
    'Envelope_Waveform_Q(num_samples = 40, amplitude = 0.355315, shape = Gaussian(5))': {
        'data': [
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0
        ],
        'index': 1
    }
}

0.2

Q1Sequence(
    waveforms={
        (UUID('faed3019-184e-4fe6-bde9-63de77e2d92f'), 0): Waveform(
            data=array([0.01821603, 0.02451235, 0.03247359, 0.04235354, 0.05438302,
       0.06874658, 0.0855565 , 0.10482602, 0.12644431, 0.15015634,
       0.17555054, 0.20205744, 0.22896107, 0.25542453, 0.28052897,
       0.30332414, 0.32288686, 0.33838253, 0.34912394, 0.35462185,
       0.35462185, 0.34912394, 0.33838253, 0.32288686, 0.30332414,
       0.28052897, 0.25542453, 0.22896107, 0.20205744, 0.17555054,
       0.15015634, 0.12644431, 0.10482602, 0.0855565 , 0.06874658,
       0.05438302, 0.04235354, 0.03247359, 0.02451235, 0.01821603]),
            index=0
        ),
        (UUID('faed3019-184e-4fe6-bde9-63de77e2d92f'), 1): Waveform(
            data=array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0.]),
            index=1
        )
    },
    weights={},
    acquisitions={},
    program=Program(
        elements=[
            Line(Move(source=0, destination=Register(number=0), instr='move'), comment='init bin counter'),
            Line(Move(source=0, destination=Register(number=1), instr='move'), comment='init bin reset'),
            Line(Move(source=5000, destination=Register(number=2), instr='move'), comment='init shots counter'),
            Line(WaitSync(duration=4, instr='wait_sync')),
            Line(Wait(duration=4, instr='wait'), label='start'),
            Line(Play(wave_0=0, wave_1=1, duration=40, instr='play')),
            Line(Wait(duration=3395, instr='wait'), comment='relaxation'),
            Line(Move(source=3, destination=Register(number=3), instr='move')),
            Line(Wait(duration=65535, instr='wait'), label='wait3'),
            Line(Loop(a=Register(number=3), address=Reference(label='wait3'), instr='loop')),
            Line(ResetPh(instr='reset_ph'), comment='phase reset'),
            Line(Add(a=Register(number=0), b=1, destination=Register(number=0), instr='add'), comment='bin increment'),
            Line(Loop(a=Register(number=2), address=Reference(label='start'), instr='loop'), comment='loop over shots'),
            Line(Stop(instr='stop'))
        ]
    )
)

@alecandido alecandido force-pushed the qblox-repro branch 2 times, most recently from c9ddb83 to bbbf50f Compare February 26, 2025 18:48
@alecandido
Copy link
Member Author

Ok, the problem has been finally identified, and solved directly in #1088

It was due to the synchronization over different channels (a missing padding at the end of the experiment, since there is no align at the beginning).

Then, since it turned out to be completely unrelated to all the configurations, I will review the content in here to check if there is anything worth to be kept, and then close this PR.

@alecandido
Copy link
Member Author

alecandido commented Mar 10, 2025

All the relevant changes have been ported to #1088, thus this PR is not any longer relevant.

(all the values not set explicitly, as it is done in here, are believed to assume those values by default internally, lacking a need to explicit enforce the defaults in this interface)

@alecandido alecandido closed this Mar 10, 2025
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

Successfully merging this pull request may close these issues.

1 participant