Skip to content

[SYCL][E2E] Add missing zeInit to interop tests #17699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ using namespace sycl;
int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
try {
// 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;
}

platform Plt{gpu_selector_v};

auto Devices = Plt.get_devices();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ void test_copyback_and_free(
int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
try {
// 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;
}

platform Plt{gpu_selector_v};

auto Devices = Plt.get_devices();
Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/Adapters/interop-level-zero-buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ class DiscreteSelector : public sycl::device_selector {
int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
try {
// 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{};

auto Context = Queue.get_info<info::queue::context>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ constexpr size_t SIZE = 16;
int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
try {
// 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;
}

platform Plt{gpu_selector_v};

auto Devices = Plt.get_devices();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ using namespace sycl;

int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
// 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 auto BE = sycl::backend::ext_oneapi_level_zero;
sycl::device D =
sycl::ext::oneapi::filter_selector("level_zero:gpu").select_device();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ void test(sycl::ext::oneapi::level_zero::ownership Ownership) {

int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
// 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;
}

std::cout << "test ownership::transfer" << std::endl;
test(sycl::ext::oneapi::level_zero::ownership::transfer);

Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/Adapters/interop-level-zero-image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ using namespace sycl;

int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
// 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 auto BE = sycl::backend::ext_oneapi_level_zero;

platform Plt{gpu_selector_v};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
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;
}

// Creat SYCL platform/device
device Device(gpu_selector_v);
Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/Adapters/interop-level-zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ using namespace sycl;

int main() {
#ifdef SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO
// 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{};

event DefaultEvent;
Expand Down
8 changes: 8 additions & 0 deletions sycl/test-e2e/Adapters/level_zero_batch_barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ void submit_kernel(queue &q) {
}

int main(int argc, char *argv[]) {
// 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 q;

submit_kernel(q); // starts a batch
Expand Down
Loading