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

Commit e73a88f

Browse files
authored
[SYCL] Fix test for the case when context has multiple gpu devices (#773)
1 parent 4a9e0ec commit e73a88f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

SYCL/Basic/buffer/buffer_create.cpp

100755100644
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ int main() {
1111
constexpr int Size = 100;
1212
queue Queue;
1313
auto D = Queue.get_device();
14-
14+
auto NumOfDevices = Queue.get_context().get_devices().size();
1515
buffer<::cl_int, 1> Buffer(Size);
1616
Queue.submit([&](handler &cgh) {
1717
accessor Accessor{Buffer, cgh, read_write};
18-
if (D.get_info<info::device::host_unified_memory>())
18+
if (NumOfDevices > 1)
19+
// Currently the Level Zero plugin uses host allocations for multi-device
20+
// contexts because such allocations are accessible by all devices.
21+
std::cerr << "Multi GPU should use zeMemAllocHost\n";
22+
else if (D.get_info<info::device::host_unified_memory>())
1923
std::cerr << "Integrated GPU should use zeMemAllocHost\n";
2024
else
2125
std::cerr << "Discrete GPU should use zeMemAllocDevice\n";
@@ -26,5 +30,5 @@ int main() {
2630
return 0;
2731
}
2832

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

0 commit comments

Comments
 (0)