From ac2869ccd9a9eccba53280999e03d2b33a836330 Mon Sep 17 00:00:00 2001 From: Byoungro So Date: Sat, 7 Mar 2020 15:30:49 -0800 Subject: [PATCH 1/3] [SYCL] Fix buffer contructor from iterators Signed-off-by: Byoungro So --- sycl/include/CL/sycl/detail/buffer_impl.hpp | 2 +- sycl/test/basic_tests/buffer/buffer.cpp | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sycl/include/CL/sycl/detail/buffer_impl.hpp b/sycl/include/CL/sycl/detail/buffer_impl.hpp index f9c06b96709eb..393b5a0dc244a 100644 --- a/sycl/include/CL/sycl/detail/buffer_impl.hpp +++ b/sycl/include/CL/sycl/detail/buffer_impl.hpp @@ -85,7 +85,7 @@ class buffer_impl final : public SYCLMemObjT { // using this c'tor, another section says that the data will be // copied back if iterators passed are not const ( 4.7.2.3 Buffer // Synchronization Rules and this constructor description) - BaseT::set_final_data(First); + //BaseT::set_final_data(First); } template diff --git a/sycl/test/basic_tests/buffer/buffer.cpp b/sycl/test/basic_tests/buffer/buffer.cpp index 2521a20c85358..21f7f83ddd826 100644 --- a/sycl/test/basic_tests/buffer/buffer.cpp +++ b/sycl/test/basic_tests/buffer/buffer.cpp @@ -434,13 +434,9 @@ int main() { range<1>{3}, [=](id<1> index) { B[index] = 20; }); }); } - // Data is copied back in the desctruction of the buffer created from - // pair of non-const iterators - for (int i = 0; i < 2; i++) - assert(data1[i] == -1); - for (int i = 2; i < 5; i++) - assert(data1[i] == 20); - for (int i = 5; i < 10; i++) + // Data is not copied back in the desctruction of the buffer created + // from a pair of non-const iterators + for (int i = 0; i < 10; i++) assert(data1[i] == -1); } From a556edc5e1cc37a81e2380153c99a3f03b328385 Mon Sep 17 00:00:00 2001 From: Byoungro So Date: Sat, 7 Mar 2020 15:40:28 -0800 Subject: [PATCH 2/3] cleaned up the code Signed-off-by: Byoungro So --- sycl/include/CL/sycl/detail/buffer_impl.hpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sycl/include/CL/sycl/detail/buffer_impl.hpp b/sycl/include/CL/sycl/detail/buffer_impl.hpp index 393b5a0dc244a..e1a7e5e5be324 100644 --- a/sycl/include/CL/sycl/detail/buffer_impl.hpp +++ b/sycl/include/CL/sycl/detail/buffer_impl.hpp @@ -80,12 +80,6 @@ class buffer_impl final : public SYCLMemObjT { unique_ptr_class Allocator) : BaseT(SizeInBytes, Props, std::move(Allocator)) { BaseT::handleHostData(First, Last, RequiredAlign); - // TODO: There is contradiction in the spec, in one place it says - // the data is not copied back at all if the buffer is construted - // using this c'tor, another section says that the data will be - // copied back if iterators passed are not const ( 4.7.2.3 Buffer - // Synchronization Rules and this constructor description) - //BaseT::set_final_data(First); } template From 890011b0bafc96065133ad556fe3603c8e3d909a Mon Sep 17 00:00:00 2001 From: Byoungro So Date: Tue, 24 Mar 2020 20:02:01 -0700 Subject: [PATCH 3/3] Update sycl/test/basic_tests/buffer/buffer.cpp Co-Authored-By: Ronan Keryell Signed-off-by: Byoungro So --- sycl/test/basic_tests/buffer/buffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test/basic_tests/buffer/buffer.cpp b/sycl/test/basic_tests/buffer/buffer.cpp index 21f7f83ddd826..abb74059a104a 100644 --- a/sycl/test/basic_tests/buffer/buffer.cpp +++ b/sycl/test/basic_tests/buffer/buffer.cpp @@ -434,7 +434,7 @@ int main() { range<1>{3}, [=](id<1> index) { B[index] = 20; }); }); } - // Data is not copied back in the desctruction of the buffer created + // Data is not copied back in the destruction of the buffer created // from a pair of non-const iterators for (int i = 0; i < 10; i++) assert(data1[i] == -1);