-
Notifications
You must be signed in to change notification settings - Fork 407
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
[Feature Request] Subview pattern. #648
Comments
Consider something like
|
I am fine as long as I can reduce subview overehad to a simple pointer swapping. So, the "decltype" is completely portable for everywhere, right ? |
Dimensions of subview remain fixed, only the underlying address changes at each iteration. |
Just regular ping to see how this is going on. In Andrew's implementation of line smoother, this capability would improve performance a bit. |
In the line smoother solve phase, which is O(nnz) and so very sensitive to overhead, using raw pointers instead of subview gives a speedup of 1.2 to 1.5 for block sizes of interest. The solve phase is often the most time consuming by an order of magnitude or more. |
and assigns the data pointer. Proper use case is to update subviews. For example: auto sub_a = subview(a,0,ALL,ALL,ALL); for ( int i = 0 ; i < a.dimension(0) ; ++i ) { sub_a.assign_data( & a(i,0,0,0) ); // now compute on sub_a // previously had to do: // auto sub_a = subview(a,i,ALL,ALL,ALL); // which has large overhead. }
FYI: @ambrad @kyungjoo-kim , this is being tested now to go into the next promotion. |
@ambrad It could be nice to have this feature for sparse matrices, though I think it's most critical for (small dense) block sparse matrices. |
Hello,
I use subview in many places. Subview mechanism is good for keeping consistent API interface. However, it is expensive when subview is used inside of a loop. For instance
I believe that many people have similar situation to this. In this situation, subview adds quite overhead as it creates for each iteration. However, the subview pattern is fixed and we can take advantage of it. What I propose is
Or to ensure subview meta data is consistent, something as follows may be considered:
Kokkos view provides convenience but many people including me may consider to strip out the view when performance matters. This subview mechanism can reduce overhead and still provide luxury of view.
The text was updated successfully, but these errors were encountered: