Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was running into a case where the call operator for
DynamicView
would deadlock inkokkos/containers/src/Kokkos_DynamicView.hpp
Lines 435 to 438 in 902a50d
resize_parallel
in 768f657.In particular, it's just an error if the chunk pointer we need to access is a
nullptr
. I took the freedom to remove all that logic in 6b7a1a0 to only check if for out-of-bounds errors and not checking the pointer to be anullptr
at all.The origin of the issue was seeing was that the deep copy in
resize_serial
hadn't finished before we were trying to access theView
. Conceivably, this can happen if the access happens on a different execution space instance than the one used for deep copy. In this case, it was the same execution space instance but the deep copy wasn't properly enqueued (also see #5065). Since we are supposed to fence after callingDeepCopy
internally anyway, I didn't bother with adding the workaround there as well.In the end, it was enough to just fence the deep copy operation in
resize_serial
, and to do that I had to provideChunkManager::deep_copy_to
with an execution space instance argument. This also allowed (and enforced) using an execution space instance in a couple of other places usingdeep_copy_to
.