Skip to content
Draft
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ Runtime-specific dependencies:
| `ONEDNN_CPU_RUNTIME=OMP` | Intel C/C++ Compiler | Intel OpenMP runtime (`libiomp5.so`)
| `ONEDNN_CPU_RUNTIME=OMP` | Clang | Intel OpenMP runtime (`libiomp5.so`)
| `ONEDNN_CPU_RUNTIME=TBB` | any | TBB (`libtbb.so`)
| `ONEDNN_CPU_RUNTIME=SYCL` | Intel oneAPI DPC++ Compiler | Intel oneAPI DPC++ Compiler runtime (`libsycl.so`), TBB (`libtbb.so`), OpenCL loader (`libOpenCL.so`)
| `ONEDNN_CPU_RUNTIME=SYCL` | Intel oneAPI DPC++ Compiler | Intel oneAPI DPC++ Compiler runtime (`libsycl.so`), TBB (`libtbb.so`), OpenCL loader (`libOpenCL.so`), oneAPI Level Zero loader (`libze_loader.so`)
| `ONEDNN_GPU_RUNTIME=OCL` | any | OpenCL loader (`libOpenCL.so`)
| `ONEDNN_GPU_RUNTIME=SYCL` | Intel oneAPI DPC++ Compiler | Intel oneAPI DPC++ Compiler runtime (`libsycl.so`), OpenCL loader (`libOpenCL.so`), oneAPI Level Zero loader (`libze_loader.so`)
| `ONEDNN_GPU_RUNTIME=L0` | any | oneAPI Level Zero loader (`libze_loader.so`)

#### Windows

Expand All @@ -298,6 +298,7 @@ Runtime-specific dependencies:
| `ONEDNN_CPU_RUNTIME=SYCL` | Intel oneAPI DPC++ Compiler | Intel oneAPI DPC++ Compiler runtime (`sycl.dll`), TBB (`tbb.dll`), OpenCL loader (`OpenCL.dll`)
| `ONEDNN_GPU_RUNTIME=OCL` | any | OpenCL loader (`OpenCL.dll`)
| `ONEDNN_GPU_RUNTIME=SYCL` | Intel oneAPI DPC++ Compiler | Intel oneAPI DPC++ Compiler runtime (`sycl.dll`), OpenCL loader (`OpenCL.dll`), oneAPI Level Zero loader (`ze_loader.dll`)
| `ONEDNN_GPU_RUNTIME=L0` | any | oneAPI Level Zero loader (`ze_loader.dll`)

#### macOS

Expand Down
2 changes: 1 addition & 1 deletion cmake/OpenCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(OpenCL_cmake_included true)
if(DNNL_GPU_SYCL AND DNNL_GPU_VENDOR STREQUAL "INTEL")
add_definitions_with_host_compiler(-DCL_TARGET_OPENCL_VERSION=300)
else()
add_definitions(-DCL_TARGET_OPENCL_VERSION=120)
add_definitions(-DCL_TARGET_OPENCL_VERSION=300)
endif()

