1
- // UNSUPPORTED: cuda
2
- // CUDA does not support unnamed lambdas.
3
- //
4
- // RUN: %clangxx -fsycl -fsyntax-only -fsycl-unnamed-lambda %s -o %t.out
1
+ // RUN: %clangxx -fsycl -fsyntax-only %s -o %t.out
5
2
6
3
// ==- queue_parallel_for_generic.cpp - SYCL queue parallel_for interface test -=//
7
4
//
15
12
#include < iostream>
16
13
#include < type_traits>
17
14
18
- template <std::size_t ... Is>
15
+ template <typename KernelName, std::size_t ... Is>
19
16
void test_range_impl (sycl::queue q, std::index_sequence<Is...>,
20
17
sycl::range<sizeof ...(Is)> *) {
21
18
constexpr auto dims = sizeof ...(Is);
22
19
23
- q.parallel_for (sycl::range<dims>{Is...}, [=](auto i) {
20
+ q.parallel_for <KernelName> (sycl::range<dims>{Is...}, [=](auto i) {
24
21
static_assert (std::is_same<decltype (i), sycl::item<dims>>::value,
25
22
" lambda arg type is unexpected" );
26
23
});
27
24
}
28
25
29
- template <std::size_t ... Is>
26
+ template <typename KernelName, std::size_t ... Is>
30
27
void test_range_impl (sycl::queue q, std::index_sequence<Is...>,
31
28
sycl::nd_range<sizeof ...(Is)> *) {
32
29
constexpr auto dims = sizeof ...(Is);
33
30
34
31
sycl::nd_range<dims> ndr{sycl::range<dims>{Is...}, sycl::range<dims>{Is...}};
35
- q.parallel_for (ndr, [=](auto i) {
32
+ q.parallel_for <KernelName> (ndr, [=](auto i) {
36
33
static_assert (std::is_same<decltype (i), sycl::nd_item<dims>>::value,
37
34
" lambda arg type is unexpected" );
38
35
});
39
36
}
40
37
41
- template <template <int > class Range , std::size_t Dims>
38
+ template <typename KernelName, template <int > class Range , std::size_t Dims>
42
39
void test_range (sycl::queue q) {
43
- test_range_impl (q, std::make_index_sequence<Dims>{},
44
- static_cast <Range<Dims> *>(nullptr ));
40
+ test_range_impl<KernelName> (q, std::make_index_sequence<Dims>{},
41
+ static_cast <Range<Dims> *>(nullptr ));
45
42
}
46
43
47
44
void test_number_braced_init_list (sycl::queue q) {
48
45
constexpr auto n = 1 ;
49
- q.parallel_for (n, [=](auto i) {
46
+ q.parallel_for < class Number > (n, [=](auto i) {
50
47
static_assert (std::is_same<decltype (i), sycl::item<1 >>::value,
51
48
" lambda arg type is unexpected" );
52
49
});
53
50
54
- q.parallel_for ({n}, [=](auto i) {
51
+ q.parallel_for < class BracedInitList1 > ({n}, [=](auto i) {
55
52
static_assert (std::is_same<decltype (i), sycl::item<1 >>::value,
56
53
" lambda arg type is unexpected" );
57
54
});
58
55
59
- q.parallel_for ({n, n}, [=](auto i) {
56
+ q.parallel_for < class BracedInitList2 > ({n, n}, [=](auto i) {
60
57
static_assert (std::is_same<decltype (i), sycl::item<2 >>::value,
61
58
" lambda arg type is unexpected" );
62
59
});
63
60
64
- q.parallel_for ({n, n, n}, [=](auto i) {
61
+ q.parallel_for < class BracedInitList3 > ({n, n, n}, [=](auto i) {
65
62
static_assert (std::is_same<decltype (i), sycl::item<3 >>::value,
66
63
" lambda arg type is unexpected" );
67
64
});
@@ -70,12 +67,12 @@ void test_number_braced_init_list(sycl::queue q) {
70
67
int main () {
71
68
sycl::queue q{};
72
69
73
- test_number_braced_init_list (q);
70
+ test_range<class test_range1 , sycl::range, 1 >(q);
71
+ test_range<class test_range2 , sycl::range, 2 >(q);
72
+ test_range<class test_range3 , sycl::range, 3 >(q);
73
+ test_range<class test_nd_range1 , sycl::nd_range, 1 >(q);
74
+ test_range<class test_nd_range2 , sycl::nd_range, 2 >(q);
75
+ test_range<class test_nd_range3 , sycl::nd_range, 3 >(q);
74
76
75
- test_range<sycl::range, 1 >(q);
76
- test_range<sycl::range, 2 >(q);
77
- test_range<sycl::range, 3 >(q);
78
- test_range<sycl::nd_range, 1 >(q);
79
- test_range<sycl::nd_range, 2 >(q);
80
- test_range<sycl::nd_range, 3 >(q);
77
+ test_number_braced_init_list (q);
81
78
}
0 commit comments