From b89b37f9a3d2db4bf1e9ae82445b3d3b9f305559 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Mon, 26 Feb 2024 10:09:32 -0600 Subject: [PATCH] Boolean reductions allocate int32 temporary as USM-device Closes gh-1563 Allocating the temporary as USM-device ensures that atomic updates are always possible. --- dpctl/tensor/_utility_functions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dpctl/tensor/_utility_functions.py b/dpctl/tensor/_utility_functions.py index 69a1a200df..aab32327f2 100644 --- a/dpctl/tensor/_utility_functions.py +++ b/dpctl/tensor/_utility_functions.py @@ -36,10 +36,13 @@ def _boolean_reduction(x, axis, keepdims, func): res_usm_type = x.usm_type wait_list = [] + # always allocate the temporary as + # int32 and usm-device to ensure that atomic updates + # are supported res_tmp = dpt.empty( res_shape, dtype=dpt.int32, - usm_type=res_usm_type, + usm_type="device", sycl_queue=exec_q, ) hev0, ev0 = func(