Skip to content

Commit d0dcc89

Browse files
committed
[oneDPL][ranges][merge] + fix with idx usage in __get_value(size_t idx = 0)
1 parent 3583a99 commit d0dcc89

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_utils.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -672,20 +672,20 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
672672
_T
673673
__get_value(size_t idx = 0) const
674674
{
675-
assert(__result_n == 1);
675+
assert(idx < __result_n);
676676
if (__use_USM_host && __supports_USM_device)
677677
{
678-
return *(__result_buf.get());
678+
return *(__result_buf.get() + idx);
679679
}
680680
else if (__supports_USM_device)
681681
{
682682
_T __tmp;
683-
__exec.queue().memcpy(&__tmp, __scratch_buf.get() + __scratch_n, 1 * sizeof(_T)).wait();
683+
__exec.queue().memcpy(&__tmp, __scratch_buf.get() + __scratch_n + idx, 1 * sizeof(_T)).wait();
684684
return __tmp;
685685
}
686686
else
687687
{
688-
return __sycl_buf->get_host_access(sycl::read_only)[__scratch_n];
688+
return __sycl_buf->get_host_access(sycl::read_only)[__scratch_n + idx];
689689
}
690690
}
691691

0 commit comments

Comments
 (0)