-
Notifications
You must be signed in to change notification settings - Fork 615
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
Tree-traversal iterative design & analytic-mode #5868
Conversation
… for many-shot iterative_qpe algo.
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! Just some final comments for the implementation.
The only other thing that comes to mind is testing. There's an ongoing effort right now to rework mid-circuit measurement tests, with @obliviateandsurrender and @astralcai leading the work. They might be able to provide more context, but it might be worth adding unit tests in favour of the integration tests in test_default_qubit_native_mcm.py
.
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks good to me. Very excited to get this in 🎉 . I'm approving as the only missing piece of the puzzle is test coverage, which will block merging anyway.
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Sorry about the delays in reviews. In an ideal world, we'd find a way to reduce the overall complexity of the simulate_tree_mcm
function, but not sure its the time and effort that would be involved.
Other than that, impressive work :)
### 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 test 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 `doc/releases/changelog-dev.md` file, summarizing the change, and including a link back to the PR. - [x] The PennyLane source code conforms to [PEP8 standards](https://www.python.org/dev/peps/pep-0008/). We check all of our code against [Pylint](https://www.pylint.org/). To lint modified files, simply `pip install pylint`, and then run `pylint pennylane/path/to/file.py`. When all the above are checked, delete everything above the dashed line and fill in the pull request template. ------------------------------------------------------------------------------------------------------------ **Context:** The tree-traversal algorithm was first implemented using a recursive approach for simplicity, but this potentially requires very deep stack calls for circuits with a lot of MCMs. Tree-traversal could also support analytic execution, optionally with a probability cutoff to ignore branches. **Description of the Change:** Implement tree-traversal using an iterative approach. Support `shots=None`. Some profiling and optimization. **Benefits:** Remove system call increasing the default recursion call limit. **Possible Drawbacks:** **Related GitHub Issues:** [sc-65241] --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Matthew Silverman <matthews@xanadu.ai>
Before submitting
Please complete the following checklist when submitting a PR:
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
test directory!
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
.Ensure that the test suite passes, by running
make test
.Add a new entry to the
doc/releases/changelog-dev.md
file, summarizing thechange, and including a link back to the PR.
The PennyLane source code conforms to
PEP8 standards.
We check all of our code against Pylint.
To lint modified files, simply
pip install pylint
, and thenrun
pylint pennylane/path/to/file.py
.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context:
The tree-traversal algorithm was first implemented using a recursive approach for simplicity, but this potentially requires very deep stack calls for circuits with a lot of MCMs. Tree-traversal could also support analytic execution, optionally with a probability cutoff to ignore branches.
Description of the Change:
Implement tree-traversal using an iterative approach.
Support
shots=None
.Some profiling and optimization.
Benefits:
Remove system call increasing the default recursion call limit.
Possible Drawbacks:
Related GitHub Issues:
[sc-65241]