-
Notifications
You must be signed in to change notification settings - Fork 104
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
Reshape method #1760
base: develop
Are you sure you want to change the base?
Reshape method #1760
Conversation
* to correspond to the matrix entry in the row, r, | ||
* column, c, of matrix, e. Below we describe the two |
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 not sure what the right way to put commas here is, it feels a bit awkward to have so many commas so close together.
// make_permuted_layout takes the number of entries in each dimension and a | ||
// templated array indicating index arguments with slowest to fastest stride. |
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.
Should this just be an array? Do you mean to say that any array-like class can be used or that it has to be a std::array but the types stored in the array can vary but have to be convertible to integers, or something else?
// RAJA::Layout objects may be templated on dimension, argument type, and | ||
// index with unit stride. Here, the column index has unit stride (argument 2). |
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.
Can you supply the permutation at compile time, via camp::list or std::index_sequence, and have it produce a view with the right unit stride index?
// | ||
// _permutedlayout_permviews_start | ||
#if 0 | ||
std::array<RAJA::idx_t, 3> perm2 {{0, 1, 2}}; |
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.
Isn't perm 2 the same as perm 1?
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.
hey.. .thats right. Sorry this was just a scratch pad to prototype the reshape methods. I can give a 2 mins overview at the meeting on the general direction I was going.
Cview(e, 0, 0) = Aview(e, 0, 0) * Bview(e, 0, 0) | ||
+ Aview(e, 0, 1) * Bview(e, 1, 0) | ||
+ Aview(e, 0, 2) * Bview(e, 2, 0); |
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 spacing does not spark joy.
{ | ||
constexpr int N = sizeof...(Ts); |
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.
spacing
///Should be a away to do this at compile time... | ||
std::array<RAJA::idx_t, N> reverse_indices_array; | ||
for(int i = N-1, j=0; i>-1; --i, j++) {reverse_indices_array[j] = i; } |
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.
Make an array of {s...}
and an integer_sequence of 0...(N-1)
, pass them into a function, and then you'll have all the information you need to do the re-indexing.
static auto get(T *ptr, Ts... s) | ||
{ | ||
constexpr int N = sizeof...(Ts); | ||
return RAJA::View<T, RAJA::Layout<N, RAJA::Index_type, N-1>>(ptr, s...); |
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.
Can you add an alias for the view_type?
struct layout_left{}; | ||
struct layout_right{}; | ||
|
||
template<typename LAYOUT> |
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.
Can we add a specialization for a generic index sequence like std::index_sequence?
Summary
This PR adds helper methods to views to create Reshape methods with compile time options C and Fortran style indexing