forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreduction_range_2d_dw_reducer_skip.cpp
More file actions
69 lines (57 loc) · 3.1 KB
/
reduction_range_2d_dw_reducer_skip.cpp
File metadata and controls
69 lines (57 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_60
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// TODO: accelerator may not suport atomics required by the current
// implementation. Enable testing when implementation is fixed.
// RUNx: %ACC_RUN_PLACEHOLDER %t.out
// This test performs basic checks of parallel_for(range<2>, reduction, func)
// with reductions initialized with a one element buffer. Additionally, some
// reducers will not be written to.
#include "reduction_utils.hpp"
using namespace sycl;
int NumErrors = 0;
template <typename T> class SkipEvenName;
template <typename T> class SkipOddName;
template <typename T> class SkipAllName;
template <typename Name, typename T, typename... ArgTys>
void tests(ArgTys &&...Args) {
NumErrors += test<SkipEvenName<Name>, T>(std::forward<ArgTys>(Args)...,
property_list{}, SkipEvenOp{});
NumErrors += test<SkipOddName<Name>, T>(std::forward<ArgTys>(Args)...,
property_list{}, SkipOddOp{});
NumErrors += test<SkipAllName<Name>, T>(std::forward<ArgTys>(Args)...,
property_list{}, SkipAllOp{});
}
int main() {
queue Q;
printDeviceInfo(Q);
size_t MaxWGSize =
Q.get_device().get_info<info::device::max_work_group_size>();
tests<class A1, int>(Q, 0, 99, std::plus<>{}, range<2>{1, 1});
tests<class A2, int>(Q, 0, 99, std::plus<>{}, range<2>{2, 2});
tests<class A3, int>(Q, 0, 99, std::plus<>{}, range<2>{2, 3});
tests<class A4, int>(Q, 0, 99, std::plus<>{}, range<2>{MaxWGSize, 1});
tests<class A5, int64_t>(Q, 0, 99, std::plus<>{}, range<2>{1, MaxWGSize});
tests<class A6, int64_t>(Q, 0, 99, std::plus<>{}, range<2>{2, MaxWGSize * 2});
tests<class A7, int64_t>(Q, 0, 99, std::plus<>{}, range<2>{MaxWGSize * 3, 7});
tests<class A8, int64_t>(Q, 0, 99, std::plus<>{}, range<2>{3, MaxWGSize * 3});
tests<class B1, CustomVec<long long>>(Q, 0, 99, CustomVecPlus<long long>{},
range<2>{33, MaxWGSize});
tests<class B2, CustomVec<long long>>(Q, 99, CustomVecPlus<long long>{},
range<2>{33, MaxWGSize});
tests<class C1, int>(Q, 99, PlusWithoutIdentity<int>{}, range<2>{1, 1});
tests<class C2, int>(Q, 99, PlusWithoutIdentity<int>{}, range<2>{2, 2});
tests<class C3, int>(Q, 99, PlusWithoutIdentity<int>{}, range<2>{2, 3});
tests<class C4, int>(Q, 99, PlusWithoutIdentity<int>{},
range<2>{MaxWGSize, 1});
tests<class C5, int64_t>(Q, 99, PlusWithoutIdentity<int64_t>{},
range<2>{1, MaxWGSize});
tests<class C6, int64_t>(Q, 99, PlusWithoutIdentity<int64_t>{},
range<2>{2, MaxWGSize * 2});
tests<class C7, int64_t>(Q, 99, PlusWithoutIdentity<int64_t>{},
range<2>{MaxWGSize * 3, 7});
tests<class C8, int64_t>(Q, 99, PlusWithoutIdentity<int64_t>{},
range<2>{3, MaxWGSize * 3});
printFinalStatus(NumErrors);
return NumErrors;
}