From 522c36af058ed894fce63798376283b2b9054393 Mon Sep 17 00:00:00 2001 From: Vyacheslav N Klochkov Date: Thu, 28 Jan 2021 13:32:32 -0800 Subject: [PATCH] [SYCL] Remove handler::copy() support of atomic accessors. Accessors with atomic access mode were supported in handler::copy() by mistake in the patch (#1551). Signed-off-by: Vyacheslav N Klochkov --- sycl/include/CL/sycl/handler.hpp | 62 ++------------------------------ 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index e5b434eaa6441..85621df80445c 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -10,7 +10,6 @@ #include #include -#include #include #include #include @@ -533,7 +532,6 @@ class __SYCL_EXPORT handler { /// /// \param Src is a source SYCL accessor. /// \param Dst is a destination SYCL accessor. - // TODO: support atomic accessor in Src or/and Dst. template - static detail::enable_if_t - readFromFirstAccElement(accessor Src) { -#ifdef __ENABLE_USM_ADDR_SPACE__ - atomic AtomicSrc = Src; -#else - atomic AtomicSrc = Src; -#endif // __ENABLE_USM_ADDR_SPACE__ - return AtomicSrc.load(); - } - - template - static detail::enable_if_t<(Dim > 0) && Mode == access::mode::atomic, T> - readFromFirstAccElement(accessor Src) { - id Id = getDelinearizedIndex(Src.get_range(), 0); - return Src[Id].load(); - } - - template - static detail::enable_if_t - readFromFirstAccElement(accessor Src) { - return *(Src.get_pointer()); - } - - template - static detail::enable_if_t - writeToFirstAccElement(accessor Dst, T V) { -#ifdef __ENABLE_USM_ADDR_SPACE__ - atomic AtomicDst = Dst; -#else - atomic AtomicDst = Dst; -#endif // __ENABLE_USM_ADDR_SPACE__ - AtomicDst.store(V); - } - - template - static detail::enable_if_t<(Dim > 0) && Mode == access::mode::atomic, void> - writeToFirstAccElement(accessor Dst, T V) { - id Id = getDelinearizedIndex(Dst.get_range(), 0); - Dst[Id].store(V); - } - - template - static detail::enable_if_t - writeToFirstAccElement(accessor Dst, T V) { - *(Dst.get_pointer()) = V; - } - /// Handles some special cases of the copy operation from one accessor /// to another accessor. Returns true if the copy is handled here. /// @@ -632,7 +576,7 @@ class __SYCL_EXPORT handler { single_task> ([=]() { - writeToFirstAccElement(Dst, readFromFirstAccElement(Src)); + *(Dst.get_pointer()) = *(Src.get_pointer()); }); return true; } @@ -670,7 +614,7 @@ class __SYCL_EXPORT handler { single_task> ([=]() { using TSrcNonConst = typename detail::remove_const_t; - *(reinterpret_cast(Dst)) = readFromFirstAccElement(Src); + *(reinterpret_cast(Dst)) = *(Src.get_pointer()); }); } @@ -703,7 +647,7 @@ class __SYCL_EXPORT handler { accessor Dst) { single_task> ([=]() { - writeToFirstAccElement(Dst, *(reinterpret_cast(Src))); + *(Dst.get_pointer()) = *(reinterpret_cast(Src)); }); } #endif // __SYCL_DEVICE_ONLY__