Skip to content

Commit

Permalink
Ensure all work is complete on device before freeing memory. (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-rowe authored Nov 30, 2023
1 parent b0c3227 commit 5285d7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/occa/internal/modes/dpcpp/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ namespace occa {
buffer::~buffer() {
if (!isWrapped && ptr) {
auto& dpcpp_device = getDpcppDevice(modeDevice);
// Unlike CUDA and HIP, freeing memory in SYCL is not
// synchronous across all streams.
dpcpp_device.finishAll();
OCCA_DPCPP_ERROR("Memory: Freeing SYCL alloc'd memory",
::sycl::free(ptr,dpcpp_device.dpcppContext));
}
ptr = nullptr;
size = 0;
}

void buffer::malloc(udim_t bytes) {
Expand Down

0 comments on commit 5285d7b

Please sign in to comment.