Skip to content

DDI extension support #285

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions .github/workflows/build-quick-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- env:
ZEL_LIBRARY_PATH: '${{ github.workspace }}/dynamic_build/lib'
working-directory: build
run: ls $ZEL_LIBRARY_PATH;ZE_ENABLE_LOADER_DEBUG_TRACE=1 ctest -V
run: ls $ZEL_LIBRARY_PATH;ctest -V

build-windows:
if: github.repository_owner == 'oneapi-src'
Expand All @@ -56,7 +56,6 @@ jobs:
cmake -D BUILD_L0_LOADER_TESTS=1 -D BUILD_STATIC=1 ..
cmake --build . --config Release
- env:
ZE_ENABLE_LOADER_DEBUG_TRACE: '1'
ZEL_LIBRARY_PATH: '${{ github.workspace }}/build/bin/Release'
working-directory: build
run: ctest -C Release -V
2 changes: 0 additions & 2 deletions .github/workflows/build-quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
..
make -j$(nproc)
- env:
ZE_ENABLE_LOADER_DEBUG_TRACE: '1'
ZEL_LIBRARY_PATH: '${{ github.workspace }}/build/lib'
working-directory: build
run: ctest -V
Expand All @@ -43,7 +42,6 @@ jobs:
cmake -D BUILD_L0_LOADER_TESTS=1 ..
cmake --build . --config Release
- env:
ZE_ENABLE_LOADER_DEBUG_TRACE: '1'
ZEL_LIBRARY_PATH: '${{ github.workspace }}/build/bin/Release'
working-directory: build
run: ctest -C Release -V
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2024 Intel Corporation
# Copyright (C) 2020-2025 Intel Corporation
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
Expand All @@ -13,7 +13,7 @@ if(MSVC AND (MSVC_VERSION LESS 1900))
endif()

# This project follows semantic versioning (https://semver.org/)
project(level-zero VERSION 1.22.3)
project(level-zero VERSION 1.23.0)

include(GNUInstallDirs)

Expand Down
4 changes: 2 additions & 2 deletions PRODUCT_GUID.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.22.3
b3491b8d-9942-47bf-be47-8741f9614566
1.23.0
146652e2-0b5a-4461-b176-800135676a46
157 changes: 84 additions & 73 deletions samples/zello_world/zello_world.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -82,6 +82,8 @@ int main( int argc, char *argv[] )
ze_device_handle_t pDevice = nullptr;
uint32_t driverCount = 0;
zel_tracer_handle_t tracer = nullptr;
std::vector<ze_driver_handle_t> drivers;
std::vector<ze_device_handle_t> devices_per_driver;
if( init_ze(legacy_init, driverCount, driverTypeDesc) )
{

Expand All @@ -106,7 +108,6 @@ int main( int argc, char *argv[] )
}
}

std::vector<ze_driver_handle_t> drivers;
if (legacy_init) {
status = zeDriverGet(&driverCount, nullptr);
if(status != ZE_RESULT_SUCCESS) {
Expand All @@ -129,96 +130,106 @@ int main( int argc, char *argv[] )
}
}

for( uint32_t driver = 0; driver < driverCount; ++driver )
for( size_t driver = 0; driver < drivers.size(); ++driver )
{
std::cout << "Driver # " << driver << "\n";
pDriver = drivers[driver];
pDevice = findDevice( pDriver, type );
if( pDevice )
{
break;
if (pDevice) {
devices_per_driver.push_back(pDevice);
} else {
devices_per_driver.push_back(nullptr);
}
}
}

if( !pDevice )
if( devices_per_driver.empty() || drivers.empty() )
{
std::cout << "Did NOT find matching " << to_string(type) <<" device!" << "\n";
return -1;
}

