From 06a09c3ebdbb4711c5fa5e3b7f345adaa26b96f8 Mon Sep 17 00:00:00 2001 From: Tom Stitt Date: Tue, 9 Apr 2024 11:33:45 -0700 Subject: [PATCH] add support for rocm 6, which replaced 'memoryType' with 'type' (#1269) --- .../expressions/ascent_memory_manager.cpp | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/libs/ascent/runtimes/expressions/ascent_memory_manager.cpp b/src/libs/ascent/runtimes/expressions/ascent_memory_manager.cpp index c15e4d90b..aa988e1d0 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_memory_manager.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_memory_manager.cpp @@ -11,6 +11,14 @@ #include // memcpy #include +#if defined(ASCENT_HIP_ENABLED) +#if HIP_VERSION_MAJOR >= 6 +#define TYPE_ATTR type +#else +#define TYPE_ATTR memoryType +#endif +#endif + namespace ascent { @@ -182,7 +190,7 @@ AllocationManager::set_device_allocator_id(int id) { can_use = true; } - + if(!can_use) { return false; @@ -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 } //----------------------------------------------------------------------------- @@ -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;