Skip to content

Commit 1042c8e

Browse files
committed
Move global/constant memory init() outside of cgh lambda
Not allowed to nest q.submit for the memcpy when using buffer support.
1 parent e435853 commit 1042c8e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sycl/test-e2e/syclcompat/memory/global_memory_usmnone.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ void test1(volatile int *acc_d1, int *acc_d2, int const *c1, int c2) {
117117
}
118118

119119
int main() {
120+
d1_a.init();
121+
d2_a.init();
122+
c1_a.init();
123+
c2_a.init();
120124
syclcompat::get_default_queue().submit(
121125
[&](sycl::handler &cgh) {
122-
d1_a.init();
123-
d2_a.init();
124-
c1_a.init();
125-
c2_a.init();
126126
auto d1_acc = d1_a.get_access(cgh);
127127
auto d2_acc = d2_a.get_access(cgh);
128128
auto c1_acc = c1_a.get_access(cgh);
@@ -136,10 +136,10 @@ int main() {
136136
c2_acc);
137137
});
138138
});
139+
c3_a.init();
140+
c4_a.init();
139141
syclcompat::get_default_queue().submit(
140142
[&](sycl::handler &cgh) {
141-
c3_a.init();
142-
c4_a.init();
143143
auto c3_acc = c3_a.get_access(cgh);
144144
auto c4_acc = c4_a.get_access(cgh);
145145
cgh.parallel_for<syclcompat_kernel_name<class kernel_test2>>(
@@ -150,10 +150,10 @@ int main() {
150150
});
151151

152152
sycl::queue *q = syclcompat::get_current_device().create_queue();
153+
d3_a.init(*q);
154+
d4_a.init(*q);
153155
q->submit(
154156
[&](sycl::handler &cgh) {
155-
d3_a.init(*q);
156-
d4_a.init(*q);
157157
auto d3_acc = d3_a.get_access(cgh);
158158
auto d4_acc = d4_a.get_access(cgh);
159159
cgh.parallel_for<syclcompat_kernel_name<class kernel_test3>>(

0 commit comments

Comments
 (0)