Skip to content

[SYCL] Test memory allocated by buffer creation API. #3156

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

Closed
wants to merge 2 commits into from
Closed
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
29 changes: 29 additions & 0 deletions sycl/test/on-device/basic_tests/buffer/buffer_create.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// REQUIRES: gpu,level_zero
Copy link
Contributor

Choose a reason for hiding this comment

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

this test needs to be E2E and go into llvm-test-suite

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is the plan. It is here so it can be reviewed.
Later, after the plugin change has been merged, the test will be moved to llvm-test-suite.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am closing this PR since with no plugin change required, the test can go to llvm-test-suite directly.

// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out 2> %t1.out; cat %t1.out %GPU_CHECK_PLACEHOLDER

#include <CL/sycl.hpp>

using namespace cl::sycl;

int main() {
constexpr int Size = 100;
queue Queue;
auto D = Queue.get_device();

buffer<::cl_int, 1> Buffer(Size);
Queue.submit([&](handler &cgh) {
accessor Accessor{Buffer, cgh, read_write};
if (D.get_info<info::device::host_unified_memory>())
std::cerr << "Integrated GPU should use zeMemAllocHost\n";
else
std::cerr << "Discrete GPU should use zeMemAllocDevice\n";
cgh.parallel_for<class CreateBuffer>(range<1>(Size), [=](id<1> ID) {});
});
Queue.wait();

return 0;
}

// CHECK: {{Integrated|Discrete}} GPU should use [[API:zeMemAllocHost|zeMemAllocDevice]]
// CHECK: ZE ---> [[API]](