Span of degenerated (zero-length) subviews is not zero in some special cases #2979
Labels
Bug
Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)
Milestone
This is an issue which likely was here from the beginning. LayoutLeft and LayoutRight have an internal stride for the left most and right most dimension respectively. In the usual scenario the span is calculated for LayoutLeft for example as m_stridem_dim.N1…*m_dim.N7. But if N0 is zero it should be zero. Note that if you construct a zero length view directly with N0 being zero m_stride is explicitly set to zero. But subview will inherit the stride from the original view.
This could in particular lead to issues when trying to deep_copy such a subview. It also lead to trouble in the new prefetch mechanism for UVM allocations (in this particular case because the zero length subview was created with pair(a.extent(0),a.extent(0)) so that the .data() on the subview was actually the end pointer of the original span, which made the pointer an invalid pointer (not-derefenceable) to give to cudaGetPtrAttributes ,..
Trilinos issue: trilinos/Trilinos#7233
The text was updated successfully, but these errors were encountered: