11
11
#include < cstring> // memcpy
12
12
#include < conduit.hpp>
13
13
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
+
14
22
namespace ascent
15
23
{
16
24
@@ -182,7 +190,7 @@ AllocationManager::set_device_allocator_id(int id)
182
190
{
183
191
can_use = true ;
184
192
}
185
-
193
+
186
194
if (!can_use)
187
195
{
188
196
return false ;
@@ -379,11 +387,11 @@ DeviceMemory::is_device_ptr(const void *ptr, bool &is_gpu, bool &is_unified)
379
387
// not pick it up
380
388
hipError_t error = hipGetLastError ();
381
389
is_gpu = (perr == hipSuccess) &&
382
- (atts.memoryType == hipMemoryTypeDevice ||
383
- atts.memoryType == hipMemoryTypeUnified );
390
+ (atts.TYPE_ATTR == hipMemoryTypeDevice ||
391
+ atts.TYPE_ATTR == hipMemoryTypeUnified );
384
392
// 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
387
395
}
388
396
389
397
// -----------------------------------------------------------------------------
@@ -409,8 +417,8 @@ DeviceMemory::is_device_ptr(const void *ptr)
409
417
// not pick it up
410
418
hipError_t error = hipGetLastError ();
411
419
return perr == hipSuccess &&
412
- (atts.memoryType == hipMemoryTypeDevice ||
413
- atts.memoryType == hipMemoryTypeUnified);
420
+ (atts.TYPE_ATTR == hipMemoryTypeDevice ||
421
+ atts.TYPE_ATTR == hipMemoryTypeUnified);
414
422
#else
415
423
(void ) ptr;
416
424
return false ;
0 commit comments