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

Commit ecf4ccc

Browse files
[SYCL] Test that the UUID is read correctly from Level Zero (#1581)
Tests this change : intel/llvm@28588ae --------- Signed-off-by: Sergey V Maslov <[email protected]>
1 parent a7917bf commit ecf4ccc

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

SYCL/Plugin/level_zero_uuid.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
// CHECK: PASSED
9+
#include <CL/sycl.hpp>
10+
#include <iomanip>
11+
#include <iostream>
12+
#include <level_zero/ze_api.h>
13+
#include <sstream>
14+
15+
int main() {
16+
sycl::device dev;
17+
if (dev.has(sycl::aspect::ext_intel_device_info_uuid)) {
18+
auto uuid = dev.get_info<sycl::ext::intel::info::device::uuid>();
19+
std::stringstream uuid_sycl;
20+
for (int i = 0; i < uuid.size(); ++i)
21+
uuid_sycl << std::hex << std::setw(2) << std::setfill('0')
22+
<< int(uuid[i]);
23+
std::cout << "SYCL: " << uuid_sycl.str() << std::endl;
24+
25+
auto zedev = sycl::get_native<sycl::backend::ext_oneapi_level_zero>(dev);
26+
ze_device_properties_t device_properties{};
27+
zeDeviceGetProperties(zedev, &device_properties);
28+
std::stringstream uuid_l0;
29+
for (int i = 0; i < ZE_MAX_DEVICE_UUID_SIZE; ++i)
30+
uuid_l0 << std::hex << std::setw(2) << std::setfill('0')
31+
<< int(device_properties.uuid.id[i]);
32+
std::cout << "L0 : " << uuid_l0.str() << std::endl;
33+
34+
if (uuid_sycl.str() != uuid_l0.str()) {
35+
std::cout << "FAILED" << std::endl;
36+
return -1;
37+
}
38+
std::cout << "PASSED" << std::endl;
39+
}
40+
return 0;
41+
}

0 commit comments

Comments
 (0)