-
Notifications
You must be signed in to change notification settings - Fork 51
Update kokkos 5.0 #1308
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
base: master
Are you sure you want to change the base?
Update kokkos 5.0 #1308
Changes from 27 commits
6468cae
360437d
e1b8a4a
c78777e
c11b7b5
0074965
7d02917
e267553
4517446
a1e3eca
b95af13
3dc24d0
52ad1ce
22bc978
1124218
b709a13
31fa097
02879a8
db95ad8
20d3e6d
b177d42
0abe49f
a32b4eb
189d4af
d2dd3c5
f2bee43
8e7febb
2e4ee2c
885cd78
2d54a43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kokkos 5.0 mandates C++20. This raises the minimum compiler requirements for anyone building from source: Could you please check and update CMakes and docs accordingly? |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget to update the changelog :) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,4 +16,4 @@ | |
| Version number (major.minor.patch[-label]) | ||
| """ | ||
|
|
||
| __version__ = "0.45.0-dev28" | ||
| __version__ = "0.45.0-dev29" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| #include "cuda_helpers.hpp" | ||
|
|
||
| #include <nanobind/nanobind.h> | ||
| #include <nanobind/stl/pair.h> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will help with an issue seen sometimes for ARM CUDA wheels CIs: This is indeterministic with some CI runs, possibly due to GPU runner environment issues. The error of the missing pair include masks the real error, so this will help with that. |
||
|
|
||
| /// @cond DEV | ||
| namespace { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1840,9 +1840,10 @@ template <typename PrecisionT> class applyMultiRZFunctor { | |
| } | ||
|
|
||
| KOKKOS_FUNCTION void operator()(const std::size_t k) const { | ||
| arr(k) *= (Kokkos::Impl::bit_count(k & wires_parity) % 2 == 0) | ||
| ? shift_0 | ||
| : shift_1; | ||
| arr(k) *= | ||
| (Kokkos::Experimental::popcount_builtin(k & wires_parity) % 2 == 0) | ||
|
||
| ? shift_0 | ||
| : shift_1; | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -1880,10 +1881,12 @@ void applyNCMultiRZ(Kokkos::View<Kokkos::complex<PrecisionT> *> arr_, | |
| Kokkos::View<Kokkos::complex<PrecisionT> *> arr, std::size_t i, | ||
| Kokkos::View<std::size_t *> indices, std::size_t offset) { | ||
| std::size_t index = indices(i); | ||
| arr(index + offset) *= | ||
| (Kokkos::Impl::bit_count((index + offset) & wires_parity) % 2 == 0) | ||
| ? shift_0 | ||
| : shift_1; | ||
| arr(index + offset) *= (Kokkos::Experimental::popcount_builtin( | ||
josephleekl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| (index + offset) & wires_parity) % | ||
| 2 == | ||
| 0) | ||
| ? shift_0 | ||
| : shift_1; | ||
| }; | ||
|
|
||
| applyNCNFunctor(ExecutionSpace{}, arr_, num_qubits, controlled_wires, | ||
|
|
@@ -1932,8 +1935,10 @@ void applyPauliRot(Kokkos::View<Kokkos::complex<PrecisionT> *> arr_, | |
| KOKKOS_LAMBDA(std::size_t i0) { | ||
| std::size_t i1 = i0 ^ mask_xy; | ||
| if (i0 <= i1) { | ||
| const auto count_y = Kokkos::Impl::bit_count(i0 & mask_y) * 2; | ||
| const auto count_z = Kokkos::Impl::bit_count(i0 & mask_z) * 2; | ||
| const auto count_y = | ||
| Kokkos::Experimental::popcount_builtin(i0 & mask_y) * 2; | ||
josephleekl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const auto count_z = | ||
| Kokkos::Experimental::popcount_builtin(i0 & mask_z) * 2; | ||
josephleekl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const auto sign_i0 = count_z + count_mask_y * 3 - count_y; | ||
| const auto sign_i1 = count_z + count_mask_y + count_y; | ||
| const ComplexT v0 = arr_(i0); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -369,7 +369,9 @@ void applyGenMultiRZ(Kokkos::View<Kokkos::complex<PrecisionT> *> arr_, | |||||
| Pennylane::Util::exp2(num_qubits)), | ||||||
| KOKKOS_LAMBDA(std::size_t k) { | ||||||
| arr_(k) *= static_cast<PrecisionT>( | ||||||
| 1 - 2 * int(Kokkos::Impl::bit_count(k & wires_parity) % 2)); | ||||||
| 1 - 2 * int(Kokkos::Experimental::popcount_builtin( | ||||||
|
||||||
| 1 - 2 * int(Kokkos::Experimental::popcount_builtin( | |
| 1 - 2 * int(std::popcount( |
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.
@maliasadi but this is to execute on the device, not on the host, and std::popcount is just on the host. Kokkos popcount is more appropriate in this case
josephleekl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
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.
| 1 - 2 * int(Kokkos::Experimental::popcount_builtin( | |
| 1 - 2 * int(std::popcount( |
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.
but actually maybe i should use Kokkos::popcountinstead. let me try it
Uh oh!
There was an error while loading. Please reload this page.