You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function hypre_GetPointerLocation in src/utilities/memory.c behaves differently on CUDA and HIP builds.
The functions cudaPointerGetAttributes and hipPointerGetAttributes are unreliable at identifying host pointers that weren't obtained from the CUDA/HIP host allocators respectively. For CUDA builds there are these lines in the above mentioned function:
if (attr.type == cudaMemoryTypeUnregistered)
{
*memory_location = hypre_MEMORY_HOST;
}
A similar set of lines should be present for HIP builds, but are not.
Both CUDA and HIP builds will return hypre_MEMORY_HOST in the event of an error. However, given an arbitrary host pointer hipPointerGetAttributes will typically not error. Instead it will return a location of unregistered, and then hypre_GetPointerLocation will return hypre_MEMORY_UNDEFINED instead of hypre_MEMORY_HOST.
On debug builds with HIP this can result in a failed assertion in hypre_CheckMemoryLocation. I observed the following sequence of events recently:
Called HYPRE_IJVectorAssemble
That called hypre_IJVectorAssembleParDevice
That called hypre_AuxParVectorDestroy(aux_vector)
That deallocates the data fields inside the aux_vector struct correctly by specifying HYPRE_MEMORY_DEVICE
Deallocating the struct itself fails since it is of course on host, and the above assertion fails when hypre_GetPointerLocation can not figure out that the struct is indeed on host.
The text was updated successfully, but these errors were encountered:
The function
hypre_GetPointerLocation
insrc/utilities/memory.c
behaves differently on CUDA and HIP builds.The functions
cudaPointerGetAttributes
andhipPointerGetAttributes
are unreliable at identifying host pointers that weren't obtained from the CUDA/HIP host allocators respectively. For CUDA builds there are these lines in the above mentioned function:A similar set of lines should be present for HIP builds, but are not.
Both CUDA and HIP builds will return
hypre_MEMORY_HOST
in the event of an error. However, given an arbitrary host pointerhipPointerGetAttributes
will typically not error. Instead it will return a location of unregistered, and thenhypre_GetPointerLocation
will returnhypre_MEMORY_UNDEFINED
instead ofhypre_MEMORY_HOST
.On debug builds with HIP this can result in a failed assertion in
hypre_CheckMemoryLocation
. I observed the following sequence of events recently:HYPRE_IJVectorAssemble
hypre_IJVectorAssembleParDevice
hypre_AuxParVectorDestroy(aux_vector)
aux_vector
struct correctly by specifyingHYPRE_MEMORY_DEVICE
hypre_GetPointerLocation
can not figure out that the struct is indeed on host.The text was updated successfully, but these errors were encountered: