Skip to content

Specify output schemas #50

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

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Conversation

qartik
Copy link
Contributor

@qartik qartik commented Jun 6, 2025

Fork of and supersedes #36, the diff between the two PRs can be seen at cesarzc/qir-spec@output-schemas...qartik:qir-spec:output-schemas

Or if you want to avoid looking at changes already in main, see qartik/qir-spec@4146608...output-schemas

@qartik qartik marked this pull request as ready for review June 17, 2025 02:21
@qartik
Copy link
Contributor Author

qartik commented Jun 26, 2025

Hi @swernli, @bettinaheim, could you review this PR?

Copy link
Contributor

@swernli swernli left a comment

Choose a reason for hiding this comment

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

Approved with a few minor comments.

METADATA\trequired_num_qubits\t5
METADATA\trequired_num_results\t5
METADATA\tqir_profiles\tbase_profile
METADATA\toutput_labeling_format\tformat_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Is format_id here and in the QIR above (also on other files) meant to be a placeholder for the actual ID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it is, but I am not 100% sure what the values look like. Previously it was called schema_id and was present in the base profile for the attribute "output_labeling_schema", see https://github.com/qir-alliance/qir-spec/blob/main/specification/under_development/profiles/Base_Profile.md#attributes

If I were to make a guess, the values should be "ordered" and "labeled".

If that sounds good to you, I will update the examples to reflect that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that makes sense. Either "ordered" or "labeled" seem appropriate here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@swernli actually, I just realized that that distinction is covered by the schema_name HEADER so putting it under output_labeling_schema is redundant.

Since the profiles specify the attribute "output_labeling_{schema,format}", we would like to match it with the metadata in the output. We have two options:

  1. Eliminate output_labeling_format from the METADATA output and keep the original attribute "output_labeling_schema" and relate it to the schema_name HEADER, OR
  2. Figure out the intended use for output_labeling_format and specify what can be used for format_id. This will also require either introducing a new attribute to specify the output schema in the profiles or inferring it from the output function signatures.

I prefer option 1 for its simplicity.

@bettinaheim do you happen to have an insight on the history of the attribute "output_labeling_schema"? In case we are missing something, and it is option 2 that we should focus on.

Copy link
Contributor Author

@qartik qartik Jul 2, 2025

Choose a reason for hiding this comment

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

As raised by the steering committee, the second option being a breaking change, I went with option 1.

qartik added 2 commits June 26, 2025 17:17
also add a link to output records as suggested by Stefan
cspell.json Outdated
Copy link
Contributor Author

@qartik qartik Jun 26, 2025

Choose a reason for hiding this comment

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

Added this file for the commonly occurring (~ >=5 occurrences) technical words. Helps reduce the noise in the diff and also to catch real mistakes.

@@ -170,7 +171,7 @@ declare void @__quantum__rt__result_record_output(%Result*, i8*)

; attributes

attributes #0 = { "entry_point" "qir_profiles"="base_profile" "output_labeling_schema"="schema_id" "required_num_qubits"="2" "required_num_results"="2" }
attributes #0 = { "entry_point" "qir_profiles"="base_profile" "output_labeling_format"="format_id" "required_num_qubits"="2" "required_num_results"="2" }
Copy link
Contributor

Choose a reason for hiding this comment

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

It came up during steering committee meeting that this would technically be a breaking change, since the attribute name is different. Could you revert this part of the change to keep the name output_labeling_schema here and in the text sections?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 6cebf1c

@@ -675,14 +675,14 @@ information about the `switch` instruction.

The following runtime functions must be supported by all backends:

| Function | Signature | Description |
| :---------------------------------- | :------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Copy link
Contributor

Choose a reason for hiding this comment

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

From the steering committee: could you revert the formatting fixes in this and the other profile? There was a preference to avoid formatting changes here and keep the updates to the profile to be only functional changes to text or links.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 50b5daf

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