Ifpack2 btds gemm#2829
Conversation
| if (r == 0) { | ||
| int V_extent_0 = V_rank == 0 ? 0 : v.extent_int(0); | ||
| return V_extent_0; | ||
| } else if (r == 1) { | ||
| int V_extent_1 = V_rank == 0 ? 0 : V_rank == 1 ? 1 : v.extent_int(1); | ||
| return V_extent_1; | ||
| } else { | ||
| return -1; | ||
| } | ||
| } |
There was a problem hiding this comment.
| if (r == 0) { | |
| int V_extent_0 = V_rank == 0 ? 0 : v.extent_int(0); | |
| return V_extent_0; | |
| } else if (r == 1) { | |
| int V_extent_1 = V_rank == 0 ? 0 : V_rank == 1 ? 1 : v.extent_int(1); | |
| return V_extent_1; | |
| } else { | |
| return -1; | |
| } | |
| } | |
| if (r == 0) { | |
| int V_extent_0 = V_rank == 0 ? 1 : v.extent_int(0); | |
| return V_extent_0; | |
| } else if (r == 1) { | |
| int V_extent_1 = V_rank <= 1 ? 1 : v.extent_int(1); | |
| return V_extent_1; | |
| } else { | |
| return 1; | |
| } |
I think extent would be computed like this.
|
I tested this PR with/without Yuichi's suggestion, gcc/11.3, OpenMPI/4.1.5 Serial build with the new View enabled, I'm still seeing the test failures: Tested with: |
|
@ndellingwood Thank you for the information The stride computation may be like this? template <typename ViewType>
KOKKOS_INLINE_FUNCTION std::size_t get_stride(const ViewType &v, const int r) {
static_assert(Kokkos::is_view_v<ViewType>, "KokkosBatched: ViewType is not a Kokkos::View.");
constexpr std::size_t V_rank = ViewType::rank();
static_assert(V_rank <= 2, "KokkosBatched: ViewType must have rank 0, 1 or 2.");
if (r == 0) {
std::size_t V_stride_0 = V_rank == 0 ? 1 : v.stride(0);
return V_stride_0;
} else if (r == 1) {
std::size_t V_stride_1 = V_rank <= 1 ? 1 : v.stride(1);
return V_stride_1;
} else {
return 1;
}
} |
|
Cross-referencing issue #2622 |
|
I retested as a sanity check
All jobs above enabled the new View impl and complex types |
|
I rebuilt with @yasahi-hpc suggestion (thank you!) , and the Serial job with SKX still exhibits the failures |
|
I retested Trilinos@develop (containing the 4.7.01 releases as packages) in the Serial build with SKX and the legacy View, and the
To move forward, it looks like we need
|
)" This reverts commit 82605a9. Signed-off-by: Luc Berger-Vergiat <[email protected]>
This reverts commit 386663c. Signed-off-by: Luc Berger-Vergiat <[email protected]>
We have been liberally querrying the extent and stride of Views without checking if the rank of the view is high enough to return a valid value. The fixes lead to failures in BTDS which might point to a bug that relied on the old UB behavior of Kokkos::View x( Signed-off-by: Luc Berger-Vergiat <[email protected]>
337b1f5 to
c301882
Compare
Signed-off-by: Luc Berger-Vergiat <[email protected]>
|
Thanks a lot for your help. |
Making sure we return 1 as the minimum stride and extent even if a view has a rank lower than the stride/extent querried. Signed-off-by: Luc Berger-Vergiat <[email protected]>
|
@yasahi-hpc fixed the stride and extent formula, should be good to go with all the changes made yesterday and today |
yasahi-hpc
left a comment
There was a problem hiding this comment.
Thanks for changes
I do not expect these changes make any difference, but it is safer to use the value that is confirmed to work correctly
Co-authored-by: yasahi-hpc <[email protected]> Signed-off-by: Luc Berger <[email protected]>
Co-authored-by: yasahi-hpc <[email protected]> Signed-off-by: Luc Berger <[email protected]>
|
Yes, agreed, applying the changes |
yasahi-hpc
left a comment
There was a problem hiding this comment.
LGTM
Thanks for the fix
* Revert "batched/dense/impl/KokkosBatched_Gemm_Team_Impl.hpp (kokkos#2626)" This reverts commit 82605a9. Signed-off-by: Luc Berger-Vergiat <[email protected]> * Revert "ConjTrans support for batched team gemm (kokkos#2580)" This reverts commit 386663c. Signed-off-by: Luc Berger-Vergiat <[email protected]> * Batch - Dense: Re-applying GEMM fixes for extent/stride We have been liberally querrying the extent and stride of Views without checking if the rank of the view is high enough to return a valid value. The fixes lead to failures in BTDS which might point to a bug that relied on the old UB behavior of Kokkos::View x( Signed-off-by: Luc Berger-Vergiat <[email protected]> * Applying clang-format Signed-off-by: Luc Berger-Vergiat <[email protected]> * Batched - Utils: fixing extent and stride calculation Making sure we return 1 as the minimum stride and extent even if a view has a rank lower than the stride/extent querried. Signed-off-by: Luc Berger-Vergiat <[email protected]> * Update batched/KokkosBatched_Util.hpp Co-authored-by: yasahi-hpc <[email protected]> Signed-off-by: Luc Berger <[email protected]> * Update batched/KokkosBatched_Util.hpp Co-authored-by: yasahi-hpc <[email protected]> Signed-off-by: Luc Berger <[email protected]> --------- Signed-off-by: Luc Berger-Vergiat <[email protected]> Signed-off-by: Luc Berger <[email protected]> Co-authored-by: yasahi-hpc <[email protected]>
* Revert "batched/dense/impl/KokkosBatched_Gemm_Team_Impl.hpp (#2626)" This reverts commit 82605a9. * Revert "ConjTrans support for batched team gemm (#2580)" This reverts commit 386663c. * Batch - Dense: Re-applying GEMM fixes for extent/stride We have been liberally querrying the extent and stride of Views without checking if the rank of the view is high enough to return a valid value. The fixes lead to failures in BTDS which might point to a bug that relied on the old UB behavior of Kokkos::View x( * Applying clang-format * Batched - Utils: fixing extent and stride calculation Making sure we return 1 as the minimum stride and extent even if a view has a rank lower than the stride/extent querried. * Update batched/KokkosBatched_Util.hpp * Update batched/KokkosBatched_Util.hpp --------- Signed-off-by: Luc Berger-Vergiat <[email protected]> Signed-off-by: Luc Berger <[email protected]> Co-authored-by: Luc Berger <[email protected]> Co-authored-by: yasahi-hpc <[email protected]>
Pushing some preliminary changes based of the previous work by @yasahi-hpc
The goal is to isolate the failure that ensue in Trilinos' BTDS solver.
The current changes are sufficient to make the BTDS fail which might indicate that the underlying issue is a bad usage of Kokkos View?