diff --git a/projects/hip-tests/catch/include/resource_guards.hh b/projects/hip-tests/catch/include/resource_guards.hh index c2f0864d1ba..d658936cc7f 100644 --- a/projects/hip-tests/catch/include/resource_guards.hh +++ b/projects/hip-tests/catch/include/resource_guards.hh @@ -49,6 +49,18 @@ inline std::string to_string(const LinearAllocs allocation_type) { } } +inline bool deviceSupportsManagedMemory(int device) { + int supportsManagedMem = 0; + HIP_CHECK(hipDeviceGetAttribute(&supportsManagedMem, hipDeviceAttributeManagedMemory, device)); + return supportsManagedMem; +} + +inline bool deviceSupportsConcurrentManagedMemory(int device) { + hipDeviceProp_t prop; + HIP_CHECK(hipGetDeviceProperties(&prop, device)); + return prop.concurrentManagedAccess && prop.managedMemory; +} + template class LinearAllocGuard { public: LinearAllocGuard() = default; diff --git a/projects/hip-tests/catch/unit/atomics/arithmetic_common.hh b/projects/hip-tests/catch/unit/atomics/arithmetic_common.hh index 2b4db75dd8c..c483b59dc74 100644 --- a/projects/hip-tests/catch/unit/atomics/arithmetic_common.hh +++ b/projects/hip-tests/catch/unit/atomics/arithmetic_common.hh @@ -523,8 +523,11 @@ void SingleDeviceSingleKernelTest(const unsigned int width, const unsigned int p for (const auto alloc_type : {LA::hipMalloc}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - TestCore(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + TestCore(params); + } } } } @@ -560,8 +563,11 @@ void SingleDeviceMultipleKernelTest(const unsigned int kernel_count, const unsig for (const auto alloc_type : {LA::hipMalloc}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - TestCore(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + TestCore(params); + } } } } @@ -617,8 +623,11 @@ void MultipleDeviceMultipleKernelAndHostTest(const unsigned int num_devices, using LA = LinearAllocs; for (const auto alloc_type : {LA::hipMalloc}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - TestCore(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsConcurrentManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + TestCore(params); + } } } } diff --git a/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh b/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh index ba3105de632..ba434d1e973 100644 --- a/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh +++ b/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh @@ -162,7 +162,10 @@ template void AtomicExchSameAddressTest( using LA = LinearAllocs; const auto allocation_type = GENERATE(LA::hipMalloc, LA::hipHostMalloc, LA::hipMallocManaged, LA::mallocAndRegister); - AtomicExchSameAddress(blocks, threads, allocation_type); + if (allocation_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + AtomicExchSameAddress(blocks, threads, + allocation_type); + } } SECTION("Shared memory") { @@ -340,8 +343,11 @@ void AtomicExchSingleDeviceSingleKernelTest(const unsigned int width, const unsi for (const auto alloc_type : {LA::hipMalloc, LA::hipHostMalloc, LA::hipMallocManaged}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - AtomicExch().run(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + AtomicExch().run(params); + } } } } @@ -375,8 +381,11 @@ void AtomicExchSingleDeviceMultipleKernelTest(const unsigned int kernel_count, for (const auto alloc_type : {LA::hipMalloc, LA::hipHostMalloc, LA::hipMallocManaged}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - AtomicExch().run(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + AtomicExch().run(params); + } } } } @@ -431,8 +440,11 @@ void AtomicExchMultipleDeviceMultipleKernelAndHostTest(const unsigned int num_de using LA = LinearAllocs; for (const auto alloc_type : {LA::hipHostMalloc , LA::hipMallocManaged}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - AtomicExch().run(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsConcurrentManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + AtomicExch().run(params); + } } } } diff --git a/projects/hip-tests/catch/unit/atomics/min_max_common.hh b/projects/hip-tests/catch/unit/atomics/min_max_common.hh index 1f6d180f83e..398a9ea7169 100644 --- a/projects/hip-tests/catch/unit/atomics/min_max_common.hh +++ b/projects/hip-tests/catch/unit/atomics/min_max_common.hh @@ -369,8 +369,11 @@ void SingleDeviceSingleKernelTest(const unsigned int width, const unsigned int p for (const auto alloc_type : {LA::hipMalloc}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - TestCore(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + TestCore(params); + } } } } @@ -405,8 +408,12 @@ void SingleDeviceMultipleKernelTest(const unsigned int kernel_count, const unsig for (const auto alloc_type : {LA::hipMalloc}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - TestCore(params); + + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + TestCore(params); + } } } } @@ -459,8 +466,11 @@ void MultipleDeviceMultipleKernelTest(const unsigned int num_devices, // Here LA::hipHostMalloc means to allocate coherent host pined buffer for (const auto alloc_type : {LA::hipHostMalloc}) { params.alloc_type = alloc_type; - DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { - TestCore(params); + + if (params.alloc_type != LA::hipMallocManaged || deviceSupportsManagedMemory(0)) { + DYNAMIC_SECTION("Allocation type: " << to_string(alloc_type)) { + TestCore(params); + } } } }