Skip to content

[SYCL] Fix an error in handler::copy, fix mem-leak/SegFault in LIT test #2590

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 1 commit into from
Oct 4, 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
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ class __SYCL_EXPORT handler {
// Make sure data shared_ptr points to is not released until we finish
// work with it.
MSharedPtrStorage.push_back(Dst);
T_Dst *RawDstPtr = Dst.get();
typename shared_ptr_class<T_Dst>::element_type *RawDstPtr = Dst.get();
copy(Src, RawDstPtr);
}

Expand All @@ -1612,7 +1612,7 @@ class __SYCL_EXPORT handler {
// Make sure data shared_ptr points to is not released until we finish
// work with it.
MSharedPtrStorage.push_back(Src);
T_Src *RawSrcPtr = Src.get();
typename shared_ptr_class<T_Src>::element_type *RawSrcPtr = Src.get();
copy(RawSrcPtr, Dst);
}

Expand Down
6 changes: 3 additions & 3 deletions sycl/test/basic_tests/handler/handler_mem_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ template <typename T> void test_copy_acc_ptr() {
template <typename T> void test_copy_shared_ptr_acc() {
const size_t Size = 10;
T Data[Size] = {0};
std::shared_ptr<T> Values(new T[Size]());
std::shared_ptr<T[]> Values(new T[Size]());
for (size_t I = 0; I < Size; ++I) {
Values.get()[I] = I;
}
Expand All @@ -369,7 +369,7 @@ template <typename T> void test_copy_shared_ptr_acc() {
template <typename T> void test_copy_shared_ptr_const_acc() {
constexpr size_t Size = 10;
T Data[Size] = {0};
std::shared_ptr<const T> Values(new T[Size]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
std::shared_ptr<const T[]> Values(new T[Size]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
{
buffer<T, 1> Buffer(Data, range<1>(Size));
queue Queue;
Expand All @@ -390,7 +390,7 @@ template <typename T> void test_copy_acc_shared_ptr() {
for (size_t I = 0; I < Size; ++I) {
Data[I] = I;
}
std::shared_ptr<T> Values(new T[Size]());
std::shared_ptr<T[]> Values(new T[Size]());
{
buffer<T, 1> Buffer(Data, range<1>(Size));
queue Queue;
Expand Down