for (size_t driver_idx = 0; driver_idx < drivers.size(); ++driver_idx) {
if (driver_idx >= devices_per_driver.size() || devices_per_driver[driver_idx] == nullptr) {
std::cout << "No valid device found for Driver #" << driver_idx << std::endl;
continue;
}
pDriver = drivers[driver_idx];
pDevice = devices_per_driver[driver_idx];
std::cout << "Executing on Driver #" << driver_idx << ", Device #" << 0 << std::endl;
// Create the context
ze_context_handle_t context;
ze_context_desc_t context_desc = {};
context_desc.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC;
status = zeContextCreate(pDriver, &context_desc, &context);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeContextCreate Failed with return code: " << to_string(status) << std::endl;
continue;
}

// Create the context
ze_context_handle_t context;
ze_context_desc_t context_desc = {};
context_desc.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC;
status = zeContextCreate(pDriver, &context_desc, &context);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeContextCreate Failed with return code: " << to_string(status) << std::endl;
exit(1);
}
// Create an immediate command list for direct submission
ze_command_queue_desc_t altdesc = {};
altdesc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC;
ze_command_list_handle_t command_list = {};
status = zeCommandListCreateImmediate(context, pDevice, &altdesc, &command_list);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeCommandListCreateImmediate Failed with return code: " << to_string(status) << std::endl;
continue;
}

// Create an immediate command list for direct submission
ze_command_queue_desc_t altdesc = {};
altdesc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC;
ze_command_list_handle_t command_list = {};
status = zeCommandListCreateImmediate(context, pDevice, &altdesc, &command_list);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeCommandListCreateImmediate Failed with return code: " << to_string(status) << std::endl;
exit(1);
}
// Create an event to be signaled by the device
ze_event_pool_desc_t ep_desc = {};
ep_desc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
ep_desc.count = 1;
ep_desc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
ze_event_desc_t ev_desc = {};
ev_desc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC;
ev_desc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
ev_desc.wait = ZE_EVENT_SCOPE_FLAG_HOST;
ze_event_handle_t event;
ze_event_pool_handle_t event_pool;

status = zeEventPoolCreate(context, &ep_desc, 1, &pDevice, &event_pool);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeEventPoolCreate Failed with return code: " << to_string(status) << std::endl;
continue;
}

// Create an event to be signaled by the device
ze_event_pool_desc_t ep_desc = {};
ep_desc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC;
ep_desc.count = 1;
ep_desc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
ze_event_desc_t ev_desc = {};
ev_desc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC;
ev_desc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
ev_desc.wait = ZE_EVENT_SCOPE_FLAG_HOST;
ze_event_handle_t event;
ze_event_pool_handle_t event_pool;

status = zeEventPoolCreate(context, &ep_desc, 1, &pDevice, &event_pool);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeEventPoolCreate Failed with return code: " << to_string(status) << std::endl;
exit(1);
}
status = zeEventCreate(event_pool, &ev_desc, &event);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeEventCreate Failed with return code: " << to_string(status) << std::endl;
continue;
}

status = zeEventCreate(event_pool, &ev_desc, &event);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zeEventCreate Failed with return code: " << to_string(status) << std::endl;
exit(1);
}
// signal the event from the device and wait for completion
zeCommandListAppendSignalEvent(command_list, event);
zeEventHostSynchronize(event, UINT64_MAX );
std::cout << "Congratulations, Executing on Driver #" << driver_idx << ", Device #" << 0 << " completed execution!" << std::endl;

// signal the event from the device and wait for completion
zeCommandListAppendSignalEvent(command_list, event);
zeEventHostSynchronize(event, UINT64_MAX );
std::cout << "Congratulations, the device completed execution!\n";

if (!zelCheckIsLoaderInTearDown())
zeContextDestroy(context);
if (!zelCheckIsLoaderInTearDown())
zeCommandListDestroy(command_list);
if (!zelCheckIsLoaderInTearDown())
zeEventDestroy(event);
if (!zelCheckIsLoaderInTearDown())
zeEventPoolDestroy(event_pool);

