Skip to content

Commit

Permalink
add support for rocm 6, which replaced 'memoryType' with 'type' (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomstitt committed Apr 9, 2024
1 parent 950c5f1 commit 06a09c3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/libs/ascent/runtimes/expressions/ascent_memory_manager.cpp
Expand Up @@ -11,6 +11,14 @@
#include <cstring> // memcpy
#include <conduit.hpp>

#if defined(ASCENT_HIP_ENABLED)
#if HIP_VERSION_MAJOR >= 6
#define TYPE_ATTR type
#else
#define TYPE_ATTR memoryType
#endif
#endif

namespace ascent
{

Expand Down Expand Up @@ -182,7 +190,7 @@ AllocationManager::set_device_allocator_id(int id)
{
can_use = true;
}

if(!can_use)
{
return false;
Expand Down Expand Up @@ -379,11 +387,11 @@ DeviceMemory::is_device_ptr(const void *ptr, bool &is_gpu, bool &is_unified)
// not pick it up
hipError_t error = hipGetLastError();
is_gpu = (perr == hipSuccess) &&
(atts.memoryType == hipMemoryTypeDevice ||
atts.memoryType == hipMemoryTypeUnified );
(atts.TYPE_ATTR == hipMemoryTypeDevice ||
atts.TYPE_ATTR == hipMemoryTypeUnified );
// CYRUSH: this doens't look right:
is_unified = (hipSuccess && atts.memoryType == hipMemoryTypeDevice);
#endif
is_unified = (hipSuccess && atts.TYPE_ATTR == hipMemoryTypeDevice);
#endif
}

//-----------------------------------------------------------------------------
Expand All @@ -409,8 +417,8 @@ DeviceMemory::is_device_ptr(const void *ptr)
// not pick it up
hipError_t error = hipGetLastError();
return perr == hipSuccess &&
(atts.memoryType == hipMemoryTypeDevice ||
atts.memoryType == hipMemoryTypeUnified);
(atts.TYPE_ATTR == hipMemoryTypeDevice ||
atts.TYPE_ATTR == hipMemoryTypeUnified);
#else
(void) ptr;
return false;
Expand Down

0 comments on commit 06a09c3

Please sign in to comment.