Skip to content

feat: Add customisable kv-pair metadata to gate definitions#190

Draft
jake-arkinstall wants to merge 3 commits into
1.0-seriesfrom
feat/gate-metadata
Draft

feat: Add customisable kv-pair metadata to gate definitions#190
jake-arkinstall wants to merge 3 commits into
1.0-seriesfrom
feat/gate-metadata

Conversation

@jake-arkinstall

@jake-arkinstall jake-arkinstall commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Allows additional arbitrary data to be provided along with a gate, for tracing execution and potential modification of behaviour (e.g. it is plausible that one may introduce a convention where gates tagged with "noise": false are noiseless).

Using this, we add preliminary support for gate tracking/debug workflows. When a QIS interface is in DIAGNOSTIC mode, we collect the __builtin_return_address on each QIS call and tag gates with it, and these appear in trace files output by Selene. A trace transformation is provided that uses the return address along with pyelftools/filebytes/symbolic to extract debug information for that address, which allows the stacktrace to be appended to each gate. If this information is preserved in the runtime and error model, we can identify which line of the user's program is responsible for which operation hitting the simulator.

@jake-arkinstall jake-arkinstall requested a review from cgh-qtnm July 8, 2026 11:16
@jake-arkinstall

Copy link
Copy Markdown
Collaborator Author

@cgh-qtnm this is my proposal for tracking debug information in 1.0-series, where gates are objects rather than functions.

We add arbitrary metadata to gates, and as long as this is preserved, we can trace that metadata through the entire workflow (user program -> runtime -> error model -> simulator). The return address for qis calls is an example of that kind of metadata.

@cgh-qtnm cgh-qtnm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any architectural issues with this approach. One thing to note is that we will need to carry a dynamically-varying* number of backtrace frames (one u64 each) per gate for different applications, e.g. so we can trace through QEC libraries back to user code. This could be supported as a byte string, but it might be worth adding a first-class u64 array type (or a generic uint array type).

*at the shot or job level, not between gates in the same shot

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.

2 participants