-
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
Fix allocating large Views #4907
Fix allocating large Views #4907
Conversation
@masterleinad is this ready or still draft? ah i see, the test is missing |
I just need to add a test and make sure it works on all backends. Otherwise, it's ready from my side. |
Hi @masterleinad! |
It's probably a good idea. |
Should this potentially get cherry picked for 3.6 as well? |
In operator() and other spots with nested expressions, I think the casts may need to be applied pretty much ubiquitously, since otherwise subexpressions may overflow before reaching the cast |
Thinking about it, we should discuss this. I'm pretty sure that the type for the variables was chosen here due to performance implications which might matter more for View access than calling |
I marked this as ready for review and would consider making the discussion about the call operator separate. |
core/unit_test/TestViewAPI_e.hpp
Outdated
KOKKOS_FUNCTION void operator()(int) const { | ||
size_t idx = v.extent(0) - 1; | ||
auto& lhs = v(idx, idx, idx, idx, idx, idx, idx, idx); | ||
lhs = 0; // This is where it segfaulted |
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.
Could this assign a non-zero value foo
, and then assert on the host that v.access(idx, ...) == foo
? As written, this is a weak smoke-test that the particular case doesn't happen to crash in our CI environments
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.
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.
Up to you whether to make the test more demanding.
Fixes #4906. For
Kokkos::Views
with dynamic View greater or equal to 3, we use unsigned int astype
for storing the dynamic rank. Hence, we need to explicitly cast tosize_t
in some places where we multiply the ranks and returnsize_t
.Still needs the test.