Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] check buffer allocation on a sub-device #402

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
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
32 changes: 32 additions & 0 deletions SYCL/Basic/alloc_on_subdevice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env CreateMultipleSubDevices=2 NEOReadDebugKeys=1 SYCL_DEVICE_FILTER="gpu" %t.out

// REQUIRES: gpu

#include <CL/sycl.hpp>

#include <iostream>
using namespace sycl;

class KernelNameA;
int main() {
device dev = device::get_devices(info::device_type::gpu)[0];
int val = 0;
std::vector<device> subdevices;

subdevices = dev.create_sub_devices<
info::partition_property::partition_by_affinity_domain>(
info::partition_affinity_domain::numa);
std::cout << "Testing on " << subdevices.size() << " subdevices" << std::endl;

context commonContext{subdevices};
for (int j = 0; j < subdevices.size(); ++j) {
buffer<int, 1> buf(&val, range<1>(1));
queue q{commonContext, subdevices[j]};
q.submit([&](handler &cgh) {
auto acc = buf.get_access<access::mode::read_write>(cgh);
cgh.single_task<KernelNameA>([=]() { acc[0] = acc[0] + 1; });
});
}
assert(val == subdevices.size());
}