Skip to content

Commit fcf019b

Browse files
authored
[UR][E2E] add missing zeInit calls to interop tests (#17837)
Continuation of: #17699
1 parent d221298 commit fcf019b

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

+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)) {

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

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ namespace exp_ext = sycl::ext::oneapi::experimental;
1717
using namespace sycl;
1818

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

2230
const size_t Size = 128;

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

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ namespace exp_ext = sycl::ext::oneapi::experimental;
2424
using namespace sycl;
2525

2626
int main() {
27+
// Initialize Level Zero driver is required if this test is linked
28+
// statically with Level Zero loader, the driver will not be init otherwise.
29+
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
30+
if (result != ZE_RESULT_SUCCESS) {
31+
std::cout << "zeInit failed\n";
32+
return 1;
33+
}
34+
2735
queue Queue{{sycl::property::queue::in_order{}}};
2836

2937
const size_t Size = 128;

0 commit comments

Comments
 (0)