Skip to content

Commit

Permalink
Merge pull request openucx#8 from ROCmSoftwarePlatform/rocm_managed_t…
Browse files Browse the repository at this point in the history
…est_fix

Fixed is_rocm_managed_supported
  • Loading branch information
akolliasAMD authored May 17, 2022
2 parents 2092e08 + 96b2df4 commit 258af5f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/gtest/common/mem_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,25 @@ bool mem_buffer::is_rocm_managed_supported()
{
#if HAVE_ROCM
int device_id, has_managed_mem;
return ((hipGetDevice(&device_id) == hipSuccess) &&
hipError_t ret;
void * dptr;
hipPointerAttribute_t attr;
if ((hipGetDevice(&device_id) == hipSuccess) &&
(hipDeviceGetAttribute(&has_managed_mem,
hipDeviceAttributeManagedMemory,
device_id) == hipSuccess) &&
has_managed_mem);
has_managed_mem) {
ret = hipMallocManaged(&dptr, 64);
if (ret == hipSuccess) {
ret = hipPointerGetAttributes(&attr, dptr);
if (ret == hipSuccess) {
hipFree(dptr);
if (attr.memoryType == hipMemoryTypeUnified)
return true;
}
}
}
return false;
#else
return false;
#endif
Expand Down

0 comments on commit 258af5f

Please sign in to comment.