Skip to content

Commit

Permalink
Wait before freeing USM pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
Rbiessy committed Jul 29, 2024
1 parent 2f59edc commit cd1a71a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/unit_tests/sparse_blas/source/sparse_spmm_usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ int test_spmm(sycl::device *dev, sparse_matrix_format_t format, intType nrows_A,
a_host.data(), reset_nnz, static_cast<std::size_t>(nrows_A));
}
if (reset_nnz > nnz) {
// Wait before freeing usm pointers
ev_spmm.wait_and_throw();
ia_usm_uptr = malloc_device_uptr<intType>(main_queue, ia_host.size());
ja_usm_uptr = malloc_device_uptr<intType>(main_queue, ja_host.size());
a_usm_uptr = malloc_device_uptr<fpType>(main_queue, a_host.size());
Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/sparse_blas/source/sparse_spmv_usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ int test_spmv(sycl::device *dev, sparse_matrix_format_t format, intType nrows_A,
a_host.data(), reset_nnz, static_cast<std::size_t>(nrows_A));
}
if (reset_nnz > nnz) {
// Wait before freeing usm pointers
ev_spmv.wait_and_throw();
ia_usm_uptr = malloc_device_uptr<intType>(main_queue, ia_host.size());
ja_usm_uptr = malloc_device_uptr<intType>(main_queue, ja_host.size());
a_usm_uptr = malloc_device_uptr<fpType>(main_queue, a_host.size());
Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/sparse_blas/source/sparse_spsv_usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ int test_spsv(sycl::device *dev, sparse_matrix_format_t format, intType m, doubl
a_host.data(), reset_nnz, mu);
}
if (reset_nnz > nnz) {
// Wait before freeing usm pointers
ev_spsv.wait_and_throw();
ia_usm_uptr = malloc_device_uptr<intType>(main_queue, ia_host.size());
ja_usm_uptr = malloc_device_uptr<intType>(main_queue, ja_host.size());
a_usm_uptr = malloc_device_uptr<fpType>(main_queue, a_host.size());
Expand Down

0 comments on commit cd1a71a

Please sign in to comment.