Skip to content

Conversation

@austingmhuang
Copy link
Contributor

@austingmhuang austingmhuang commented Oct 3, 2025

Context:
Previously we had custom written call graphs in order to support workflows in a reasonable time frame and produce resource estimates. Now that we have the resource estimation module in Pennylane core, we can leverage that to produce the call graphs instead, rather than using the custom call graphs we had written at the inception of the integration.

Description of the Change:
Delete all the previous existing call graphs and simply get estimates from the pennylane.estimator module and convert those to Qualtran-understandable values.

Benefits:
Makes sure that any ToBloq'd pennylane operator/circuit's call graph is equivalent to the qre.estimate of the same pennylane operator/circuit.

Possible Drawbacks:
There might be some differences between the results arising from the original custom written call graphs and that from the pennylane.estimator module

Related GitHub Issues:
[sc-100485]

@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@austingmhuang austingmhuang marked this pull request as ready for review November 6, 2025 15:31
@austingmhuang austingmhuang changed the title [PROTOTYPE] Use Resource Estimation Module to build call graphs for QT-PL integration Use Resource Estimation Module to build call graphs for QT-PL integration Nov 6, 2025
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.42%. Comparing base (d38fa4e) to head (60a8f5c).
⚠️ Report is 33 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8390   +/-   ##
=======================================
  Coverage   99.42%   99.42%           
=======================================
  Files         587      587           
  Lines       62168    62235   +67     
=======================================
+ Hits        61812    61879   +67     
  Misses        356      356           

☔ 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.

Copy link
Contributor

@obliviateandsurrender obliviateandsurrender left a comment

Choose a reason for hiding this comment

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

Thanks @austingmhuang! Leaving some initial comments.

[(#8468)](https://github.com/PennyLaneAI/pennylane/pull/8468)

* The custom call graphs for resource estimation have been removed. Call graphs are now
computed using the `pennylane.estimator` module, which may lead to different results.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
computed using the `pennylane.estimator` module, which may lead to different results.
computed using the `pennylane.estimator` module.

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, you might provide a reason on why this is a good change.

Copy link
Contributor

@DSGuala DSGuala Nov 25, 2025

Choose a reason for hiding this comment

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

Suggestion: it enables scaling up to larger circuits. For example this now takes 5 seconds. It used to take 5 minutes.

import pennylane as qml
import numpy as np

shape = qml.StronglyEntanglingLayers.shape(n_layers=200, n_wires=400)
rng = np.random.default_rng(12345)
weights = rng.random(size=shape)

op = qml.StronglyEntanglingLayers(weights=weights, wires=range(400))
bloq = qml.io.ToBloq(op)

bloq.call_graph()

Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Changes look good to me. Are there any integration tests that show how this feature works in the general context 👍🏼.

Copy link
Contributor

@DSGuala DSGuala left a comment

Choose a reason for hiding this comment

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

Approved from my side as soon as the changelog is updated and tests pass 👍

Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Looks good to me, happy to approve once we add an integration test for how this feature would work more generally. Also do we have a PR open for the wire mapping bug?

@austingmhuang
Copy link
Contributor Author

Looks good to me, happy to approve once we add an integration test for how this feature would work more generally. Also do we have a PR open for the wire mapping bug?

Implement the integration test and fixed the wire mapping bug here and made the appropriate changes to the test cases.

@austingmhuang
Copy link
Contributor Author

Approved from my side as soon as the changelog is updated and tests pass 👍

I will update the changelog.

Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Looks good to me,

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.

6 participants