From 1aaf075105f5bb67e2806b71cbb3be9482630e8c Mon Sep 17 00:00:00 2001 From: James Brodman Date: Tue, 25 Feb 2020 11:04:48 -0500 Subject: [PATCH 1/2] Change which constructor is gated for devices Signed-off-by: James Brodman --- sycl/include/CL/sycl/multi_ptr.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sycl/include/CL/sycl/multi_ptr.hpp b/sycl/include/CL/sycl/multi_ptr.hpp index 808d165e868d1..80db7d11845e0 100644 --- a/sycl/include/CL/sycl/multi_ptr.hpp +++ b/sycl/include/CL/sycl/multi_ptr.hpp @@ -44,13 +44,15 @@ template class multi_ptr { multi_ptr() : m_Pointer(nullptr) {} multi_ptr(const multi_ptr &rhs) = default; multi_ptr(multi_ptr &&) = default; - multi_ptr(pointer_t pointer) : m_Pointer(pointer) {} #ifdef __SYCL_DEVICE_ONLY__ + multi_ptr(pointer_t pointer) : m_Pointer(pointer) {} +#endif + multi_ptr(ElementType *pointer) : m_Pointer((pointer_t)(pointer)) { // TODO An implementation should reject an argument if the deduced // address space is not compatible with Space. } -#endif + multi_ptr(std::nullptr_t) : m_Pointer(nullptr) {} ~multi_ptr() = default; From eac199075331a48a32c8e9b17c06874b2b79fc49 Mon Sep 17 00:00:00 2001 From: James Brodman Date: Wed, 26 Feb 2020 10:12:52 -0500 Subject: [PATCH 2/2] Also apply change to operator= Signed-off-by: James Brodman --- sycl/include/CL/sycl/multi_ptr.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sycl/include/CL/sycl/multi_ptr.hpp b/sycl/include/CL/sycl/multi_ptr.hpp index 80db7d11845e0..89ad90dc027b5 100644 --- a/sycl/include/CL/sycl/multi_ptr.hpp +++ b/sycl/include/CL/sycl/multi_ptr.hpp @@ -59,18 +59,21 @@ template class multi_ptr { // Assignment and access operators multi_ptr &operator=(const multi_ptr &) = default; multi_ptr &operator=(multi_ptr &&) = default; + +#ifdef __SYCL_DEVICE_ONLY__ multi_ptr &operator=(pointer_t pointer) { m_Pointer = pointer; return *this; } -#ifdef __SYCL_DEVICE_ONLY__ +#endif + multi_ptr &operator=(ElementType *pointer) { // TODO An implementation should reject an argument if the deduced // address space is not compatible with Space. m_Pointer = (pointer_t)pointer; return *this; } -#endif + multi_ptr &operator=(std::nullptr_t) { m_Pointer = nullptr; return *this;