Skip to content

Commit

Permalink
Revert "Fixed copying performance issues (#2375)" (#2390)
Browse files Browse the repository at this point in the history
This reverts commit 2667f07.
  • Loading branch information
KulikovNikita authored May 26, 2023
1 parent d19aeb0 commit a327476
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cpp/oneapi/dal/backend/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ inline sycl::event memcpy(sycl::queue& queue,
std::size_t size,
const event_vector& deps = {}) {
ONEDAL_ASSERT(size > 0);
ONEDAL_ASSERT(is_known_usm(queue, dest));
ONEDAL_ASSERT(is_known_usm(queue, src));
return queue.submit([&](sycl::handler& cgh) {
cgh.depends_on(deps);
cgh.memcpy(dest, src, size);
Expand All @@ -218,7 +220,13 @@ inline sycl::event memcpy_host2usm(sycl::queue& queue,
std::size_t size,
const event_vector& deps = {}) {
ONEDAL_ASSERT(is_known_usm(queue, dest_usm));
return memcpy(queue, dest_usm, src_host, size, deps);

// TODO: Remove additional copy to host usm memory once
// bug in `copy` with the host memory is fixed
auto tmp_usm_host = make_unique_usm_host(queue, size);
memcpy(tmp_usm_host.get(), src_host, size);
memcpy(queue, dest_usm, tmp_usm_host.get(), size, deps).wait_and_throw();
return {};
}

inline sycl::event memcpy_usm2host(sycl::queue& queue,
Expand All @@ -227,7 +235,13 @@ inline sycl::event memcpy_usm2host(sycl::queue& queue,
std::size_t size,
const event_vector& deps = {}) {
ONEDAL_ASSERT(is_known_usm(queue, src_usm));
return memcpy(queue, dest_host, src_usm, size, deps);

// TODO: Remove additional copy to host usm memory once
// bug in `copy` with the host memory is fixed
auto tmp_usm_host = make_unique_usm_host(queue, size);
memcpy(queue, tmp_usm_host.get(), src_usm, size, deps).wait_and_throw();
memcpy(dest_host, tmp_usm_host.get(), size);
return {};
}

template <typename T>
Expand Down

0 comments on commit a327476

Please sign in to comment.