Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Adjust reduction_ctor test and check reducer identity #1577

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions SYCL/Reduction/reduction_ctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// This performs basic checks such as reduction creation, getIdentity() method,
// and the combine() method of the aux class 'reducer'.
// Note: This test relies on non-standard implementation details.

#include "reduction_utils.hpp"
#include <cassert>
Expand All @@ -24,8 +25,10 @@ void test_reducer(Reduction &Redu, T A, T B) {

typename Reduction::binary_operation BOp;
T ExpectedValue = BOp(A, B);
assert(ExpectedValue == Reducer.MValue &&
assert(ExpectedValue == detail::ReducerAccess{Reducer}.getElement(0) &&
"Wrong result of binary operation.");
assert(toBool(Reducer.identity() == Redu.getIdentity()) &&
"Failed identity() check().");
}

template <typename T, typename Reduction, typename BinaryOperation>
Expand All @@ -35,8 +38,11 @@ void test_reducer(Reduction &Redu, T Identity, BinaryOperation BOp, T A, T B) {
Reducer.combine(B);

T ExpectedValue = BOp(A, B);
assert(toBool(ExpectedValue == Reducer.MValue) &&
"Wrong result of binary operation.");
assert(
toBool(ExpectedValue == detail::ReducerAccess{Reducer}.getElement(0)) &&
"Wrong result of binary operation.");
assert(toBool(Reducer.identity() == Redu.getIdentity()) &&
"Failed identity() check().");
}

template <typename... Ts> class KernelNameGroup;
Expand Down