-
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
views from Kokkos_ScratchSpace should use different alignment #1700
Comments
Sure, Dan is doing it ;-) |
I tried to do a simple replacement of '8' with 'KOKKOS_MEMORY_ALIGNMENT', but that caused a lot more scratch memory to be allocated and crashed our tests. A more involved approach is needed, not sure when I'll have time to debug it. |
Just curious - did the memory increase by more than ((KOKKOS_MEMORY_ALIGNMENT) - (8)) per scratch-view ? Maybe that difference is multiplied by num-threads or something? I guess when the user provides bytes-per-thread to the TeamPolicy, they don't account for alignment padding, nor do they say how many views they will be obtaining into that memory... If this can't be quickly solved, perhaps nalu needs to move on to some other solution. |
One issue is that KOKKOS_MEMORY_ALIGNMENT is probably larger than it needs to be. On GPUs I think it might 128 bytes to align with the cache line. So if you create a lot fo small things this is gonna be costly. What we should do is align by max(8,sizeof(value_type)). |
Also we don't probably need KOKKOS_MEMORY_ALIGNMENT. I bet that the main issue is that SIMD types don't get aligned correctly and cause issues? Is that right? |
Yes the issue is with simd types. |
Ok so I have a fix ready for pull request, which will align each scratch view to sizeof(value_type). That should hopefully make this work. |
Marking this as a bug since it actually needs to be aligned for types which require alignment. |
This link:
https://github.com/kokkos/kokkos/blob/master/core/src/Kokkos_ScratchSpace.hpp#L65
shows that views into Kokkos_ScratchSpace have 8-byte alignment.
We would like to request that this be changed to use KOKKOS_MEMORY_ALIGNMENT for the alignment value.
The text was updated successfully, but these errors were encountered: