Skip to content

Commit 06a09c3

Browse files
authored
add support for rocm 6, which replaced 'memoryType' with 'type' (#1269)
1 parent 950c5f1 commit 06a09c3

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/libs/ascent/runtimes/expressions/ascent_memory_manager.cpp

+15-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
#include <cstring> // memcpy
1212
#include <conduit.hpp>
1313

14+
#if defined(ASCENT_HIP_ENABLED)
15+
#if HIP_VERSION_MAJOR >= 6
16+
#define TYPE_ATTR type
17+
#else
18+
#define TYPE_ATTR memoryType
19+
#endif
20+
#endif
21+
1422
namespace ascent
1523
{
1624

@@ -182,7 +190,7 @@ AllocationManager::set_device_allocator_id(int id)
182190
{
183191
can_use = true;
184192
}
185-
193+
186194
if(!can_use)
187195
{
188196
return false;
@@ -379,11 +387,11 @@ DeviceMemory::is_device_ptr(const void *ptr, bool &is_gpu, bool &is_unified)
379387
// not pick it up
380388
hipError_t error = hipGetLastError();
381389
is_gpu = (perr == hipSuccess) &&
382-
(atts.memoryType == hipMemoryTypeDevice ||
383-
atts.memoryType == hipMemoryTypeUnified );
390+
(atts.TYPE_ATTR == hipMemoryTypeDevice ||
391+
atts.TYPE_ATTR == hipMemoryTypeUnified );
384392
// CYRUSH: this doens't look right:
385-
is_unified = (hipSuccess && atts.memoryType == hipMemoryTypeDevice);
386-
#endif
393+
is_unified = (hipSuccess && atts.TYPE_ATTR == hipMemoryTypeDevice);
394+
#endif
387395
}
388396

389397
//-----------------------------------------------------------------------------
@@ -409,8 +417,8 @@ DeviceMemory::is_device_ptr(const void *ptr)
409417
// not pick it up
410418
hipError_t error = hipGetLastError();
411419
return perr == hipSuccess &&
412-
(atts.memoryType == hipMemoryTypeDevice ||
413-
atts.memoryType == hipMemoryTypeUnified);
420+
(atts.TYPE_ATTR == hipMemoryTypeDevice ||
421+
atts.TYPE_ATTR == hipMemoryTypeUnified);
414422
#else
415423
(void) ptr;
416424
return false;

0 commit comments

Comments
 (0)