Skip to content

[SYCL][E2E] fix one test leak #12037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sycl/test-e2e/Basic/nested_queue_submit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

#include <cstdlib>
#include <sycl/sycl.hpp>
#include <vector>

void nestedSubmit() {
uint32_t n = 1024;
float *ptr = (float *)malloc(n * sizeof(float));
std::vector<float> array(n);
sycl::queue q{};
{
sycl::buffer<float> buf(ptr, sycl::range<1>{n});
sycl::buffer<float> buf(array.data(), sycl::range<1>{n});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just

Suggested change
sycl::buffer<float> buf(array.data(), sycl::range<1>{n});
sycl::buffer<float> buf(sycl::range<1>{n});

without any vectors/pointers would be enough for this test, I think...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will try to use this constructor next time I see some similar problems.

q.submit([&](sycl::handler &h) {
auto acc = buf.get_access<sycl::access::mode::write>(h);
q.parallel_for<class zero>(sycl::range<1>{n},
[=](sycl::id<1> i) { acc[i] = float(0.0); });
});
}
free(ptr);
}

int main() {
Expand Down