Skip to content
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

[WIP] Adding SynthesisData and porting some of the MCX synthesis methods to Rust #13929

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

Conversation

alexanderivrii
Copy link
Contributor

Summary

First, this PR implements the SynthesisData struct, with the goal to simplify porting synthesis algorithms to rust (including synthesis of hierarchical circuits) and standardize the already existing code in crates/accelerate/src/synthesis.

Ideally, we should be using CircuitData instead of introducing SynthesisData, however at the moment CircuitData has a significant overhead. For the sake of an experiment, I have locally rewritten pauli_evolution.rs code, and it became 10x slower when using CircuitData and only 1.1x slower when using SynthesisData. Hopefully we would eventually replace SynthesisData by CircuitData.

To illustrate the above usage of SynthesisData, I am planning to port several MCX synthesis algorithms from Python to Rust. So far:

  • synth_c3x

This struct is going to be used to represent circuits produced by synthesis algorithms.
Ideally it should be replaced by CircuitData, however at the moment CircuitData has too
high of an overhead.
This is the beginning of porting of (some) of the MCX synthesis methods to Rust.
Here it also serves as a very simple example of using SynthesisData.
@alexanderivrii alexanderivrii requested a review from a team as a code owner February 27, 2025 11:34
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@alexanderivrii alexanderivrii added the Rust This PR or issue is related to Rust code in the repository label Feb 27, 2025
@alexanderivrii alexanderivrii added this to the 2.1.0 milestone Feb 27, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13565454235

Details

  • 81 of 141 (57.45%) changed or added relevant lines in 5 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.05%) to 87.813%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/circuit/src/circuit_data.rs 0 21 0.0%
crates/accelerate/src/synthesis/common/mod.rs 38 77 49.35%
Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 94.39%
crates/qasm2/src/lex.rs 2 92.48%
crates/qasm2/src/parse.rs 6 97.61%
Totals Coverage Status
Change from base Build 13553732677: -0.05%
Covered Lines: 77586
Relevant Lines: 88354

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust This PR or issue is related to Rust code in the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants