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

Add circuit start table to QPY file header #14102

Open
mtreinish opened this issue Mar 26, 2025 · 0 comments
Open

Add circuit start table to QPY file header #14102

mtreinish opened this issue Mar 26, 2025 · 0 comments
Labels
mod: qpy Related to QPY serialization short project type: feature request New feature or request

Comments

@mtreinish
Copy link
Member

What should we add?

Right now the QPY file format is designed to be read solely in order where you read one circuit in it's entirety and the next starts immediately after you finish processing it. The representation in the format specification doesn't specify the exact size of the circuit's payload in bytes but gives the details necessary for the parser to know how to read the data and process it. However, in a potential world where we have a parser written in rust (see #13131) and now that we have a path for creating circuits without python (see #14006) there is the possibility of performing deserialization in parallel for QPY payloads with > 1 circuit. However to do this efficiently we need to be able to figure out where each circuit begins in a QPY payload to farm out the deserialization of a circuit to multiple threads. The format isn't really conduicive for this right now because we would have to parse a circuit to know where the next one begins.

To address this a simple solution is to add a small table to the end of the header that contains a list of addresses for each circuit start. The header already contains a circuit count, so we can add immediately follow the header struct with that number of byte offsets in the payload for where each circuit starts. This will require a QPY version bump as it is changing the file format. With that information we will be able to potentially parallelize the deserialization of multiple payloads

@mtreinish mtreinish added mod: qpy Related to QPY serialization short project type: feature request New feature or request labels Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: qpy Related to QPY serialization short project type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant