Skip to content

Rust Backend Integration & Maturin Migration#20

Merged
PhysicsQoo merged 54 commits into
mainfrom
rust
Mar 18, 2026
Merged

Rust Backend Integration & Maturin Migration#20
PhysicsQoo merged 54 commits into
mainfrom
rust

Conversation

@PhysicsQoo

Copy link
Copy Markdown
Owner

Overview

This PR integrates a high-performance Rust backend and migrates the build system from hatch to maturin. It provides a significant performance boost while maintaining full Python API compatibility.

Core Changes

  • Performance: Introduced the Rust-based PathSum engine, delivering 10x-14x speedups on large-scale circuits.
  • Build System: Migrated to maturin to support native Rust extensions and automated CI/CD workflows.
  • Benchmarking: Updated test suites to support automated side-by-side comparisons between Python/Rust and GPMC/Ganak backends.

- Added a new Rust library for Python FFI in `rust-test/python_ffi`.
- Implemented a simple function `hello_from_quprs` to demonstrate FFI functionality.
- Created `Cargo.toml` for the Python FFI project with dependencies on `pyo3` and the main `pathsum` crate.
- Added necessary source files for the library and main executable.
- Updated incremental build artifacts for the `pathsum` project.
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@github-actions

github-actions Bot commented Mar 17, 2026

Copy link
Copy Markdown

🔬 Benchmark Report

📈 Executive Summary

No significant performance changes detected.

📊 Detailed Comparison

Benchmark Name PR (Mean) Baseline Change StdDev
test/test_Feynman.py::test_all_benchmarks[adder_8.qasm-proportional-False-python] 2059.868 ms - New ✨ 17.308 ms
test/test_Feynman.py::test_all_benchmarks[adder_8.qasm-proportional-False-rust] 5.281 ms - New ✨ 0.088 ms
test/test_Feynman.py::test_all_benchmarks[gf2^4_mult.qasm-proportional-False-python] 103.285 ms - New ✨ 14.699 ms
test/test_Feynman.py::test_all_benchmarks[gf2^4_mult.qasm-proportional-False-rust] 0.643 ms - New ✨ 0.017 ms
test/test_Feynman.py::test_all_benchmarks[tof_3.qasm-proportional-True-python] 10.105 ms - New ✨ 0.168 ms
test/test_Feynman.py::test_all_benchmarks[tof_3.qasm-proportional-True-rust] 0.182 ms - New ✨ 0.009 ms
test/test_Feynman.py::test_all_benchmarks[vbe_adder_3.qasm-proportional-True-python] 61.640 ms - New ✨ 0.460 ms
test/test_Feynman.py::test_all_benchmarks[vbe_adder_3.qasm-proportional-True-rust] 0.576 ms - New ✨ 0.019 ms
test/test_MQT.py::test_all_benchmarks[ghz_nativegates_ibm_qiskit_opt0_32.qasm-straightforward-True-gpmc-python] 48.042 ms - New ✨ 0.692 ms
test/test_MQT.py::test_all_benchmarks[ghz_nativegates_ibm_qiskit_opt0_32.qasm-straightforward-True-gpmc-rust] 0.280 ms - New ✨ 0.014 ms
test/test_MQT.py::test_all_benchmarks[ghz_nativegates_ibm_qiskit_opt0_32.qasm-straightforward-True-ganak-python] 47.890 ms - New ✨ 0.490 ms
test/test_MQT.py::test_all_benchmarks[ghz_nativegates_ibm_qiskit_opt0_32.qasm-straightforward-True-ganak-rust] 0.284 ms - New ✨ 0.038 ms
test/test_MQT.py::test_all_benchmarks[graphstate_nativegates_ibm_qiskit_opt0_16.qasm-naive-False-gpmc-python] 149.079 ms - New ✨ 17.018 ms
test/test_MQT.py::test_all_benchmarks[graphstate_nativegates_ibm_qiskit_opt0_16.qasm-naive-False-gpmc-rust] 1.361 ms - New ✨ 0.025 ms
test/test_MQT.py::test_all_benchmarks[graphstate_nativegates_ibm_qiskit_opt0_16.qasm-naive-False-ganak-python] 142.091 ms - New ✨ 0.850 ms
test/test_MQT.py::test_all_benchmarks[graphstate_nativegates_ibm_qiskit_opt0_16.qasm-naive-False-ganak-rust] 1.365 ms - New ✨ 0.057 ms
test/test_MQT.py::test_all_benchmarks[grover-noancilla_nativegates_ibm_qiskit_opt0_4.qasm-proportional-True-gpmc-python] 208.156 ms - New ✨ 0.925 ms
test/test_MQT.py::test_all_benchmarks[grover-noancilla_nativegates_ibm_qiskit_opt0_4.qasm-proportional-True-gpmc-rust] 15.857 ms - New ✨ 0.359 ms
test/test_MQT.py::test_all_benchmarks[grover-noancilla_nativegates_ibm_qiskit_opt0_4.qasm-proportional-True-ganak-python] 983.031 ms - New ✨ 1.757 ms
test/test_MQT.py::test_all_benchmarks[grover-noancilla_nativegates_ibm_qiskit_opt0_4.qasm-proportional-True-ganak-rust] 758.453 ms - New ✨ 0.368 ms
test/test_MQT.py::test_all_benchmarks[qaoa_nativegates_ibm_qiskit_opt0_7.qasm-proportional-False-gpmc-python] 697.533 ms - New ✨ 22.210 ms
test/test_MQT.py::test_all_benchmarks[qaoa_nativegates_ibm_qiskit_opt0_7.qasm-proportional-False-gpmc-rust] 49.759 ms - New ✨ 0.399 ms
test/test_MQT.py::test_all_benchmarks[qaoa_nativegates_ibm_qiskit_opt0_7.qasm-proportional-False-ganak-python] 1870.072 ms - New ✨ 21.161 ms
test/test_MQT.py::test_all_benchmarks[qaoa_nativegates_ibm_qiskit_opt0_7.qasm-proportional-False-ganak-rust] 1222.455 ms - New ✨ 0.847 ms
test/test_MQT.py::test_all_benchmarks[qft_nativegates_ibm_qiskit_opt0_16.qasm-proportional-True-gpmc-python] 2012.989 ms - New ✨ 20.468 ms
test/test_MQT.py::test_all_benchmarks[qft_nativegates_ibm_qiskit_opt0_16.qasm-proportional-True-gpmc-rust] 849.938 ms - New ✨ 3.051 ms
test/test_MQT.py::test_all_benchmarks[qft_nativegates_ibm_qiskit_opt0_16.qasm-proportional-True-ganak-python] 2226.407 ms - New ✨ 27.666 ms
test/test_MQT.py::test_all_benchmarks[qft_nativegates_ibm_qiskit_opt0_16.qasm-proportional-True-ganak-rust] 1012.187 ms - New ✨ 6.346 ms
test/test_MQT.py::test_all_benchmarks[vqe_nativegates_ibm_qiskit_opt0_4.qasm-proportional-False-gpmc-python] 166.856 ms - New ✨ 23.021 ms
test/test_MQT.py::test_all_benchmarks[vqe_nativegates_ibm_qiskit_opt0_4.qasm-proportional-False-gpmc-rust] 13.212 ms - New ✨ 0.433 ms
test/test_MQT.py::test_all_benchmarks[vqe_nativegates_ibm_qiskit_opt0_4.qasm-proportional-False-ganak-python] 919.708 ms - New ✨ 2.022 ms
test/test_MQT.py::test_all_benchmarks[vqe_nativegates_ibm_qiskit_opt0_4.qasm-proportional-False-ganak-rust] 448.092 ms - New ✨ 0.419 ms

