From a80c5c5544579b3e56c8349d544ae125996fec46 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 4 Nov 2026 23:27:06 -0800 Subject: [PATCH 1/3] Pass depends to the _place call in dpnp.tensor.place place() casts vals to the array's data type with dpt.astype, which is asynchronous, and then called ti._place without depends, so the kernel could read the cast buffer before the cast finished. --- CHANGELOG.md | 1 + dpnp/tensor/_indexing_functions.py | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 612b04ceac3..3d0ebbff9c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed `flags[key]` of `dpnp.ndarray` and `dpnp.tensor.usm_ndarray` to raise `KeyError` for an unknown key [#3141](https://github.com/IntelPython/dpnp/pull/3141) * Released the GIL around the oneMKL VM calls in the VM extension, which deadlocked on an in-order queue of a CPU device [#3156](https://github.com/IntelPython/dpnp/pull/3156) +* Fixed `dpnp.place` and `dpnp.tensor.place` to wait for the cast of `vals` to the array's data type before writing, which could put wrong values into the array on an out-of-order queue [#XXXX](https://github.com/IntelPython/dpnp/pull/XXXX) ### Security diff --git a/dpnp/tensor/_indexing_functions.py b/dpnp/tensor/_indexing_functions.py index dc81ba54ce6..c7b35f12077 100644 --- a/dpnp/tensor/_indexing_functions.py +++ b/dpnp/tensor/_indexing_functions.py @@ -192,6 +192,7 @@ def place(arr, mask, vals): axis_end=mask.ndim, rhs=rhs, sycl_queue=exec_q, + depends=_manager.submitted_events, ) _manager.add_event_pair(hev, pl_ev) From ef842c09cb9c4bac230d823793c5d37c1b190747 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 4 Nov 2026 23:27:24 -0800 Subject: [PATCH 2/3] Add PR number to the changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d0ebbff9c7..07b3bf4f4dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed `flags[key]` of `dpnp.ndarray` and `dpnp.tensor.usm_ndarray` to raise `KeyError` for an unknown key [#3141](https://github.com/IntelPython/dpnp/pull/3141) * Released the GIL around the oneMKL VM calls in the VM extension, which deadlocked on an in-order queue of a CPU device [#3156](https://github.com/IntelPython/dpnp/pull/3156) -* Fixed `dpnp.place` and `dpnp.tensor.place` to wait for the cast of `vals` to the array's data type before writing, which could put wrong values into the array on an out-of-order queue [#XXXX](https://github.com/IntelPython/dpnp/pull/XXXX) +* Fixed `dpnp.place` and `dpnp.tensor.place` to wait for the cast of `vals` to the array's data type before writing, which could put wrong values into the array on an out-of-order queue [#3164](https://github.com/IntelPython/dpnp/pull/3164) ### Security From aa09cc6ef615268394b60ee11542fb05d28c18c7 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Thu, 5 Nov 2026 06:25:58 -0800 Subject: [PATCH 3/3] Reword the place changelog entry to describe event ordering --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07b3bf4f4dd..734643223c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed `flags[key]` of `dpnp.ndarray` and `dpnp.tensor.usm_ndarray` to raise `KeyError` for an unknown key [#3141](https://github.com/IntelPython/dpnp/pull/3141) * Released the GIL around the oneMKL VM calls in the VM extension, which deadlocked on an in-order queue of a CPU device [#3156](https://github.com/IntelPython/dpnp/pull/3156) -* Fixed `dpnp.place` and `dpnp.tensor.place` to wait for the cast of `vals` to the array's data type before writing, which could put wrong values into the array on an out-of-order queue [#3164](https://github.com/IntelPython/dpnp/pull/3164) +* Fixed `dpnp.place` and `dpnp.tensor.place` to order the write after the cast of `vals` to the array's data type, which could put wrong values into the array on an out-of-order queue [#3164](https://github.com/IntelPython/dpnp/pull/3164) ### Security