Skip to content

Commit a6b8010

Browse files
authored
Resolve crash identified in backend implementation of dpnp.choose (#2063)
* Add memory copy to device memory * Keep extra memcopy only for the result array * Add missing memory copy from host to device memory * Applied pre-commit formatting * Updated changelog * Add empty line in changelog * Correct the description of issue in changelog
1 parent b4a1eca commit a6b8010

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ In addition, this release completes implementation of `dpnp.fft` module and adds
122122
* Resolved an issue with failing tests for `dpnp.append` when running on a device without fp64 support [#2034](https://github.com/IntelPython/dpnp/pull/2034)
123123
* Resolved an issue with input array of `usm_ndarray` passed into `dpnp.ix_` [#2047](https://github.com/IntelPython/dpnp/pull/2047)
124124
* Added a workaround to prevent crash in tests on Windows in internal CI/CD (when running on either Lunar Lake or Arrow Lake) [#2062](https://github.com/IntelPython/dpnp/pull/2062)
125+
* Fixed a crash in `dpnp.choose` caused by missing control of releasing temporary allocated device memory [#2063](https://github.com/IntelPython/dpnp/pull/2063)
125126

126127

127128
## [0.15.0] - 05/25/2024

dpnp/backend/kernels/dpnp_krnl_indexing.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ DPCTLSyclEventRef dpnp_choose_c(DPCTLSyclQueueRef q_ref,
6363
DPNPC_ptr_adapter<_DataType1> input1_ptr(q_ref, array1_in, size);
6464
_DataType1 *array_in = input1_ptr.get_ptr();
6565

66-
DPNPC_ptr_adapter<_DataType2 *> choices_ptr(q_ref, choices1, choices_size);
66+
// choices1 is a list of pointers to device memory,
67+
// which is allocating on the host, so memcpy to device memory is required
68+
DPNPC_ptr_adapter<_DataType2 *> choices_ptr(q_ref, choices1, choices_size,
69+
true);
6770
_DataType2 **choices = choices_ptr.get_ptr();
6871

6972
for (size_t i = 0; i < choices_size; ++i) {
@@ -88,6 +91,7 @@ DPCTLSyclEventRef dpnp_choose_c(DPCTLSyclQueueRef q_ref,
8891
};
8992

9093
sycl::event event = q.submit(kernel_func);
94+
choices_ptr.depends_on(event);
9195

9296
event_ref = reinterpret_cast<DPCTLSyclEventRef>(&event);
9397

0 commit comments

Comments
 (0)