-
Notifications
You must be signed in to change notification settings - Fork 88
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
Simple segmented ranges #1601
Simple segmented ranges #1601
Conversation
bba6eba
to
4b9a6cd
Compare
First up, the zip iterator also need to be made constexpr for this to work on the device. |
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.
this looks a lot cleaner than the old PR, thanks for that. I have mostly smaller remarks, the biggest issue is the zip_iterator
which is not available on the device. Maybe it would be possible to use different types for the zip_iterator depending on the backend.
4b9a6cd
to
03a95bf
Compare
6b2393e
to
86218ce
Compare
86218ce
to
e94ad77
Compare
b22f9fe
to
76dd812
Compare
758f690
to
cddc108
Compare
index_type index; | ||
segment_type segment; |
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.
I do find the naming a bit confusing. I think index
is the index of the segment, and not an index of the range. And segment is not the index of the segment, but a full range by itself.
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.
The "entries" of a segmented range are segments, and enumerating them you get a segment index and segment value back. Do you have a suggestion how to make this more clear through naming?
* @tparam ValueIterator the iterator type pointing to the values. | ||
*/ | ||
template <typename IndexType, typename ValueIterator> | ||
class segmented_value_range { |
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.
I'm wondering a bit how this will work out with the device_segmented_array
and device implementations of our classes in general.
In principle, device_segmented_array
could be replaced directly by this. One thing I would not like about that is that the device_segmented_array
basically consists only of data members, and in general I would prefer our device implementations to not have member functions. (My reason for that is that I want to generalize the device implementations so that they can be directly exposed to kokkos or similar.)
So right now, I would imagine conversion functions and having some redundancy, instead of replacing device_segmented_array
.
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.
I think that is a heavy restriction. Is there a reason why having no member functions is necessary to expose these directly to kokkos ?
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.
It's not necessary. But I would prefer to not provide methods, as I'm not sure if they would also be available in Kokkos code. I guess they would be, since this can run on the GPU, but I would still be a bit hesitant.
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.
LGTM!
* @tparam ValueIterator the iterator type pointing to the values. | ||
*/ | ||
template <typename IndexType, typename ValueIterator> | ||
class segmented_value_range { |
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.
I think that is a heavy restriction. Is there a reason why having no member functions is necessary to expose these directly to kokkos ?
bdeddf6
to
f61eff4
Compare
- fix name hiding in classes - add tests for ptrs constructors Co-authored-by: Marcel Koch <marcel.koch@kit.edu>
a20de3e
to
9fbbbba
Compare
This removes all stride support from #1582, which removes most of the heavy
iterator
functionality added in the other PR.It relies on
zip_iterator
to provide both enumeratingfor (auto [nonzero_index, column, value] : matrix.enumerated()[row])
and non-enumeratingfor (auto [column, value] : matrix[row])
iteration through a matrix, and uses pairs of pointers to represent ranges of column indices or values.The two commits add the baseline first and C++17 structured binding support second.
TODO
zip_iterator
to be used on the device #1604