…ckerfile and CI, and update `sticky-pull-request-comment` action to v3.
…e `maturin develop` for local package installation in CI.
@codspeed-hq

codspeed-hq Bot commented Mar 17, 2026

Copy link
Copy Markdown

Merging this PR will create unknown performance changes

🆕 32 new benchmarks
⏩ 70 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_all_benchmarks[adder_8.qasm-proportional-False-python] N/A 7.2 s N/A
🆕 test_all_benchmarks[qaoa_nativegates_ibm_qiskit_opt0_7.qasm-proportional-False-gpmc-python] N/A 2.1 s N/A
🆕 test_all_benchmarks[graphstate_nativegates_ibm_qiskit_opt0_16.qasm-naive-False-ganak-python] N/A 407.2 ms N/A
🆕 test_all_benchmarks[grover-noancilla_nativegates_ibm_qiskit_opt0_4.qasm-proportional-True-gpmc-rust] N/A 12 ms N/A
🆕 test_all_benchmarks[vqe_nativegates_ibm_qiskit_opt0_4.qasm-proportional-False-gpmc-rust] N/A 9 ms N/A
🆕 test_all_benchmarks[qaoa_nativegates_ibm_qiskit_opt0_7.qasm-proportional-False-ganak-python] N/A 2.1 s N/A
🆕 test_all_benchmarks[qft_nativegates_ibm_qiskit_opt0_16.qasm-proportional-True-ganak-python] N/A 3.6 s N/A
🆕 test_all_benchmarks[ghz_nativegates_ibm_qiskit_opt0_32.qasm-straightforward-True-gpmc-python] N/A 174.3 ms N/A
🆕 test_all_benchmarks[graphstate_nativegates_ibm_qiskit_opt0_16.qasm-naive-False-gpmc-rust] N/A 4.7 ms N/A
🆕 test_all_benchmarks[qaoa_nativegates_ibm_qiskit_opt0_7.qasm-proportional-False-ganak-rust] N/A 90.7 ms N/A
🆕 test_all_benchmarks[graphstate_nativegates_ibm_qiskit_opt0_16.qasm-naive-False-gpmc-python] N/A 405.3 ms N/A
🆕 test_all_benchmarks[qft_nativegates_ibm_qiskit_opt0_16.qasm-proportional-True-gpmc-python] N/A 3.5 s N/A
🆕 test_all_benchmarks[vbe_adder_3.qasm-proportional-True-python] N/A 180.9 ms N/A
🆕 test_all_benchmarks[grover-noancilla_nativegates_ibm_qiskit_opt0_4.qasm-proportional-True-ganak-python] N/A 556.7 ms N/A
🆕 test_all_benchmarks[qft_nativegates_ibm_qiskit_opt0_16.qasm-proportional-True-gpmc-rust] N/A 43.7 ms N/A
🆕 test_all_benchmarks[grover-noancilla_nativegates_ibm_qiskit_opt0_4.qasm-proportional-True-gpmc-python] N/A 552 ms N/A
🆕 test_all_benchmarks[vqe_nativegates_ibm_qiskit_opt0_4.qasm-proportional-False-gpmc-python] N/A 405.7 ms N/A
🆕 test_all_benchmarks[tof_3.qasm-proportional-True-rust] N/A 675.9 µs N/A
🆕 test_all_benchmarks[gf2^4_mult.qasm-proportional-False-python] N/A 285.1 ms N/A
🆕 test_all_benchmarks[ghz_nativegates_ibm_qiskit_opt0_32.qasm-straightforward-True-ganak-rust] N/A 1.1 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing rust (51fa37d) with main (9f2693b)2

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (521a9ed) during the generation of this report, so 9f2693b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@PhysicsQoo PhysicsQoo self-assigned this Mar 18, 2026
@PhysicsQoo PhysicsQoo merged commit ce3fe41 into main Mar 18, 2026
24 checks passed
@PhysicsQoo PhysicsQoo deleted the rust branch March 21, 2026 19:06
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.

2 participants