Skip to content
Merged
27 changes: 3 additions & 24 deletions sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {

template <typename T>
using EnableIfOutputIteratorT = enable_if_t<
/*is_output_iterator<T>::value &&*/ !std::is_pointer<T>::value &&
!std::is_same<typename T::value_type, bool>::value>;

template <typename T>
using EnableIfOutputIteratorBool =
enable_if_t<!std::is_pointer<T>::value &&
std::is_same<typename T::value_type, bool>::value>;
/*is_output_iterator<T>::value &&*/ !std::is_pointer<T>::value>;

template <typename T>
using EnableIfDefaultAllocator =
Expand Down Expand Up @@ -184,23 +178,8 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
// ContiguousStorage. updateHostMemory works only with pointer to
// continuous data.
const size_t Size = MSizeInBytes / sizeof(DestinationValueT);
vector_class<DestinationValueT> ContiguousStorage(Size);
updateHostMemory(ContiguousStorage.data());
std::copy(ContiguousStorage.cbegin(), ContiguousStorage.cend(),
FinalData);
};
}

template <typename Destination>
__SYCL_DLL_LOCAL EnableIfOutputIteratorBool<Destination>
set_final_data(Destination FinalData) {
MUploadDataFunctor = [this, FinalData]() {
using DestinationValueT = iterator_value_type_t<Destination>;
// TODO if Destination is ContiguousIterator then don't create
// ContiguousStorage. updateHostMemory works only with pointer to
// continuous data.
const size_t Size = MSizeInBytes / sizeof(DestinationValueT);
std::unique_ptr<bool[]> ContiguousStorage(new bool[Size]);
std::unique_ptr<DestinationValueT[]> ContiguousStorage(
new DestinationValueT[Size]);
updateHostMemory(ContiguousStorage.get());
std::copy(ContiguousStorage.get(), ContiguousStorage.get() + Size,
FinalData);
Expand Down