Skip to content

Commit 5a6a92b

Browse files
committed
[UR][E2E] add missing zeInit calls to interop tests
Continuation of: #17699
1 parent a485cbf commit 5a6a92b

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

sycl/test-e2e/Basic/interop/get_native_ze.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ constexpr auto BE = sycl::backend::ext_oneapi_level_zero;
1212
class TestKernel;
1313

1414
int main() {
15+
// Initialize Level Zero driver is required if this test is linked
16+
// statically with Level Zero loader, the driver will not be init otherwise.
17+
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
18+
if (result != ZE_RESULT_SUCCESS) {
19+
std::cout << "zeInit failed\n";
20+
return 1;
21+
}
22+
1523
sycl::queue Q;
1624

1725
if (0) {

sycl/test-e2e/Graph/Inputs/interop-level-zero-get-native-mem.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ bool is_discrete(const device &Device) {
2121
}
2222

2323
int main() {
24+
// Initialize Level Zero driver is required if this test is linked
25+
// statically with Level Zero loader, the driver will not be init otherwise.
26+
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
27+
if (result != ZE_RESULT_SUCCESS) {
28+
std::cout << "zeInit failed\n";
29+
return 1;
30+
}
31+
2432
try {
2533
platform Plt{gpu_selector_v};
2634

sycl/test-e2e/Graph/Inputs/interop-level-zero-launch-kernel.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ std::vector<uint8_t> loadSpirvFromFile(std::string FileName) {
3737
}
3838

3939
int main(int, char **argv) {
40+
// Initialize Level Zero driver is required if this test is linked
41+
// statically with Level Zero loader, the driver will not be init otherwise.
42+
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
43+
if (result != ZE_RESULT_SUCCESS) {
44+
std::cout << "zeInit failed\n";
45+
return 1;
46+
}
4047

4148
device Device;
4249
if (!getDevice(Device, backend::ext_oneapi_level_zero)) {

0 commit comments

Comments
 (0)