-
Notifications
You must be signed in to change notification settings - Fork 42
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
Better kernel dispatch and add custom _asarray #245
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #245 +/- ##
==========================================
- Coverage 99.19% 95.55% -3.65%
==========================================
Files 28 34 +6
Lines 3105 2699 -406
==========================================
- Hits 3080 2579 -501
- Misses 25 120 +95
Continue to review full report at Codecov.
|
…lane-lightning into better_kernel_dispatch
…ennylane-lightning into pre_better_kernel_dispatch
…lane-lightning into better_kernel_dispatch
Continue at #291 |
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
tests
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
.github/CHANGELOG.md
file, summarizing thechange, and including a link back to the PR.
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: Currently, we have two different gate implementations (kernels) and some more to be added. As it is possible that one kernel outperforms another kernel only for some number of qubits, it is desirable to have a kernel dispatcher mechanism that takes this information into account. In addition, as with AVX kernels, it is necessary to have an array whose memory is managed by
lightning
with a proper alignment.Description of the Change: Lightning now has the
KernelMap
class which returns the kernels to use for a given number of qubits. The statevector classes now manage their own kernel information accordingly. Moreover,_asarray
is implemented.Benefits: Not huge right now, but with AVX and OpenMP kernels, we should have some advantages.
Possible Drawbacks: Slightly slower dispatch time (1 or 2 more
std::unoreder_map
accesses), and constructing a statevector becomes slower as it needs to obtain the best kernels for each operation.Related GitHub Issues:
Still need to fix/add documents.