From f7f8f2497fcb489d96620158c7e983a728c7ef56 Mon Sep 17 00:00:00 2001 From: "Boyarinov, Konstantin" Date: Wed, 9 Oct 2024 06:29:17 -0700 Subject: [PATCH] Extend parallel_reduce named requirements to allow rvalue reduction --- .../named_requirements/algorithms/par_reduce_func.rst | 6 ++++++ .../algorithms/par_reduce_reduction.rst | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_func.rst b/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_func.rst index 8845dfd771..eb144f9c3d 100644 --- a/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_func.rst +++ b/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_func.rst @@ -13,6 +13,10 @@ A type `Func` satisfies `ParallelReduceFunc` if it meets the following requireme **ParallelReduceFunc Requirements: Pseudo-Signature, Semantics** +.. cpp:function:: Value Func::operator()(const Range& range, Value&& x) const + +or + .. cpp:function:: Value Func::operator()(const Range& range, const Value& x) const Accumulates result for a subrange, starting with initial value ``x``. @@ -20,6 +24,8 @@ A type `Func` satisfies `ParallelReduceFunc` if it meets the following requireme ``Value`` type must be the same as a corresponding template parameter for the :doc:`parallel_reduce algorithm <../../algorithms/functions/parallel_reduce_func>` algorithm. + If both variations are provided, the implementation should prefer the first form. + See also: * :doc:`parallel_reduce algorithm <../../algorithms/functions/parallel_reduce_func>` diff --git a/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_reduction.rst b/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_reduction.rst index c65c34c2c9..9ba515b1ff 100644 --- a/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_reduction.rst +++ b/source/elements/oneTBB/source/named_requirements/algorithms/par_reduce_reduction.rst @@ -13,12 +13,18 @@ A type `Reduction` satisfies `ParallelReduceReduction` if it meets the following **ParallelReduceReduction Requirements: Pseudo-Signature, Semantics** +.. cpp:function:: Value Reduction::operator()(Value&& x, Value&& y) const + +or + .. cpp:function:: Value Reduction::operator()(const Value& x, const Value& y) const Combines results ``x`` and ``y``. - ``Value`` type must be the same as a corresponding template parameter for the + ``Value`` type must be the same as a corresponding template parameter for the :doc:`parallel_reduce algorithm <../../algorithms/functions/parallel_reduce_func>` algorithm. + If both variations are provided, the implementation should prefer the first form. + See also: * :doc:`parallel_reduce algorithm <../../algorithms/functions/parallel_reduce_func>`