Skip to content

Commit 8a8ea32

Browse files
authored
[SYCL][NFC] Use regular accessors for USM reductions (#1962)
The patch changes the type of accessors for USM reductions. Placeholder accessors were used previously. Regular accessors are used now. Also, the patch fixes few inaccurate or wrong comment sections. Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent 9d68976 commit 8a8ea32

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed

sycl/include/CL/sycl/handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ class __SYCL_EXPORT handler {
983983
RWAcc);
984984
this->finalize();
985985

986-
// Copy from RWAcc to some temp memory.
986+
// Copy from RWAcc to user's reduction accessor.
987987
handler CopyHandler(QueueCopy, MIsHost);
988988
CopyHandler.saveCodeLoc(MCodeLoc);
989989
#ifndef __SYCL_DEVICE_ONLY__

sycl/include/CL/sycl/intel/reduction.hpp

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,8 @@ reduAuxCGFunc(handler &CGH, const nd_range<Dims> &Range, size_t NWorkItems,
10011001

10021002
/// Creates and returns an object implementing the reduction functionality.
10031003
/// Accepts 3 arguments: the accessor to buffer to where the computed reduction
1004-
/// must be stored \param Acc, identity value \param Identity, and the
1005-
/// binary operation that must be used in the reduction \param Combiner.
1004+
/// must be stored \param Acc, identity value \param Identity, and the binary
1005+
/// operation used in the reduction.
10061006
template <typename T, class BinaryOperation, int Dims, access::mode AccMode,
10071007
access::placeholder IsPH>
10081008
detail::reduction_impl<T, BinaryOperation, Dims, false, AccMode, IsPH>
@@ -1015,8 +1015,7 @@ reduction(accessor<T, Dims, AccMode, access::target::global_buffer, IsPH> &Acc,
10151015

10161016
/// Creates and returns an object implementing the reduction functionality.
10171017
/// Accepts 2 arguments: the accessor to buffer to where the computed reduction
1018-
/// must be stored \param Acc and the binary operation that must be used
1019-
/// in the reduction \param Combiner.
1018+
/// must be stored \param Acc and the binary operation used in the reduction.
10201019
/// The identity value is not passed to this version as it is statically known.
10211020
template <typename T, class BinaryOperation, int Dims, access::mode AccMode,
10221021
access::placeholder IsPH>
@@ -1032,37 +1031,27 @@ reduction(accessor<T, Dims, AccMode, access::target::global_buffer, IsPH> &Acc,
10321031

10331032
/// Creates and returns an object implementing the reduction functionality.
10341033
/// Accepts 3 arguments: the reference to the reduction variable to where
1035-
/// the computed reduction must be stored \param VarRef, identity value
1036-
/// \param Identity, and the binary operation that must be used
1037-
/// in the reduction \param Combiner.
1034+
/// the computed reduction must be stored \param VarPtr, identity value
1035+
/// \param Identity, and the binary operation used in the reduction.
10381036
template <typename T, class BinaryOperation>
1039-
detail::reduction_impl<T, BinaryOperation, 0, true, access::mode::read_write,
1040-
access::placeholder::true_t>
1041-
reduction(T *VarPtr, const T &Identity, BinaryOperation Combiner) {
1042-
// The Combiner argument was needed only to define the BinaryOperation param.
1043-
(void)Combiner;
1037+
detail::reduction_impl<T, BinaryOperation, 0, true, access::mode::read_write>
1038+
reduction(T *VarPtr, const T &Identity, BinaryOperation) {
10441039
return detail::reduction_impl<T, BinaryOperation, 0, true,
1045-
access::mode::read_write,
1046-
access::placeholder::true_t>(VarPtr, Identity);
1040+
access::mode::read_write>(VarPtr, Identity);
10471041
}
10481042

10491043
/// Creates and returns an object implementing the reduction functionality.
1050-
/// Accepts 3 arguments: the reference to the reduction variable to where
1051-
/// the computed reduction must be stored \param VarRef, identity value
1052-
/// \param Identity, and the binary operation that must be used
1053-
/// in the reduction \param Combiner.
1044+
/// Accepts 2 arguments: the reference to the reduction variable, to where
1045+
/// the computed reduction must be stored \param VarPtr, and the binary
1046+
/// operation used in the reduction.
10541047
/// The identity value is not passed to this version as it is statically known.
10551048
template <typename T, class BinaryOperation>
10561049
detail::enable_if_t<detail::IsKnownIdentityOp<T, BinaryOperation>::value,
10571050
detail::reduction_impl<T, BinaryOperation, 0, true,
1058-
access::mode::read_write,
1059-
access::placeholder::true_t>>
1060-
reduction(T *VarPtr, BinaryOperation Combiner) {
1061-
// The Combiner argument was needed only to define the BinaryOperation param.
1062-
(void)Combiner;
1051+
access::mode::read_write>>
1052+
reduction(T *VarPtr, BinaryOperation) {
10631053
return detail::reduction_impl<T, BinaryOperation, 0, true,
1064-
access::mode::read_write,
1065-
access::placeholder::true_t>(VarPtr);
1054+
access::mode::read_write>(VarPtr);
10661055
}
10671056

10681057
} // namespace intel

0 commit comments

Comments
 (0)