Skip to content

Add support for direct Jaqal ingestion with JaqalService()#1364

Merged
bharat-thotakura merged 29 commits into
mainfrom
bt/support-jaqal-input
Apr 20, 2026
Merged

Add support for direct Jaqal ingestion with JaqalService()#1364
bharat-thotakura merged 29 commits into
mainfrom
bt/support-jaqal-input

Conversation

@bharat-thotakura

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
@bharat-thotakura bharat-thotakura marked this pull request as ready for review April 6, 2026 22:55
@bharat-thotakura bharat-thotakura marked this pull request as draft April 6, 2026 22:58
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
@bharat-thotakura bharat-thotakura marked this pull request as ready for review April 7, 2026 16:16
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds first-class support for compiling Jaqal program strings directly via a new Service.jaqal_compile() API, while also refactoring shared QSCOUT option validation and consolidating duplicated CompilerOutput logic into general_superstaq.

Changes:

  • Add Service.jaqal_compile() to compile Jaqal strings for QSCOUT targets, including ECA support.
  • Centralize QSCOUT option validation in general_superstaq.validation.get_validated_qscout_options() and reuse it from Cirq/Qiskit QSCOUT compile entrypoints.
  • Introduce general_superstaq.compiler_output.BaseCompilerOutput and migrate Cirq/Qiskit CompilerOutput to inherit from it.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
qiskit-superstaq/qiskit_superstaq/superstaq_backend.py Refactors QSCOUT option-building to use shared validation helper.
qiskit-superstaq/qiskit_superstaq/compiler_output.py Switches CompilerOutput to inherit from shared base; updates Jaqal subcircuit aggregation call site.
general-superstaq/general_superstaq/validation.py Adds Jaqal qubit inference and a shared QSCOUT options validator.
general-superstaq/general_superstaq/validation_test.py Adds unit tests for Jaqal qubit inference.
general-superstaq/general_superstaq/service.py Adds Service.jaqal_compile() for direct Jaqal ingestion/compilation.
general-superstaq/general_superstaq/service_test.py Adds tests covering jaqal_compile() behaviors (single, list, ECA, invalid inputs).
general-superstaq/general_superstaq/compiler_output.py New shared BaseCompilerOutput and Jaqal-specific read_json_jaqal().
general-superstaq/general_superstaq/compiler_output_test.py Adds tests for new compiler output behavior (repr/eq basics).
general-superstaq/general_superstaq/init.py Exports BaseCompilerOutput and compiler_output module.
cirq-superstaq/cirq_superstaq/service.py Refactors QSCOUT option-building to use shared validation helper.
cirq-superstaq/cirq_superstaq/compiler_output.py Switches CompilerOutput to inherit from shared base; updates Jaqal subcircuit aggregation call site.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread general-superstaq/general_superstaq/compiler_output.py Outdated
Comment thread general-superstaq/general_superstaq/compiler_output.py Outdated
Comment thread general-superstaq/general_superstaq/compiler_output.py
Comment thread general-superstaq/general_superstaq/validation.py
Comment thread qiskit-superstaq/qiskit_superstaq/compiler_output.py
Comment thread cirq-superstaq/cirq_superstaq/compiler_output.py
Comment thread general-superstaq/general_superstaq/service.py Outdated
@bharat-thotakura bharat-thotakura marked this pull request as draft April 7, 2026 19:41
bharat-thotakura and others added 7 commits April 7, 2026 15:40
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
@bharat-thotakura bharat-thotakura marked this pull request as ready for review April 7, 2026 21:57
@bharat-thotakura

Copy link
Copy Markdown
Contributor Author

Discussion from dev meeting: instead of jaqal_compile() which could propagate to css and qss, consider isolating with some JaqalService() whose sole job is dealing with Jaqal instead of overloading gss.Service(). For future outlook, this could also mean QASMService() and QIRService()

@bharat-thotakura bharat-thotakura marked this pull request as draft April 8, 2026 21:41
bharat-thotakura and others added 4 commits April 8, 2026 17:16
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
@bharat-thotakura bharat-thotakura marked this pull request as ready for review April 10, 2026 20:28
`jaqal_programs`.
"""
target = gss.validation.validate_target(target)
circuits_is_list = not isinstance(jaqal_programs, str)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if this is a string could it still contain subcircuits? if so maybe we just make this

Suggested change
circuits_is_list = not isinstance(jaqal_programs, str)
circuits_is_list = True

to avoid randomly changing return types between one and two+ subcircuits

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Currently, the server will always return a list, so if there were subcircuits, that is handled via the check in read_json_jaqal:

if circuits_is_list or len(compiled_circuits) != 1 or num_eca_circuits:

If circuits_is_list is always True, we wouldn't be able to use the singular .circuit attribute right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah, missed the check in read_json_jaqal, and also forgot we provide .jaqal_program(s) regardless of circuits_is_list (though maybe that raises a question about whether the compiler output from jaqal service should just use .circuit(s) instead of .jaqal_program(s)?)

we wouldn't be able to use the singular .circuit attribute right?

my thinking was that this would make sense in this case, because if i pass a single jaqal string there's no way to tell if i intended it to be a standalone circuit or a program with a single subcircuit (and imo it's not great to change switch just given the number of circuits, because it makes the result type inconsistent in any sort of scripting). but feel less strongly due to the existence of .jaqal_program(s) (and the coming deprecation of compiler outputs anyway)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I initially went with circuits_is_list = True, so I'm not opposed to it since the attribute change isn't elegant (I think I didn't want to index by 0 for single-str inputs). However, in light of the review, I've just made it always a list with 77ca880. Let me know if that works better

Comment thread general-superstaq/general_superstaq/service.py Outdated
Q = TypeVar("Q")


class BaseCompilerOutput(Generic[C, Q]): # noqa: PLW1641

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

love the use of generics here - wondering if we could do something similar for BaseService (obviously not for this pr though)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah probably, but feels like we would end up implementing the specific overrides anyway (e.g., because of different serializations etc), so would have to see how much more is consolidated and not duplicated. Regardless, will leave for another PR when the SuperstaqClientV3 becomes the norm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah good point, that's probably true

Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
Signed-off-by: Bharath <bharath.thotakura@infleqtion.com>
@bharat-thotakura bharat-thotakura changed the title Add support for direct Jaqal ingestion with jaqal_compile() Add support for direct Jaqal ingestion with JaqalService() Apr 17, 2026

@richrines1 richrines1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm! (assuming tests will pass after #1380)

@bharat-thotakura

bharat-thotakura commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

(assuming tests will pass after #1380)

Yup, they should (except for the unrequired notebook checks)

@bharat-thotakura bharat-thotakura merged commit de2c7d4 into main Apr 20, 2026
18 of 21 checks passed
@bharat-thotakura bharat-thotakura deleted the bt/support-jaqal-input branch April 20, 2026 20:07
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