Skip to content

Commit 2a751bd

Browse files
authored
[SYCL] Merge two set_final_data methods into one (#3140)
Signed-off-by: mdimakov <maxim.dimakov@intel.com>
1 parent 5b49cd3 commit 2a751bd

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,7 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
5252

5353
template <typename T>
5454
using EnableIfOutputIteratorT = enable_if_t<
55-
/*is_output_iterator<T>::value &&*/ !std::is_pointer<T>::value &&
56-
!std::is_same<typename T::value_type, bool>::value>;
57-
58-
template <typename T>
59-
using EnableIfOutputIteratorBool =
60-
enable_if_t<!std::is_pointer<T>::value &&
61-
std::is_same<typename T::value_type, bool>::value>;
55+
/*is_output_iterator<T>::value &&*/ !std::is_pointer<T>::value>;
6256

6357
template <typename T>
6458
using EnableIfDefaultAllocator =
@@ -184,23 +178,8 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
184178
// ContiguousStorage. updateHostMemory works only with pointer to
185179
// continuous data.
186180
const size_t Size = MSizeInBytes / sizeof(DestinationValueT);
187-
vector_class<DestinationValueT> ContiguousStorage(Size);
188-
updateHostMemory(ContiguousStorage.data());
189-
std::copy(ContiguousStorage.cbegin(), ContiguousStorage.cend(),
190-
FinalData);
191-
};
192-
}
193-
194-
template <typename Destination>
195-
__SYCL_DLL_LOCAL EnableIfOutputIteratorBool<Destination>
196-
set_final_data(Destination FinalData) {
197-
MUploadDataFunctor = [this, FinalData]() {
198-
using DestinationValueT = iterator_value_type_t<Destination>;
199-
// TODO if Destination is ContiguousIterator then don't create
200-
// ContiguousStorage. updateHostMemory works only with pointer to
201-
// continuous data.
202-
const size_t Size = MSizeInBytes / sizeof(DestinationValueT);
203-
std::unique_ptr<bool[]> ContiguousStorage(new bool[Size]);
181+
std::unique_ptr<DestinationValueT[]> ContiguousStorage(
182+
new DestinationValueT[Size]);
204183
updateHostMemory(ContiguousStorage.get());
205184
std::copy(ContiguousStorage.get(), ContiguousStorage.get() + Size,
206185
FinalData);

0 commit comments

Comments
 (0)