Skip to content

[SYCL] Fix buffer constructor using iterators #1386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions sycl/include/CL/sycl/detail/buffer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ class buffer_impl final : public SYCLMemObjT {
unique_ptr_class<SYCLMemObjAllocator> 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 <typename T>
Expand Down
10 changes: 3 additions & 7 deletions sycl/test/basic_tests/buffer/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 destruction of the buffer created
// from a pair of non-const iterators
for (int i = 0; i < 10; i++)
assert(data1[i] == -1);
}

Expand Down