Skip to content

Conversation

@lillian542
Copy link
Contributor

@lillian542 lillian542 commented Oct 14, 2025

Context:

  • It would be convenient to have a convert_to_mbqc_gateset_pass wrapper function so we don't have to have the RotXZX decomposition and the gateset in every notebook for playing with the MBQC pipeline
  • It would be convenient to have a centralized file that tests the key components of our E2E pipeline as the pieces come together.

Description of the Change:
These two things are added.

Benefits:
Convenience.

[sc-93172][sc-100901]

@github-actions

This comment was marked as resolved.

@lillian542 lillian542 marked this pull request as ready for review October 14, 2025 18:49
@lillian542 lillian542 changed the title Add mqbc_gate_set_pass and e2e test file [WIP] Add mqbc_gate_set_pass and e2e test file Oct 14, 2025
@lillian542 lillian542 changed the title [WIP] Add mqbc_gate_set_pass and e2e test file Add mqbc_gate_set_pass and e2e test file Oct 15, 2025
Copy link
Member

@multiphaseCFD multiphaseCFD left a comment

Choose a reason for hiding this comment

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

Thanks @lillian542 ! LGTM and just a few comments for your consideration.

from .decomposition import convert_to_mbqc_formalism, convert_to_mbqc_gateset
from .decomposition import (
convert_to_mbqc_formalism,
convert_to_mbqc_gateset,
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need convert_to_mbqc_gateset?

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 would prefer to leave it. It's separate from convert_to_mqbc_gateset_pass in that it's been decorated with transform, so it's a proper TransformDispatcher and therefore more "by the book" for a tape transform - and we also never call tape transforms "passes".

But technically convert_to_mbqc_gateset_pass should work everywhere I can think of where convert_to_mbqc_gateset works, so I can see an argument against keeping it.


def e2e_mbqc_pipeline(qnode):
"""All the transforms currently in the E2E pipeline for MBQC test workload"""
# qnode = outline_state_evolution_pass(qnode)
Copy link
Member

Choose a reason for hiding this comment

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

Could we put all passes into a list and then iterate and apply for the list?

# measurements have been updated
# CHECK-NOT: quantum.namedobs
# CHECK: quantum.sample
for i in range(x):
Copy link
Member

Choose a reason for hiding this comment

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

so for loops can be captured? I remember we couldn't.

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 think you are thinking of the issue where autograph wasn't working with the unified compiler, but that's been resolved

# qnode = split_non_commuting_pass(qnode)
qnode = diagonalize_final_measurements_pass(qnode)
qnode = measurements_from_samples_pass(qnode)
qnode = convert_to_mbqc_gateset_pass(qnode)
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if the current order of applying transforms would ensure convert_to_mbqc_gateset_pass is compatible with outline_state_evolution_pass. With the outline_state_evolution_pass, all gates are moved to a func.func without qnode attribute.

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 think that's a great question that we will be able to answer when we uncomment it to add it to the integration tests here 😅 That's exactly the kind of issue I'm hoping these tests will make apparent.

If it's not compatible, I would say that's an issue that needs to be resolved by modifying one of the transforms. We've been treating this as the canonical order of these transforms for quite some time. But is there an alternative order you had in mind?

# CHECK: quantum.sample
qml.RZ(x, 0)
qml.RZ(y, 1)
qml.RX(x, 0)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can add a TODOs for multirz and basisrotation gates 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.

Good point! MultiRZ is included in the "pretend_xas_workflow" test below (I'm hoping a fix will merge for that soon but if this is ready to merge before then I'll xfail the test for now), but I'll add BasisRotation to that as well. And maybe MPSPRep.

@multiphaseCFD
Copy link
Member

thanks @lillian542 , I would like to have a final round of review after the CI failures are fixed.

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