-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add native PauliRot implementation in LightningQubit (#834)
### Before submitting Please complete the following checklist when submitting a PR: - [x] All new features must include a unit test. If you've fixed a bug or added code that should be tested, add a test to the [`tests`](../tests) directory! - [x] All new functions and code must be clearly commented and documented. If you do make documentation changes, make sure that the docs build and render correctly by running `make docs`. - [x] Ensure that the test suite passes, by running `make test`. - [x] Add a new entry to the `.github/CHANGELOG.md` file, summarizing the change, and including a link back to the PR. - [x] Ensure that code is properly formatted by running `make format`. When all the above are checked, delete everything above the dashed line and fill in the pull request template. ------------------------------------------------------------------------------------------------------------ **Context:** Pauli rotations come up in many places, and importantly in the time evolution of qchem Hamiltonians. It is therefore worth considering ways to accelerate their execution. **Description of the Change:** Implement `applyPauliRot` in the LM gate kernel. Invoke `applyPauliRot` directly from the SV class and add bindings to the Python layer. Add custom decomposition rule for `PauliRot` operations. **Benefits:** Faster Pauli rotations. I performed a benchmark on random `PauliRotation`s (runtime > 1.0 sec and at least 5 of them) through the Python layer. The data remains noisy with 5 samples because the performance varies depending on the specific "XYZ" sequence (which translates into more or less predictable memory access patterns). Overall, we see an advantage for 3+ qubits and up. ![speedup_vs_ntargets](https://github.com/user-attachments/assets/35549fe3-5668-49f8-b94b-3a6567be91cf) The speed-ups are also good when parallelizing with OpenMP threads (both cases using 16 threads) ![speedup_vs_ntargets_omp16](https://github.com/user-attachments/assets/4b543bb1-0da4-47f7-9ecb-8932760f069c) After rewriting the PauliRot gates as one-qubit gates of sort, writing AVX kernels for PauliRot may be worth it. For an entire workflow like time-evolving a QChem Hamiltonian, the gains are slower coming because `PauliRot` is not necessarily the main bottleneck at all scales, but it is once the molecules are big enough. This is shown in the speed-up bar graph below. ![speedup_vs_mol](https://github.com/user-attachments/assets/db6ec7aa-de15-4f2a-947b-5564ea4824f2) **Possible Drawbacks:** **Related GitHub Issues:** [sc-69801] [sc-71642] --------- Co-authored-by: ringo-but-quantum <[email protected]> Co-authored-by: Luis Alfredo Nuñez Meneses <[email protected]>
- Loading branch information
1 parent
6b42030
commit 83ac9d8
Showing
17 changed files
with
560 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
Version number (major.minor.patch[-label]) | ||
""" | ||
|
||
__version__ = "0.38.0-dev37" | ||
__version__ = "0.38.0-dev38" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.