Skip to content

Commit 06ba477

Browse files
committed
[SYCL] Revise forward_progress tests
Signed-off-by: Hu, Peisen <[email protected]>
1 parent d671551 commit 06ba477

File tree

2 files changed

+86
-108
lines changed

2 files changed

+86
-108
lines changed

sycl/test-e2e/forward_progress/forward_progress_kernel_param_L0_gpu.cpp

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,42 @@ void check_props(sycl::queue &q) {}
2323

2424
// Full specializations for each progress guarantee
2525

26+
struct KernelFunctor {
27+
properties props;
28+
KernelFunctor(properties &props_) : props(props_) {}
29+
void operator()() const {}
30+
auto get(properties_tag) const { return props; }
31+
};
32+
2633
template <>
2734
void check_props<forward_progress_guarantee::parallel>(sycl::queue &q) {
2835
constexpr auto guarantee = forward_progress_guarantee::parallel;
2936
// Check properties at execution_scope::root_group coordination level
30-
q.single_task(
31-
properties{work_group_progress<guarantee, execution_scope::root_group>},
32-
[=]() {});
33-
q.single_task(
34-
properties{sub_group_progress<guarantee, execution_scope::root_group>},
35-
[=]() {});
37+
q.single_task(KernelFunctor(
38+
properties{work_group_progress<guarantee, execution_scope::root_group>}));
39+
q.single_task(KernelFunctor(
40+
properties{sub_group_progress<guarantee, execution_scope::root_group>}));
3641
try {
37-
q.single_task(
38-
properties{work_item_progress<guarantee, execution_scope::root_group>},
39-
[=]() {});
42+
q.single_task(KernelFunctor(properties{
43+
work_item_progress<guarantee, execution_scope::root_group>}));
4044
assert(false && "Expected exception not seen!");
4145
} catch (sycl::exception &ex) {
4246
}
4347

4448
// Check properties at execution_scope::work_group coordination level
45-
q.single_task(
46-
properties{sub_group_progress<guarantee, execution_scope::work_group>},
47-
[=]() {});
49+
q.single_task(KernelFunctor(
50+
properties{sub_group_progress<guarantee, execution_scope::work_group>}));
4851
try {
49-
q.single_task(
50-
properties{work_item_progress<guarantee, execution_scope::work_group>},
51-
[=]() {});
52+
q.single_task(KernelFunctor(properties{
53+
work_item_progress<guarantee, execution_scope::work_group>}));
5254
assert(false && "Expected exception not seen!");
5355
} catch (sycl::exception &ex) {
5456
}
5557

5658
// Check properties at execution_scope::sub_group coordination level
5759
try {
58-
q.single_task(
59-
properties{work_item_progress<guarantee, execution_scope::sub_group>},
60-
[=]() {});
60+
q.single_task(KernelFunctor(
61+
properties{work_item_progress<guarantee, execution_scope::sub_group>}));
6162
} catch (sycl::exception &ex) {
6263
}
6364
}
@@ -66,66 +67,54 @@ template <>
6667
void check_props<forward_progress_guarantee::weakly_parallel>(sycl::queue &q) {
6768
constexpr auto guarantee = forward_progress_guarantee::weakly_parallel;
6869
// Check properties at execution_scope::root_group coordination level
69-
q.single_task(
70-
properties{work_group_progress<guarantee, execution_scope::root_group>},
71-
[=]() {});
72-
q.single_task(
73-
properties{sub_group_progress<guarantee, execution_scope::root_group>},
74-
[=]() {});
70+
q.single_task(KernelFunctor(
71+
properties{work_group_progress<guarantee, execution_scope::root_group>}));
72+
q.single_task(KernelFunctor(
73+
properties{sub_group_progress<guarantee, execution_scope::root_group>}));
7574

76-
q.single_task(
77-
properties{work_item_progress<guarantee, execution_scope::root_group>},
78-
[=]() {});
75+
q.single_task(KernelFunctor(
76+
properties{work_item_progress<guarantee, execution_scope::root_group>}));
7977

8078
// Check properties at execution_scope::work_group coordination level
81-
q.single_task(
82-
properties{sub_group_progress<guarantee, execution_scope::work_group>},
83-
[=]() {});
84-
q.single_task(
85-
properties{work_item_progress<guarantee, execution_scope::work_group>},
86-
[=]() {});
79+
q.single_task(KernelFunctor(
80+
properties{sub_group_progress<guarantee, execution_scope::work_group>}));
81+
q.single_task(KernelFunctor(
82+
properties{work_item_progress<guarantee, execution_scope::work_group>}));
8783

8884
// Check properties at execution_scope::sub_group coordination level
89-
q.single_task(
90-
properties{work_item_progress<guarantee, execution_scope::sub_group>},
91-
[=]() {});
85+
q.single_task(KernelFunctor(
86+
properties{work_item_progress<guarantee, execution_scope::sub_group>}));
9287
}
9388

