This repository was archived by the owner on Mar 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,15 @@ int main() {
11
11
constexpr int Size = 100 ;
12
12
queue Queue;
13
13
auto D = Queue.get_device ();
14
-
14
+ auto NumOfDevices = Queue. get_context (). get_devices (). size ();
15
15
buffer<::cl_int, 1 > Buffer (Size);
16
16
Queue.submit ([&](handler &cgh) {
17
17
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>())
19
23
std::cerr << " Integrated GPU should use zeMemAllocHost\n " ;
20
24
else
21
25
std::cerr << " Discrete GPU should use zeMemAllocDevice\n " ;
@@ -26,5 +30,5 @@ int main() {
26
30
return 0 ;
27
31
}
28
32
29
- // CHECK: {{Integrated|Discrete}} GPU should use [[API:zeMemAllocHost|zeMemAllocDevice]]
33
+ // CHECK: {{Integrated|Multi| Discrete}} GPU should use [[API:zeMemAllocHost| zeMemAllocHost|zeMemAllocDevice]]
30
34
// CHECK: ZE ---> [[API]](
You can’t perform that action at this time.
0 commit comments