- 
                Notifications
    You must be signed in to change notification settings 
- Fork 9
Make compute_strides function a public function #342
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
Make compute_strides function a public function #342
Conversation
        
          
                common/src/KokkosFFT_utils.hpp
              
                Outdated
          
        
      | is_std_array_v<ContainerType>, | ||
| std::nullptr_t> = nullptr> | ||
| auto compute_strides(const ContainerType& extents) { | ||
| using IntType = | 
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 would rename IntType as IndexType
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.
OK
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.
May be called this extents_type?
Following mdspan convention
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 would say no, as I understand it, in MDSpan, Extends is a composite type grouping three different informations:
- Extents::index_type
- Extents::size_type
- Extents::rank_type
Here, Int_Type corresponds only to the index_type. But I may be mistaken?
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.
That is correct
What I intent was indeed index_type
https://en.cppreference.com/w/cpp/container/mdspan/extent.html
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.
Ok, yes, I agree with you, index_type would be an even better name.
        
          
                common/src/KokkosFFT_utils.hpp
              
                Outdated
          
        
      | // (n0, n1, n2) -> (1, n2, n1*n2) | ||
| // (n0, n1) -> (1, n1) | ||
| // (n0) -> (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.
I understood the old
  // (n0, n1, n2) -> (1, n0, n0*n1)
  // (n0, n1) -> (1, n0)
  // (n0) -> (1)
but I can't make sense of this example.
Could you explain what kind of stride you are computing?
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.
You may imagine Views v in LayoutRight.
If we compute the strides from Right (the contiguous dimension) to Left, it would be
- v(n0) -> (1)
- v(n0, n1) -> (1, n1)
- v(n0, n1, n2) -> (1, n2, n2 * n1)
I do not know why it is given in this order though. (As you can see, in cuFFTMp the order is reversed. This makes more sense)
- v(n0) -> (1)
- v(n0, n1) -> (n1, 1)
- v(n0, n1, n2) -> (n2 * n1, n2, 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.
Ok, this is clear, thank you.
Maybe it deserve an explanation in the comment too?
Otherwise it looks good to me.
| Thank you for approval. I will merge this after CI passes | 
This PR aims at moving
compute_stridesunderKokkosFFT::Implnamespace. This function can be used not only for rocFFT but also for cuFFTMp with small differences.