if(OpenCL_INCLUDE_DIR)
Expand Down
2 changes: 1 addition & 1 deletion cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ set(DNNL_GPU_RUNTIME "NONE" CACHE STRING

Using OpenCL for GPU requires setting OPENCLROOT if the libraries are
installed in a non-standard location.")
if(NOT "${DNNL_GPU_RUNTIME}" MATCHES "^(OCL|NONE|DPCPP|SYCL)$")
if(NOT "${DNNL_GPU_RUNTIME}" MATCHES "^(OCL|NONE|DPCPP|SYCL|L0)$")
message(FATAL_ERROR "Unsupported GPU runtime: ${DNNL_GPU_RUNTIME}")
endif()

Expand Down
2 changes: 1 addition & 1 deletion doc/build/build_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ oneDNN supports the following build-time options.
|:--------------------------------|:----------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------|
| ONEDNN_LIBRARY_TYPE | **SHARED**, STATIC | Defines the resulting library type |
| ONEDNN_CPU_RUNTIME | NONE, **OMP**, TBB, SEQ, THREADPOOL, SYCL | Defines the threading runtime for CPU engines |
| ONEDNN_GPU_RUNTIME | **NONE**, OCL, SYCL | Defines the offload runtime for GPU engines |
| ONEDNN_GPU_RUNTIME | **NONE**, OCL, SYCL, L0 | Defines the offload runtime for GPU engines |
| ONEDNN_BUILD_DOC | **ON**, OFF | Controls building the documentation |
| ONEDNN_DOC_VERSIONS_JSON | **""**, *string* | Location of JSON file for [PyData Sphinx Theme version switcher]. Enables documentation version switcher when set. |
| ONEDNN_BUILD_EXAMPLES | **ON**, OFF | Controls building the examples |
Expand Down
5 changes: 4 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ foreach(f ${sources})
if(NOT DNNL_WITH_SYCL AND ${f_name} MATCHES "^sycl")
list(REMOVE_ITEM sources "${f}")
endif()
if(NOT DNNL_GPU_RUNTIME STREQUAL "L0" AND ${f_name} MATCHES ".*level_zero")
list(REMOVE_ITEM sources "${f}")
endif()
endforeach()

# In case of SYCL, skip CPU examples that directly work with raw pointers
Expand Down Expand Up @@ -202,7 +205,7 @@ foreach(src ${sources})
endif()
else()
set(cpu_rt_pattern "(SEQ|OMP|TBB|SYCL|DPCPP)")
set(gpu_rt_pattern "(OCL|SYCL|DPCPP)")
set(gpu_rt_pattern "(OCL|L0|SYCL|DPCPP)")
if(${example_name} MATCHES "sycl.*")
set(cpu_rt_pattern "(SYCL|DPCPP)")
set(gpu_rt_pattern "(SYCL|DPCPP)")
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ foreach(src ${sources})
endif()
else()
set(cpu_rt_pattern "(SEQ|OMP|TBB|SYCL|DPCPP)")
set(gpu_rt_pattern "(OCL|SYCL|DPCPP)")
set(gpu_rt_pattern "(OCL|L0|SYCL|DPCPP)")
if(${example_name} MATCHES "sycl.*")
set(cpu_rt_pattern "(SYCL|DPCPP)")
set(gpu_rt_pattern "(SYCL|DPCPP)")
Expand Down
5 changes: 4 additions & 1 deletion examples/example_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
#include "dnnl_ocl.h"
#endif
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_L0
#include "dnnl_l0.h"
#endif

#define COMPLAIN_DNNL_ERROR_AND_EXIT(what, status) \
do { \
Expand Down Expand Up @@ -160,7 +163,7 @@ static inline void write_to_dnnl_memory(void *handle, dnnl_memory_t mem) {
}
#endif

#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL || DNNL_GPU_RUNTIME == DNNL_RUNTIME_L0
if (eng_kind == dnnl_gpu) {
void *mapped_ptr = NULL;
CHECK(dnnl_memory_map_data(mem, &mapped_ptr));
Expand Down
10 changes: 7 additions & 3 deletions examples/example_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@

#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
#include "dnnl_ocl.hpp"
#elif DNNL_GPU_RUNTIME == DNNL_RUNTIME_SYCL
#endif
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_L0
#include "dnnl_l0.hpp"
#endif
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_SYCL
#include "dnnl_sycl.hpp"
#endif

Expand Down Expand Up @@ -228,7 +232,7 @@ inline void read_from_dnnl_memory(void *handle, dnnl::memory &mem) {
return;
}
#endif
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL || DNNL_GPU_RUNTIME == DNNL_RUNTIME_L0
if (eng.get_kind() == dnnl::engine::kind::gpu) {
void *mapped_ptr = mem.map_data();
if (mapped_ptr) std::memcpy(handle, mapped_ptr, size);
Expand Down Expand Up @@ -287,7 +291,7 @@ inline void write_to_dnnl_memory(void *handle, dnnl::memory &mem) {
return;
}
#endif
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL
#if DNNL_GPU_RUNTIME == DNNL_RUNTIME_OCL || DNNL_GPU_RUNTIME == DNNL_RUNTIME_L0
if (eng.get_kind() == dnnl::engine::kind::gpu) {
void *mapped_ptr = mem.map_data();
if (mapped_ptr) std::memcpy(mapped_ptr, handle, size);
Expand Down
22 changes: 22 additions & 0 deletions include/dnnl_l0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*******************************************************************************
* Copyright 2025 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#ifndef DNNL_L0_H
#define DNNL_L0_H

#include "oneapi/dnnl/dnnl_l0.h"

#endif /* DNNL_L0_H */
22 changes: 22 additions & 0 deletions include/dnnl_l0.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*******************************************************************************
* Copyright 2025 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#ifndef DNNL_L0_HPP
#define DNNL_L0_HPP

#include "oneapi/dnnl/dnnl_l0.hpp"

#endif /* DNNL_L0_HPP */
9 changes: 5 additions & 4 deletions include/oneapi/dnnl/dnnl_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
/// DPC++ runtime
#define DNNL_RUNTIME_DPCPP DNNL_RUNTIME_SYCL

/// L0 runtime
#define DNNL_RUNTIME_L0 1024u

/// No vendor (corresponding runtime is disabled)
#define DNNL_VENDOR_NONE 0u

Expand Down Expand Up @@ -119,7 +122,8 @@
#endif
#if (DNNL_GPU_RUNTIME != DNNL_RUNTIME_NONE) \
&& (DNNL_GPU_RUNTIME != DNNL_RUNTIME_OCL) \
&& (DNNL_GPU_RUNTIME != DNNL_RUNTIME_SYCL)
&& (DNNL_GPU_RUNTIME != DNNL_RUNTIME_SYCL) \
&& (DNNL_GPU_RUNTIME != DNNL_RUNTIME_L0)
#error "Unexpected DNNL_GPU_RUNTIME"
#endif
#if (DNNL_CPU_RUNTIME == DNNL_RUNTIME_NONE \
Expand All @@ -145,9 +149,6 @@
// When defined, DPCPP is supported.
#cmakedefine DNNL_WITH_SYCL

// When defined, Level Zero is supported.
#cmakedefine DNNL_WITH_LEVEL_ZERO

// When defined, SYCL CUDA backend is used.
#cmakedefine DNNL_SYCL_CUDA

Expand Down
Loading
Loading