From fd8cbca0b756317fb85336f111914eebaa4344a2 Mon Sep 17 00:00:00 2001
From: Andrea Bocci <andrea.bocci@cern.ch>
Date: Tue, 28 Nov 2023 10:00:26 +0100
Subject: [PATCH] ROCm 5.2 and later support asynchronous memory operations

---
 .../alpaka/mem/buf/BufUniformCudaHipRt.hpp    | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/alpaka/mem/buf/BufUniformCudaHipRt.hpp b/include/alpaka/mem/buf/BufUniformCudaHipRt.hpp
index 79340323ff01..72bf00bee75c 100644
--- a/include/alpaka/mem/buf/BufUniformCudaHipRt.hpp
+++ b/include/alpaka/mem/buf/BufUniformCudaHipRt.hpp
@@ -280,8 +280,8 @@ namespace alpaka
 #    endif
 #    if defined(ALPAKA_ACC_GPU_HIP_ENABLED)
             static_assert(
-                !std::is_same_v<TApi, ApiHipRt>,
-                "HIP devices do not support stream-ordered memory buffers.");
+                std::is_same_v<TApi, ApiHipRt> && TApi::version >= BOOST_VERSION_NUMBER(5, 2, 0),
+                "Support for stream-ordered memory buffers requires HIP/ROCm 5.2 or higher.");
 #    endif
             static_assert(
                 TDim::value <= 1,
@@ -317,13 +317,18 @@ namespace alpaka
             }
         };
 
-#    if defined(ALPAKA_ACC_GPU_CUDA_ENABLED)
         //! The CUDA/HIP stream-ordered memory allocation capability trait specialization.
+#    if defined(ALPAKA_ACC_GPU_CUDA_ENABLED)
+        template<typename TApi, typename TDim>
+        struct HasAsyncBufSupport<TDim, DevUniformCudaHipRt<ApiCudaRt>>
+            : std::bool_constant<TApi::version >= BOOST_VERSION_NUMBER(11, 2, 0) && TDim::value <= 1>
+        {
+        };
+#    endif
+#    if defined(ALPAKA_ACC_GPU_HIP_ENABLED)
         template<typename TApi, typename TDim>
-        struct HasAsyncBufSupport<TDim, DevUniformCudaHipRt<TApi>>
-            : std::bool_constant<
-                  std::is_same_v<TApi, ApiCudaRt> && TApi::version >= BOOST_VERSION_NUMBER(11, 2, 0)
-                  && TDim::value <= 1>
+        struct HasAsyncBufSupport<TDim, DevUniformCudaHipRt<ApiHipRt>>
+            : std::bool_constant<TApi::version >= BOOST_VERSION_NUMBER(5, 2, 0) && TDim::value <= 1>
         {
         };
 #    endif