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

Commit 686c548

Browse files
committed
Test that the UUID is read correctly from Level Zero
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent bd0f26d commit 686c548

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

SYCL/Plugin/level_zero_uuid.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// REQUIRES: gpu, level_zero, level_zero_dev_kit
2+
3+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out
4+
// RUN: %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
5+
6+
// Test that the UUID is read correctly from Level Zero.
7+
8+
#include <CL/sycl.hpp>
9+
#include <iomanip>
10+
#include <iostream>
11+
#include <level_zero/ze_api.h>
12+
#include <sstream>
13+
14+
int main() {
15+
sycl::device dev;
16+
if (dev.has(sycl::aspect::ext_intel_device_info_uuid)) {
17+
auto uuid = dev.get_info<sycl::ext::intel::info::device::uuid>();
18+
std::stringstream uuid_sycl;
19+
for (int i = 0; i < uuid.size(); ++i)
20+
uuid_sycl << std::hex << std::setw(2) << std::setfill('0')
21+
<< int(uuid[i]);
22+
std::cout << "SYCL: " << uuid_sycl.str() << std::endl;
23+
24+
auto zedev = sycl::get_native<sycl::backend::ext_oneapi_level_zero>(dev);
25+
ze_device_properties_t device_properties{};
26+
zeDeviceGetProperties(zedev, &device_properties);
27+
std::stringstream uuid_l0;
28+
for (int i = 0; i < ZE_MAX_DEVICE_UUID_SIZE; ++i)
29+
uuid_l0 << std::hex << std::setw(2) << std::setfill('0')
30+
<< int(device_properties.uuid.id[i]);
31+
std::cout << "L0 : " << uuid_l0.str() << std::endl;
32+
33+
if (uuid_sycl.str() != uuid_l0.str()) {
34+
std::cout << "FAILED" << std::endl;
35+
return -1;
36+
}
37+
std::cout << "PASSED" << std::endl;
38+
}
39+
return 0;
40+
}

0 commit comments

Comments
 (0)