Skip to content

Commit 51ec5c1

Browse files
authored
[SYCL][COMPAT] Fix the memory leak issue in e2e test syclcompat/group_utils~exchange.cpp (#17731)
Signed-off-by: intwanghao <[email protected]>
1 parent 22c6c11 commit 51ec5c1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

sycl/test-e2e/syclcompat/group_utils/exchange.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ bool test_striped_to_blocked() {
138138
std::ostream_iterator<int> Iter(std::cout, ", ");
139139
std::copy(d_data, d_data + 512, Iter);
140140
std::cout << std::endl;
141+
sycl::free(d_data, q_ct1);
141142
return false;
142143
}
143144
}
144-
145+
sycl::free(d_data, q_ct1);
145146
std::cout << "test_striped_to_blocked pass\n";
146147
return true;
147148
}
@@ -181,9 +182,11 @@ bool test_blocked_to_striped() {
181182
std::ostream_iterator<int> Iter(std::cout, ", ");
182183
std::copy(d_data, d_data + 512, Iter);
183184
std::cout << std::endl;
185+
sycl::free(d_data, q_ct1);
184186
return false;
185187
}
186188
}
189+
sycl::free(d_data, q_ct1);
187190
std::cout << "test_blocked_to_striped pass\n";
188191
return true;
189192
}
@@ -226,10 +229,13 @@ bool test_scatter_to_blocked() {
226229
std::ostream_iterator<int> Iter(std::cout, ", ");
227230
std::copy(d_data, d_data + 512, Iter);
228231
std::cout << std::endl;
232+
sycl::free(d_data, q_ct1);
233+
sycl::free(d_rank, q_ct1);
229234
return false;
230235
}
231236
}
232-
237+
sycl::free(d_data, q_ct1);
238+
sycl::free(d_rank, q_ct1);
233239
std::cout << "test_scatter_to_blocked pass\n";
234240
return true;
235241
}
@@ -282,9 +288,13 @@ bool test_scatter_to_striped() {
282288
std::ostream_iterator<int> Iter(std::cout, ", ");
283289
std::copy(d_data, d_data + 512, Iter);
284290
std::cout << std::endl;
291+
sycl::free(d_data, q_ct1);
292+
sycl::free(d_rank, q_ct1);
285293
return false;
286294
}
287295
}
296+
sycl::free(d_data, q_ct1);
297+
sycl::free(d_rank, q_ct1);
288298
std::cout << "test_blocked_to_striped pass\n";
289299
return true;
290300
}

0 commit comments

Comments
 (0)