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

Commit 47a4b5b

Browse files
[SYCL][L0] check USM capabilities (#794)
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent f5cfbca commit 47a4b5b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// REQUIRES: gpu, level_zero, level_zero_dev_kit
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out
3+
// RUN: %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
4+
5+
#include <CL/sycl.hpp>
6+
#include <iostream>
7+
8+
// Check for queries of USM capabilities.
9+
// All supported L0 devices have these capabilities currently:
10+
//
11+
// CHECK: usm_host_allocations: 1
12+
// CHECK: usm_device_allocations: 1
13+
// CHECK: usm_shared_allocations: 1
14+
// CHECK: usm_system_allocations: 0
15+
// CHECK: usm_atomic_host_allocations: 0
16+
// CHECK: usm_atomic_shared_allocations: 0
17+
18+
using namespace cl::sycl;
19+
20+
int main() {
21+
auto D = device(gpu_selector());
22+
std::cout << "name = " << D.get_info<info::device::name>() << std::endl;
23+
24+
std::cout << " usm_host_allocations: " << D.has(aspect::usm_host_allocations)
25+
<< std::endl;
26+
std::cout << " usm_device_allocations: "
27+
<< D.has(aspect::usm_device_allocations) << std::endl;
28+
std::cout << " usm_shared_allocations: "
29+
<< D.has(aspect::usm_shared_allocations) << std::endl;
30+
std::cout << " usm_system_allocations: "
31+
<< D.has(aspect::usm_system_allocations) << std::endl;
32+
std::cout << " usm_atomic_host_allocations: "
33+
<< D.has(aspect::usm_atomic_host_allocations) << std::endl;
34+
std::cout << " usm_atomic_shared_allocations: "
35+
<< D.has(aspect::usm_atomic_shared_allocations) << std::endl;
36+
return 0;
37+
}

0 commit comments

Comments
 (0)