diff --git a/test/unit/mem/buf/src/BufTest.cpp b/test/unit/mem/buf/src/BufTest.cpp index ee563dcd29d3..8a27d321cbdd 100644 --- a/test/unit/mem/buf/src/BufTest.cpp +++ b/test/unit/mem/buf/src/BufTest.cpp @@ -15,6 +15,58 @@ #include #include +namespace buftest +{ + template + auto allocBuf(TDev dev, TExtent extent) + { + return alpaka::allocBuf(dev, extent); + } + + template + auto allocBuf(alpaka::DevCpu dev, TExtent extent) -> alpaka::BufCpu + { + return alpaka::allocBuf(dev, extent); + } + +#if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) + template + auto allocBuf(alpaka::DevCudaRt dev, TExtent extent) -> alpaka::BufCudaRt + { + return alpaka::allocBuf(dev, extent); + } +#endif +#if defined(ALPAKA_ACC_GPU_HIP_ENABLED) + template + auto allocBuf(alpaka::DevHipRt dev, TExtent extent) -> alpaka::BufHipRt + { + return alpaka::allocBuf(dev, extent); + } +#endif +#if defined(ALPAKA_ACC_SYCL_ENABLED) and defined(ALPAKA_SYCL_ONEAPI_CPU) + template + auto allocBuf(alpaka::DevCpuSycl dev, TExtent extent) -> alpaka::BufCpuSycl + { + return alpaka::allocBuf(dev, extent); + } +#endif +#if defined(ALPAKA_ACC_SYCL_ENABLED) and defined(ALPAKA_SYCL_ONEAPI_GPU) + template + auto allocBuf(alpaka::DevGpuSyclIntel dev, TExtent extent) -> alpaka::BufGpuSyclIntel + { + return alpaka::allocBuf(dev, extent); + } +#endif +#if defined(ALPAKA_ACC_SYCL_ENABLED) && defined(ALPAKA_SYCL_ONEAPI_FPGA) + template + auto allocBuf(alpaka::DevFpgaSyclIntel dev, TExtent extent) -> alpaka::BufFpgaSyclIntel + { + return alpaka::allocBuf(dev, extent); + } +#endif + +} // namespace buftest + template static auto testBufferMutable(alpaka::Vec, alpaka::Idx> const& extent) -> void { @@ -244,13 +296,14 @@ TEMPLATE_LIST_TEST_CASE("memBufMove", "[memBuf]", alpaka::test::TestAccs) using Acc = TestType; using Idx = alpaka::Idx; using Elem = std::size_t; + using DimExtent = alpaka::DimInt<0>; auto const platformHost = alpaka::PlatformCpu{}; auto const devHost = alpaka::getDevByIdx(platformHost, 0); auto const platformAcc = alpaka::Platform{}; auto const dev = alpaka::getDevByIdx(platformAcc, 0); auto queue = alpaka::Queue{dev}; - auto const extent = alpaka::Vec, Idx>{}; + auto const extent = alpaka::Vec{}; auto write = [&](auto& buf, Elem value) { @@ -267,7 +320,7 @@ TEMPLATE_LIST_TEST_CASE("memBufMove", "[memBuf]", alpaka::test::TestAccs) // move constructor { - auto buf1 = alpaka::allocBuf(dev, extent); + auto buf1 = buftest::allocBuf(dev, extent); write(buf1, 1); auto buf2{std::move(buf1)}; CHECK(read(buf2) == 1); @@ -275,8 +328,8 @@ TEMPLATE_LIST_TEST_CASE("memBufMove", "[memBuf]", alpaka::test::TestAccs) // move assignment (via swap) { - auto buf1 = alpaka::allocBuf(dev, extent); - auto buf2 = alpaka::allocBuf(dev, extent); + auto buf1 = buftest::allocBuf(dev, extent); + auto buf2 = buftest::allocBuf(dev, extent); write(buf1, 1); write(buf2, 2); using std::swap;