Skip to content
Merged
5 changes: 4 additions & 1 deletion sycl/test-e2e/Adapters/level_zero/interop-thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ ze_event_pool_handle_t event_pool = {};
std::vector<operation> old_ops;

void init() {
zeInit(0);
// Initialize Level Zero driver is required if this test is linked
// statically with Level Zero loader, the driver will not be init otherwise.
ze_result_t result = zeInit(0);
assert(result == ZE_RESULT_SUCCESS);

uint32_t driverCount = 0;
assert(zeDriverGet(&driverCount, nullptr) == 0);
Expand Down
9 changes: 9 additions & 0 deletions sycl/test-e2e/Adapters/level_zero/uuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ int main() {
auto zedev = sycl::get_native<sycl::backend::ext_oneapi_level_zero>(dev);
ze_device_properties_t device_properties{};
device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;

// Initialize Level Zero driver is required if this test is linked
// statically with Level Zero loader, the driver will not be init otherwise.
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
if (result != ZE_RESULT_SUCCESS) {
std::cout << "zeInit failed\n";
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+ some small enhancement here and below:

Suggested change
return 1;
return result;

Copy link
Contributor Author

@idubinov idubinov Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZE_RESULT_SUCCESS is not equal to test's success return code. May be in current implementation both of them are equal 0, but not in general.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe print this result value to output for the future easier debugging session, or return it in other way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 79de0d5

}

zeDeviceGetProperties(zedev, &device_properties);
std::stringstream uuid_l0;
for (int i = 0; i < ZE_MAX_DEVICE_UUID_SIZE; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
using namespace sycl;

int main() {
// Initialize Level Zero driver is required if this test is linked
// statically with Level Zero loader, the driver will not be init otherwise.
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
if (result != ZE_RESULT_SUCCESS) {
std::cout << "zeInit failed\n";
return 1;
}

queue Queue;
device Dev = Queue.get_device();
bool Result;
Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/Basic/buffer/buffer_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
using namespace sycl;

int main() {
// Initialize Level Zero driver is required if this test is linked
// statically with Level Zero loader, the driver will not be init otherwise.
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
if (result != ZE_RESULT_SUCCESS) {
std::cout << "zeInit failed\n";
return 1;
}

constexpr int Size = 100;
queue Queue;
auto D = Queue.get_device();
Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/Basic/interop/make_kernel_subdevice_l0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ ze_kernel_handle_t create_kernel(ze_module_handle_t module,
}

int main() {
// Initialize Level Zero driver is required if this test is linked
// statically with Level Zero loader, the driver will not be init otherwise.
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
if (result != ZE_RESULT_SUCCESS) {
std::cout << "zeInit failed\n";
return 1;
}

device D{gpu_selector_v};

try {
Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/DeviceImageBackendContent/L0_interop_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ extern "C" SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(
}

int main() {
// Initialize Level Zero driver is required if this test is linked
// statically with Level Zero loader, the driver will not be init otherwise.
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
if (result != ZE_RESULT_SUCCESS) {
std::cout << "zeInit failed\n";
return 1;
}

sycl::queue q;
sycl::context ctxt = q.get_context();
sycl::device d = ctxt.get_devices()[0];
Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/Regression/cache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ int queryFromNativeHandle(std::vector<sycl::platform> *platform_list,
}

int main() {
// Initialize Level Zero driver is required if this test is linked
// statically with Level Zero loader, the driver will not be init otherwise.
ze_result_t result = zeInit(ZE_INIT_FLAG_GPU_ONLY);
if (result != ZE_RESULT_SUCCESS) {
std::cout << "zeInit failed\n";
return 1;
}

int failures = 0;

// Query for a list of all of the available platforms and devices.
Expand Down
Loading