Skip to content
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

fix: avoid additional array allocation in host to device transfer #2966

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 3 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
12 changes: 2 additions & 10 deletions cpp/oneapi/dal/backend/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ inline sycl::event memcpy_host2usm(sycl::queue& queue,
const event_vector& deps = {}) {
ONEDAL_ASSERT(is_known_usm(queue, dest_usm));

// 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();
memcpy(queue, dest_usm, src_host, size, deps).wait_and_throw();
return {};
}

Expand All @@ -236,11 +232,7 @@ inline sycl::event memcpy_usm2host(sycl::queue& queue,
const event_vector& deps = {}) {
ONEDAL_ASSERT(is_known_usm(queue, src_usm));

// 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);
memcpy(queue, dest_host, src_usm, size, deps).wait_and_throw();
return {};
}

Expand Down
Loading