if (tracing_enabled) {
status = zelTracerDestroy(tracer);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zelTracerDestroy Failed with return code: " << to_string(status) << std::endl;
exit(1);
if (!zelCheckIsLoaderInTearDown())
zeContextDestroy(context);
if (!zelCheckIsLoaderInTearDown())
zeCommandListDestroy(command_list);
if (!zelCheckIsLoaderInTearDown())
zeEventDestroy(event);
if (!zelCheckIsLoaderInTearDown())
zeEventPoolDestroy(event_pool);

if (tracing_enabled) {
status = zelTracerDestroy(tracer);
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zelTracerDestroy Failed with return code: " << to_string(status) << std::endl;
exit(1);
}
}
}

if (tracing_runtime_enabled) {
std::cout << "Disable Tracing Layer after init" << std::endl;
status = zelDisableTracingLayer();
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zelDisableTracingLayer Failed with return code: " << to_string(status) << std::endl;
exit(1);
if (tracing_runtime_enabled) {
std::cout << "Disable Tracing Layer after init" << std::endl;
status = zelDisableTracingLayer();
if(status != ZE_RESULT_SUCCESS) {
std::cout << "zelDisableTracingLayer Failed with return code: " << to_string(status) << std::endl;
exit(1);
}
}
}

Expand Down
19 changes: 18 additions & 1 deletion scripts/generate_code.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (C) 2019-2021 Intel Corporation
Copyright (C) 2019-2025 Intel Corporation

SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -141,6 +141,23 @@ def _mako_loader_cpp(path, namespace, tags, version, specs, meta):
filename = "%s.cpp"%(name)
fout = os.path.join(path, filename)

print("Generating %s..."%fout)
loc += util.makoWrite(
fin, fout,
name=name,
ver=version,
namespace=namespace,
tags=tags,
specs=specs,
meta=meta)

template = "ldrddi_driver_ddi.cpp.mako"
fin = os.path.join(templates_dir, template)

name = "%s_ldrddi_driver_ddi"%(namespace)
filename = "%s.cpp"%(name)
fout = os.path.join(path, filename)

print("Generating %s..."%fout)
loc += util.makoWrite(
fin, fout,
Expand Down
39 changes: 8 additions & 31 deletions scripts/templates/helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (C) 2019-2021 Intel Corporation
Copyright (C) 2019-2025 Intel Corporation

SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -1734,36 +1734,13 @@ def get_version(obj):
if obj_traits.is_function(obj):
ret_version = "ZE_API_VERSION_FORCE_UINT32"
version = obj.get('version')
if version == "1.0":
ret_version = "ZE_API_VERSION_1_0"
if version == "1.1":
ret_version = "ZE_API_VERSION_1_1"
if version == "1.2":
ret_version = "ZE_API_VERSION_1_2"
if version == "1.3":
ret_version = "ZE_API_VERSION_1_3"
if version == "1.4":
ret_version = "ZE_API_VERSION_1_4"
if version == "1.5":
ret_version = "ZE_API_VERSION_1_5"
if version == "1.6":
ret_version = "ZE_API_VERSION_1_6"
if version == "1.7":
ret_version = "ZE_API_VERSION_1_7"
if version == "1.8":
ret_version = "ZE_API_VERSION_1_8"
if version == "1.9":
ret_version = "ZE_API_VERSION_1_9"
if version == "1.10":
ret_version = "ZE_API_VERSION_1_10"
if version == "1.11":
ret_version = "ZE_API_VERSION_1_11"
if version == "1.12":
ret_version = "ZE_API_VERSION_1_12"
if version == "1.13":
ret_version = "ZE_API_VERSION_1_13"
if (ret_version == "ZE_API_VERSION_FORCE_UINT32"):
ret_version = "ZE_API_VERSION_1_0"
if version is not None and version.startswith("1."):
try:
major, minor = version.split(".")
ret_version = f"ZE_API_VERSION_{major}_{minor}"
except Exception:
pass
assert(ret_version != "ZE_API_VERSION_FORCE_UINT32")
return ret_version

"""
Expand Down
Loading
Loading