|
| 1 | +// RUN: %clangxx -fsycl -Xclang -verify=expected -Xclang -verify-ignore-unexpected=note -fpreview-breaking-changes -fsyntax-only -fsycl-device-only -ferror-limit=0 %s |
| 2 | + |
| 3 | +#include <sycl/group_algorithm.hpp> |
| 4 | + |
| 5 | +using namespace sycl; |
| 6 | + |
| 7 | +constexpr size_t N = 8; |
| 8 | +range<2> global{16, 32}; |
| 9 | +range<2> local{4, 8}; |
| 10 | +id<2> groupId{1, 2}; |
| 11 | +group<2> g = detail::Builder::createGroup(global, local, groupId); |
| 12 | +int *rawIn = nullptr; |
| 13 | +int *rawOut = nullptr; |
| 14 | + |
| 15 | +void ExclusiveScanOverGroup() { |
| 16 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 17 | + exclusive_scan_over_group(g, 0, sycl::logical_and<int>{}); |
| 18 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 19 | + exclusive_scan_over_group(g, 0, 0, sycl::logical_and<int>{}); |
| 20 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 21 | + exclusive_scan_over_group(g, 0, sycl::logical_or<int>{}); |
| 22 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 23 | + exclusive_scan_over_group(g, 0, 0, sycl::logical_or<int>{}); |
| 24 | +} |
| 25 | + |
| 26 | +void JointExclusiveScan() { |
| 27 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 28 | + joint_exclusive_scan(g, rawIn, rawIn + N, rawOut, sycl::logical_and<int>{}); |
| 29 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 30 | + joint_exclusive_scan(g, rawIn, rawIn + N, rawOut, sycl::logical_or<int>{}); |
| 31 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 32 | + joint_exclusive_scan(g, rawIn, rawIn + N, rawOut, 0, |
| 33 | + sycl::logical_and<int>{}); |
| 34 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 35 | + joint_exclusive_scan(g, rawIn, rawIn + N, rawOut, 0, sycl::logical_or<int>{}); |
| 36 | +} |
| 37 | + |
| 38 | +void InclusiveScanOverGroup() { |
| 39 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 40 | + inclusive_scan_over_group(g, 0, sycl::logical_and<int>{}); |
| 41 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 42 | + inclusive_scan_over_group(g, 0, sycl::logical_and<int>{}, 0); |
| 43 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 44 | + inclusive_scan_over_group(g, 0, sycl::logical_or<int>{}); |
| 45 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 46 | + inclusive_scan_over_group(g, 0, sycl::logical_or<int>{}, 0); |
| 47 | +} |
| 48 | + |
| 49 | +void JointInclusiveScan() { |
| 50 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 51 | + joint_inclusive_scan(g, rawIn, rawIn + N, rawOut, sycl::logical_and<int>{}); |
| 52 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 53 | + joint_inclusive_scan(g, rawIn, rawIn + N, rawOut, sycl::logical_or<int>{}); |
| 54 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 55 | + joint_inclusive_scan(g, rawIn, rawIn + N, rawOut, sycl::logical_and<int>{}, |
| 56 | + 0); |
| 57 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match scan accumulation type}} |
| 58 | + joint_inclusive_scan(g, rawIn, rawIn + N, rawOut, sycl::logical_or<int>{}, 0); |
| 59 | +} |
| 60 | + |
| 61 | +void ReduceOverGroup() { |
| 62 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match reduction accumulation type}} |
| 63 | + reduce_over_group(g, 0, sycl::logical_and<int>{}); |
| 64 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match reduction accumulation type}} |
| 65 | + reduce_over_group(g, 0, 0, sycl::logical_and<int>{}); |
| 66 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match reduction accumulation type}} |
| 67 | + reduce_over_group(g, 0, sycl::logical_or<int>{}); |
| 68 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match reduction accumulation type}} |
| 69 | + reduce_over_group(g, 0, 0, sycl::logical_or<int>{}); |
| 70 | +} |
| 71 | + |
| 72 | +void JointReduce() { |
| 73 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match reduction accumulation type}} |
| 74 | + joint_reduce(g, rawIn, rawIn + N, 0, sycl::logical_and<int>{}); |
| 75 | + // expected-error@sycl/group_algorithm.hpp:* {{Result type of binary_op must match reduction accumulation type}} |
| 76 | + joint_reduce(g, rawIn, rawIn + N, 0, sycl::logical_or<int>{}); |
| 77 | +} |
0 commit comments