9489
template <>
9590
void check_props<forward_progress_guarantee::concurrent>(sycl::queue &q) {
9691
constexpr auto guarantee = forward_progress_guarantee::concurrent;
9792
// Check properties at execution_scope::root_group coordination level
98-
q.single_task(
99-
properties{work_group_progress<guarantee, execution_scope::root_group>},
100-
[=]() {});
101-
q.single_task(
102-
properties{sub_group_progress<guarantee, execution_scope::root_group>},
103-
[=]() {});
93+
q.single_task(KernelFunctor(
94+
properties{work_group_progress<guarantee, execution_scope::root_group>}));
95+
q.single_task(KernelFunctor(
96+
properties{sub_group_progress<guarantee, execution_scope::root_group>}));
10497
try {
105-
q.single_task(
106-
properties{work_item_progress<guarantee, execution_scope::root_group>},
107-
[=]() {});
98+
q.single_task(KernelFunctor(properties{
99+
work_item_progress<guarantee, execution_scope::root_group>}));
108100
assert(false && "Expected exception not seen!");
109101
} catch (sycl::exception &ex) {
110102
}
111103

112104
// Check properties at execution_scope::work_group coordination level
113-
q.single_task(
114-
properties{sub_group_progress<guarantee, execution_scope::work_group>},
115-
[=]() {});
105+
q.single_task(KernelFunctor(
106+
properties{sub_group_progress<guarantee, execution_scope::work_group>}));
116107
try {
117-
q.single_task(
118-
properties{work_item_progress<guarantee, execution_scope::work_group>},
119-
[=]() {});
108+
q.single_task(KernelFunctor(properties{
109+
work_item_progress<guarantee, execution_scope::work_group>}));
120110
assert(false && "Expected exception not seen!");
121111
} catch (sycl::exception &ex) {
122112
}
123113

124114
// Check properties at execution_scope::sub_group coordination level
125115
try {
126-
q.single_task(
127-
properties{work_item_progress<guarantee, execution_scope::sub_group>},
128-
[=]() {});
116+
q.single_task(KernelFunctor(
117+
properties{work_item_progress<guarantee, execution_scope::sub_group>}));
129118
assert(false && "Expected exception not seen!");
130119
} catch (sycl::exception &ex) {
131120
}

sycl/test-e2e/forward_progress/forward_progress_kernel_param_ocl_cpu.cpp

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,50 @@ void check_props(sycl::queue &q) {}
2222

2323
// Full specializations for each progress guarantee
2424

25+
struct KernelFunctor {
26+
properties props;
27+
KernelFunctor(properties &props_) : props(props_) {}
28+
void operator()() const {}
29+
auto get(properties_tag) const { return props; }
30+
};
31+
2532
template <>
2633
void check_props<forward_progress_guarantee::parallel>(sycl::queue &q) {
2734
constexpr auto guarantee = forward_progress_guarantee::parallel;
2835
// Check properties at execution_scope::root_group coordination level
29-
q.single_task(
30-
properties{work_group_progress<guarantee, execution_scope::root_group>},
31-
[=]() {});
36+
q.single_task(KernelFunctor(
37+
properties{work_group_progress<guarantee, execution_scope::root_group>}));
3238
try {
33-
q.single_task(
34-
properties{sub_group_progress<guarantee, execution_scope::root_group>},
35-
[=]() {});
39+
q.single_task(KernelFunctor(properties{
40+
sub_group_progress<guarantee, execution_scope::root_group>}));
3641
assert(false && "Expected exception not seen!");
3742
} catch (sycl::exception &ex) {
3843
}
3944
try {
40-
q.single_task(
41-
properties{work_item_progress<guarantee, execution_scope::root_group>},
42-
[=]() {});
45+
q.single_task(KernelFunctor(properties{
46+
work_item_progress<guarantee, execution_scope::root_group>}));
4347
assert(false && "Expected exception not seen!");
4448
} catch (sycl::exception &ex) {
4549
}
4650

4751
// Check properties at execution_scope::work_group coordination level
4852
try {
49-
q.single_task(
50-
properties{sub_group_progress<guarantee, execution_scope::work_group>},
51-
[=]() {});
53+
q.single_task(KernelFunctor(properties{
54+
sub_group_progress<guarantee, execution_scope::work_group>}));
5255
assert(false && "Expected exception not seen!");
5356
} catch (sycl::exception &ex) {
5457
}
5558
try {
56-
q.single_task(
57-
properties{work_item_progress<guarantee, execution_scope::work_group>},
58-
[=]() {});
59+
q.single_task(KernelFunctor(properties{
60+
work_item_progress<guarantee, execution_scope::work_group>}));
5961
assert(false && "Expected exception not seen!");
6062
} catch (sycl::exception &ex) {
6163
}
6264

6365
// Check properties at execution_scope::sub_group coordination level
6466
try {
65-
q.single_task(
66-
properties{work_item_progress<guarantee, execution_scope::sub_group>},
67-
[=]() {});
67+
q.single_task(KernelFunctor(
68+
properties{work_item_progress<guarantee, execution_scope::sub_group>}));
6869
assert(false && "Expected exception not seen!");
6970
} catch (sycl::exception &ex) {
7071
}
@@ -74,78 +75,66 @@ template <>
7475
void check_props<forward_progress_guarantee::weakly_parallel>(sycl::queue &q) {
7576
constexpr auto guarantee = forward_progress_guarantee::weakly_parallel;
7677
// Check properties at execution_scope::root_group coordination level
77-
q.single_task(
78-
properties{work_group_progress<guarantee, execution_scope::root_group>},
79-
[=]() {});
80-
q.single_task(
81-
properties{sub_group_progress<guarantee, execution_scope::root_group>},
82-
[=]() {});
78+
q.single_task(KernelFunctor(
79+
properties{work_group_progress<guarantee, execution_scope::root_group>}));
80+
q.single_task(KernelFunctor(
81+
properties{sub_group_progress<guarantee, execution_scope::root_group>}));
8382

84-
q.single_task(
85-
properties{work_item_progress<guarantee, execution_scope::root_group>},
86-
[=]() {});
83+
q.single_task(KernelFunctor(
84+
properties{work_item_progress<guarantee, execution_scope::root_group>}));
8785

8886
// Check properties at execution_scope::work_group coordination level
89-
q.single_task(
90-
properties{sub_group_progress<guarantee, execution_scope::work_group>},
91-
[=]() {});
92-
q.single_task(
93-
properties{work_item_progress<guarantee, execution_scope::work_group>},
94-
[=]() {});
87+
q.single_task(KernelFunctor(
88+
properties{sub_group_progress<guarantee, execution_scope::work_group>}));
89+
q.single_task(KernelFunctor(
90+
properties{work_item_progress<guarantee, execution_scope::work_group>}));
9591

9692
// Check properties at execution_scope::sub_group coordination level
97-
q.single_task(
98-
properties{work_item_progress<guarantee, execution_scope::sub_group>},
99-
[=]() {});
93+
q.single_task(KernelFunctor(
94+
properties{work_item_progress<guarantee, execution_scope::sub_group>}));
10095
}
10196

10297
template <>
10398
void check_props<forward_progress_guarantee::concurrent>(sycl::queue &q) {
10499
constexpr auto guarantee = forward_progress_guarantee::concurrent;
105100
// Check properties at execution_scope::root_group coordination level
106101
try {
107-
q.single_task(
108-
properties{work_group_progress<guarantee, execution_scope::root_group>},
109-
[=]() {});
102+
q.single_task(KernelFunctor(properties{
103+
work_group_progress<guarantee, execution_scope::root_group>}));
110104
assert(false && "Expected exception not seen!");
111105
} catch (sycl::exception &ex) {
112106
}
113107
try {
114-
q.single_task(
115-
properties{sub_group_progress<guarantee, execution_scope::root_group>},
116-
[=]() {});
108+
q.single_task(KernelFunctor(properties{
109+
sub_group_progress<guarantee, execution_scope::root_group>}));
117110
assert(false && "Expected exception not seen!");
118111
} catch (sycl::exception &ex) {
119112
}
120113
try {
121-
q.single_task(
122-
properties{work_item_progress<guarantee, execution_scope::root_group>},
123-
[=]() {});
114+
q.single_task(KernelFunctor(properties{
115+
work_item_progress<guarantee, execution_scope::root_group>}));
124116
assert(false && "Expected exception not seen!");
125117
} catch (sycl::exception &ex) {
126118
}
127119

128120
// Check properties at execution_scope::work_group coordination level
129121
try {
130-
q.single_task(
131-
properties{sub_group_progress<guarantee, execution_scope::work_group>},
132-
[=]() {});
122+
q.single_task(KernelFunctor(properties{
123+
sub_group_progress<guarantee, execution_scope::work_group>}));
133124
assert(false && "Expected exception not seen!");
134125
} catch (sycl::exception &ex) {
135126
}
136127
try {
137-
q.single_task(
138-
properties{work_item_progress<guarantee, execution_scope::work_group>},
139-
[=]() {});
128+
q.single_task(KernelFunctor(properties{
129+
work_item_progress<guarantee, execution_scope::work_group>}));
140130
assert(false && "Expected exception not seen!");
141131
} catch (sycl::exception &ex) {
142132
}
143133

144134
// Check properties at execution_scope::sub_group coordination level
145135
try {
146-
q.single_task(
147-
properties{work_item_progress<guarantee, execution_scope::sub_group>},
148-
[=]() {});
136+
q.single_task(KernelFunctor(
137+
properties{work_item_progress<guarantee, execution_scope::sub_group>}));
149138
assert(false && "Expected exception not seen!");
150139
} catch (sycl::exception &ex) {
151140
}

0 commit comments

Comments
 (0)