Skip to content

Support for weighted gates in graph decomposition algorithm #7389

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

Merged
merged 117 commits into from
May 21, 2025

Conversation

comp-phys-marc
Copy link
Contributor


Context: In short, a decomposition system based on a graph traversal using Dijkstra's algorithm is applied to find the most optimal gate decompositions for non-native gates. The nodes in the graph represent either decompositions, operations in the target gateset, or higher order operations. The edges show either membership of a native op in a decomposition, or equivalence of a decomposition to a higher order operation. The cost of an edge between a native operation and a decomposition is the number of additional gates found in the decomposition. The cost of an edge between a decomposition and an equivalent higher order op is zero. For more context, see [sc-84664].

Description of the Change: Work in progress on implementing support for relatively weighted gates within a target gateset. The weights are provided by the user, and influence what gate decompositions are chosen by the graph decomposition algorithm. The implementation is such that the weights of the gates are represented by weights on the edges leading to and from native gates.

Benefits: Allows a user to more closely model the behaviour of their backends, and capture the relative cost of executing certain gates such as non-Clifford gates which are native, but more expensive.

Possible Drawbacks: The representation of weights in this way is possibly not intuitive.

Related GitHub Issues:

astralcai and others added 27 commits April 29, 2025 10:42
Co-authored-by: Pietropaolo Frisoni <[email protected]>
	- Switch to use TypeError instead of custom error
	- always guarantee we have weights
	- stringify keys of weights dict
	- correct logic for edge weight calculation
	- closing this PR and switching to new one (#7389)
	which is off of symbolic-rules-01
Copy link
Member

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

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

🚀

@comp-phys-marc comp-phys-marc added the merge-ready ✔️ All tests pass and the PR is ready to be merged. label May 9, 2025
Base automatically changed from symbolic-rules-01 to master May 20, 2025 21:57
@comp-phys-marc comp-phys-marc added this pull request to the merge queue May 21, 2025
Merged via the queue into master with commit 9d834af May 21, 2025
53 checks passed
@comp-phys-marc comp-phys-marc deleted the feature/wghtd-gts-based-on-symblc-rls branch May 21, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-ready ✔️ All tests pass and the PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants