Skip to content

Skip the list conversion of envelopes when the QickSoc is local - #444

Merged
meeg merged 3 commits into
openquantumhardware:mainfrom
jinchen-zhao:local-envelope-load
Nov 6, 2026
Merged

meeg merged 3 commits into
openquantumhardware:mainfrom
jinchen-zhao:local-envelope-load

Conversation

@jinchen-zhao

Copy link
Copy Markdown
Contributor

Related to #411.

load_envelopes converts every envelope and weight array to a Python list "for pyro compatibility". Then QickSoc.load_envelope converts the list back to an array. With a local QickSoc, this round trip is the largest part of loading a program that has a long envelope, because the board CPU is slow at it.

On our ZCU111, a 60,320-sample envelope took 715 ms in acquire_decimated. With load_envelopes patched to skip the conversion, it took 5 ms. That test used a tProc v1 program, and v2 programs call the same load_envelopes. It matches the extra ~500 ms that #411 reports for a ~60,000-sample envelope.

This PR converts to a list only when soc is a Pyro proxy, which it detects by the _pyroUri attribute that every Pyro4 proxy has. A local QickSoc gets the int16 array as it is. Nothing changes for remote use. The lists stay for the proxy because, as setup.py notes, PYNQ boards run NumPy 1, which cannot read NumPy 2 pickles. load_weights gets the same change.

Testing (no board): a fake soc records the type of data it gets.

  • A local soc gets a numpy.ndarray, a fake proxy with _pyroUri gets a list, and both load the same samples.
  • load_envelopes with a 65,536-sample envelope on an Apple M-series CPU takes 0.004 ms for a local soc and 7.4 ms through the list. The board CPU is much slower at the list round trip than this.

On this branch: 3 passed. On main, the local-soc test fails (assert [<class 'list'>] == [<class 'numpy.ndarray'>]).

The 715 ms → 5 ms numbers come from our patched install on the board, not from this branch. I can measure this branch on the board if that helps.

jinchen-zhao and others added 3 commits November 3, 2026 16:38
load_envelopes converted every envelope and weight array to a Python list for Pyro.
QickSoc.load_envelope then converts the list back to an array.
On a local board, this round trip is the slowest step of a program load.
On a ZCU111 with a 60320-sample envelope, acquire_decimated took 715 ms, and 5 ms without the round trip.
That test used a tProc v1 program, and v2 programs use the same load_envelopes.

load_envelopes now converts to a list only when soc is a Pyro proxy (it has _pyroUri).
A local QickSoc gets the int16 array as it is.
Remote use does not change.

See openquantumhardware#411.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meeg
meeg merged commit d0e4567 into openquantumhardware:main Nov 6, 2026
3 checks passed
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.

3 participants