Skip to content

Conversation

@andrijapau
Copy link
Contributor

@andrijapau andrijapau commented Nov 20, 2025

This PR adds basic visualization support for operators and measurement nodes in the DAG.

@qml.qjit(autograph=True, target="mlir")
@qml.qnode(dev)
def my_workflow(x):
    if x == 2:
        qml.X(0)
    elif x == 3:
        qml.Y(0)
    else:
        qml.Z(0)

    for i in range(3):
        qml.H(0)

    counter = 0 
    while counter < 5:
        qml.RX(0.5, 0)
   
    return qml.expval(qml.PauliZ(0)), qml.probs(), qml.var(qml.X(0)), qml.state()
Screenshot 2025-12-10 at 2 34 02 PM

[sc-104322]

@andrijapau andrijapau added the unified compiler Pull requests for the integration with xDSL label Nov 20, 2025
@andrijapau andrijapau changed the title feat: visualize operators and measurements as nodes in a DAG feat: visualize operators and measurements as nodes in the DAG Nov 20, 2025
@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (feature/graph-visualization@8f6563e). Learn more about missing BASE report.

Additional details and impacted files
@@                      Coverage Diff                       @@
##             feature/graph-visualization    #2218   +/-   ##
==============================================================
  Coverage                               ?   97.66%           
==============================================================
  Files                                  ?       93           
  Lines                                  ?    10899           
  Branches                               ?     1039           
==============================================================
  Hits                                   ?    10645           
  Misses                                 ?      195           
  Partials                               ?       59           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrijapau andrijapau added the wip PRs that are a Work-In-Progress label Nov 20, 2025
@andrijapau andrijapau marked this pull request as draft November 20, 2025 21:36
@andrijapau andrijapau marked this pull request as ready for review November 24, 2025 21:29
@andrijapau andrijapau changed the title feat: visualize operators and measurements as nodes in the DAG feat: visualize static operators and measurements as nodes Nov 25, 2025
andrijapau and others added 21 commits November 26, 2025 13:46
This reverts commit 57ce573.
self._node_uid_counter += 1

@_visit_operation.register
def _visit_sample_and_probs_ops(
Copy link
Contributor

Choose a reason for hiding this comment

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

What about counts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I don't really see why you're handling all the measurements in separate functions. Let me know if your agree, but they seem too similar to need different dispatches. I think a match-case might make more sense. I can totally be convinced otherwise though

Copy link
Contributor Author

@andrijapau andrijapau Dec 9, 2025

Choose a reason for hiding this comment

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

What about counts?

Turns out Pietro's work didn't have support for counts 😬. Not sure why.

Base automatically changed from feature/control-flow-clusters to feature/graph-visualization December 10, 2025 21:28
@andrijapau andrijapau merged commit 3179d95 into feature/graph-visualization Dec 10, 2025
34 checks passed
@andrijapau andrijapau deleted the feature/visualize-nodes branch December 10, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unified compiler Pull requests for the integration with xDSL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants