Skip to content

Commit 4a4be0b

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

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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)) {

sycl/test-e2e/Graph/NativeCommand/level-zero_usm.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ namespace exp_ext = sycl::ext::oneapi::experimental;
1414
using namespace sycl;
1515

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

1927
const size_t Size = 128;

sycl/test-e2e/Graph/NativeCommand/level-zero_usm_D2H_copy.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ namespace exp_ext = sycl::ext::oneapi::experimental;
2121
using namespace sycl;
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
queue Queue{{sycl::property::queue::in_order{}}};
2533

2634
const size_t Size = 128;

0 commit comments

Comments
 (0)