OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[GPU] SYCL infra for GPU plugin and GHA pipeline (#26067)
Vladimir Paramuzov407b012ce353
diff --git a/.github/dockerfiles/docker_tag b/.github/dockerfiles/docker_tagindex 38479d3f743..5bd51d5f043 100644--- a/.github/dockerfiles/docker_tag+++ b/.github/dockerfiles/docker_tag@@ -1 +1 @@-pr-25992\ No newline at end of file+pr-26067diff --git a/.github/dockerfiles/ov_build/ubuntu_22_04_x64_dpcpp/Dockerfile b/.github/dockerfiles/ov_build/ubuntu_22_04_x64_dpcpp/Dockerfilenew file mode 100644index 00000000000..292ae46cab9--- /dev/null+++ b/.github/dockerfiles/ov_build/ubuntu_22_04_x64_dpcpp/Dockerfile@@ -0,0 +1,95 @@+FROM openvinogithubactions.azurecr.io/dockerhub/ubuntu:22.04++USER root++# APT configuration+RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf && \+ echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf && \+ echo 'APT::Get::Fix-Broken "true";' >> /etc/apt/apt.conf && \+ echo 'APT::Get::no-install-recommends "true";' >> /etc/apt/apt.conf++ENV DEBIAN_FRONTEND="noninteractive" \+ TZ="Europe/London"++RUN apt-get update && \+ apt-get install software-properties-common && \+ add-apt-repository --yes --no-update ppa:git-core/ppa && \+ add-apt-repository --yes --no-update ppa:deadsnakes/ppa && \+ apt-get update && \+ apt-get install \+ wget \+ curl \+ git \+ ca-certificates \+ gpg-agent \+ tzdata \+ libtbb2 \+ # Pythons \+ python3.11-dev \+ python3.11-venv \+ python3.11-distutils \+ default-jdk \+ && \+ rm -rf /var/lib/apt/lists/*+++# Install OneAPI Toolkit+RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/intel-oneapi-archive-keyring.gpg > /dev/null+RUN echo "deb [signed-by=/usr/share/keyrings/intel-oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main " > /etc/apt/sources.list.d/oneAPI.list++RUN apt-get update && \+ apt-get install \+ intel-oneapi-compiler-dpcpp-cpp=2024.2.1-1079 \+ && \+ rm -rf /var/lib/apt/lists/*++# Install build dependencies+ADD install_build_dependencies.sh /install_build_dependencies.sh+RUN chmod +x /install_build_dependencies.sh && \+ /install_build_dependencies.sh && \+ rm -rf /var/lib/apt/lists/*++# Install sscache+ARG SCCACHE_VERSION="v0.7.5"+ENV SCCACHE_HOME="/opt/sccache" \+ SCCACHE_PATH="/opt/sccache/sccache"++RUN mkdir ${SCCACHE_HOME} && cd ${SCCACHE_HOME} && \+ SCCACHE_ARCHIVE="sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" && \+ curl -SLO https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/${SCCACHE_ARCHIVE} && \+ tar -xzf ${SCCACHE_ARCHIVE} --strip-components=1 && rm ${SCCACHE_ARCHIVE}++# Setup pip+ENV PIP_VERSION="24.0"+RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \+ python3 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \+ python3.11 get-pip.py --no-cache-dir pip==${PIP_VERSION} && \+ rm -f get-pip.py++# Use Python 3.11 as default+# Using venv here 'cause other methods to switch the default Python on Ubuntu break both system and wheels build+RUN python3.11 -m venv venv+ENV PATH="/venv/bin:$SCCACHE_HOME:$PATH"++ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION}++# OneAPI env+ENV ONEAPI_ROOT=/opt/intel/oneapi+ENV PKG_CONFIG_PATH=/opt/intel/oneapi/compiler/2024.2/lib/pkgconfig+ENV DIAGUTIL_PATH=/opt/intel/oneapi/dpcpp-ct/2024.2/etc/dpct/sys_check/sys_check.sh:/opt/intel/oneapi/debugger/2024.2/etc/debugger/sys_check/sys_check.py:/opt/intel/oneapi/compiler/2024.2/etc/compiler/sys_check/sys_check.sh+ENV MANPATH=/opt/intel/oneapi/debugger/2024.2/share/man:/opt/intel/oneapi/compiler/2024.2/share/man:+ENV GDB_INFO=/opt/intel/oneapi/debugger/2024.2/share/info/+ENV CMAKE_PREFIX_PATH=/opt/intel/oneapi/compiler/2024.2+ENV CMPLR_ROOT=/opt/intel/oneapi/compiler/2024.2+ENV INFOPATH=/opt/intel/oneapi/debugger/2024.2/share/info+ENV LIBRARY_PATH=/opt/intel/oneapi/compiler/2024.2/lib+ENV OCL_ICD_FILENAMES=/opt/intel/oneapi/compiler/2024.2/lib/libintelocl.so+ENV LD_LIBRARY_PATH=/opt/intel/oneapi/debugger/2024.2/opt/debugger/lib:/opt/intel/oneapi/compiler/2024.2/opt/compiler/lib:/opt/intel/oneapi/compiler/2024.2/lib+ENV NLSPATH=/opt/intel/oneapi/mkl/2024.2/share/locale/%l_%t/%N:/opt/intel/oneapi/compiler/2024.2/lib/compiler/locale/%l_%t/%N+ENV PATH=$PATH:/opt/intel/oneapi/dev-utilities/2024.2/bin:/opt/intel/oneapi/debugger/2024.2/opt/debugger/bin:/opt/intel/oneapi/compiler/2024.2/bin+ENV INTEL_PYTHONHOME=/opt/intel/oneapi/debugger/2024.2/opt/debugger+ENV CPATH=/opt/intel/oneapi/dpl/2022.6/include:/opt/intel/oneapi/dev-utilities/2024.2/include:++# Set Intel DPC++ as a default compiler+ENV CC=icx+ENV CXX=icpxdiff --git a/.github/workflows/ubuntu_22_dpcpp.yml b/.github/workflows/ubuntu_22_dpcpp.ymlnew file mode 100644index 00000000000..4af7b08a334--- /dev/null+++ b/.github/workflows/ubuntu_22_dpcpp.yml@@ -0,0 +1,90 @@+name: Linux (Ubuntu 22.04, Python 3.11, Intel DPC++ Compiler)+on:+ workflow_dispatch:+ pull_request:+ merge_group:++concurrency:+ # github.ref is not unique in post-commit+ group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-ubuntu-22-dpcpp+ cancel-in-progress: true++permissions: read-all++jobs:+ Smart_CI:+ runs-on: ubuntu-latest+ outputs:+ affected_components: "${{ steps.smart_ci.outputs.affected_components }}"+ changed_components: "${{ steps.smart_ci.outputs.changed_components }}"+ skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}"+ steps:+ - name: checkout action+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7+ with:+ sparse-checkout: .github/actions/smart-ci++ - name: Get affected components+ id: smart_ci+ uses: ./.github/actions/smart-ci+ with:+ repository: ${{ github.repository }}+ pr: ${{ github.event.number }}+ commit_sha: ${{ github.sha }}+ ref_name: ${{ github.ref_name }}+ component_pattern: "category: (.*)"+ repo_token: ${{ secrets.GITHUB_TOKEN }}+ skip_when_only_listed_labels_set: 'docs'+ skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg'++ - name: Show affected components+ run: |+ echo "${{ toJSON(steps.smart_ci.outputs.affected_components) }}"+ shell: bash++ Docker:+ needs: Smart_CI+ runs-on: aks-linux-4-cores-16gb-docker-build+ container:+ image: openvinogithubactions.azurecr.io/docker_build:0.2+ volumes:+ - /mount:/mount+ outputs:+ images: "${{ steps.handle_docker.outputs.images }}"+ steps:+ - name: Checkout+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7++ - uses: ./.github/actions/handle_docker+ id: handle_docker+ with:+ images: |+ ov_build/ubuntu_22_04_x64_dpcpp+ registry: 'openvinogithubactions.azurecr.io'+ dockerfiles_root_dir: '.github/dockerfiles'+ changed_components: ${{ needs.smart_ci.outputs.changed_components }}++ Build:+ needs: [Docker, Smart_CI]+ if: "!needs.smart_ci.outputs.skip_workflow"+ uses: ./.github/workflows/job_build_linux.yml+ with:+ runner: 'aks-linux-16-cores-32gb'+ container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_22_04_x64_dpcpp }}", "volumes": ["/mount:/mount"], "options": "-e SCCACHE_AZURE_BLOB_CONTAINER -e SCCACHE_AZURE_CONNECTION_STRING"}'+ affected-components: ${{ needs.smart_ci.outputs.affected_components }}+ event-name: ${{ github.event_name }}+ os: 'ubuntu_22_04_dpcpp'++ Overall_Status:+ name: ci/gha_overall_status_ubuntu_22.04_dpcpp+ needs: [Smart_CI, Build]+ if: ${{ always() }}+ runs-on: ubuntu-latest+ steps:+ - name: Check status of all jobs+ if: >-+ ${{+ contains(needs.*.result, 'failure') ||+ contains(needs.*.result, 'cancelled')+ }}+ run: exit 1diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmakeindex a49dce9bce7..bb80787ee3d 100644--- a/cmake/developer_package/compile_flags/os_flags.cmake+++ b/cmake/developer_package/compile_flags/os_flags.cmake@@ -289,6 +289,8 @@ endif()if(NOT DEFINED CMAKE_CXX_STANDARD)if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")set(CMAKE_CXX_STANDARD 14)+ elseif(OV_COMPILER_IS_INTEL_LLVM)+ set(CMAKE_CXX_STANDARD 17)else()set(CMAKE_CXX_STANDARD 11)endif()diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.hpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.hppindex 46e06466d5f..237860ec692 100644--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.hpp+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.hpp@@ -34,6 +34,7 @@ struct PagedAttentionExecutor {static const size_t ID_ALIBI_SLOPES = 11; // [H|0], floatstatic const size_t ID_MAX_CONTEXT_LEN = 12; // []virtual void execute(const std::vector<ov::intel_cpu::MemoryPtr>& inputs, const std::vector<ov::intel_cpu::MemoryPtr> outputs) = 0;+ virtual ~PagedAttentionExecutor() = default;};#ifdef OPENVINO_ARCH_X86_64diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txtindex 53b4a203301..795d259b277 100644--- a/src/plugins/intel_gpu/CMakeLists.txt+++ b/src/plugins/intel_gpu/CMakeLists.txt@@ -8,6 +8,10 @@ endif()set (TARGET_NAME "openvino_intel_gpu_plugin")+if(OV_COMPILER_IS_INTEL_LLVM)+ find_package(IntelSYCL REQUIRED)+endif()+if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")endif()diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hppindex fa8a8807bbd..3e8887fbb2f 100644--- a/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hpp+++ b/src/plugins/intel_gpu/include/intel_gpu/graph/kernel_impl_params.hpp@@ -90,7 +90,7 @@ struct kernel_impl_params final {, primary_input_idx(0) {}- virtual ~kernel_impl_params() = default;+ ~kernel_impl_params() = default;const layout& get_input_layout(size_t idx = 0) const {OPENVINO_ASSERT(input_layouts.size() > idx,diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/implementation_desc.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/implementation_desc.hppindex 4e5c53d6b37..e84311a9cfb 100644--- a/src/plugins/intel_gpu/include/intel_gpu/primitives/implementation_desc.hpp+++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/implementation_desc.hpp@@ -18,6 +18,7 @@ enum class impl_types : uint8_t {common = 1 << 1,ocl = 1 << 2,onednn = 1 << 3,+ sycl = 1 << 4,any = 0xFF,};diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/engine_configuration.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/engine_configuration.hppindex 042fa7cfd3d..e81dd9dec9d 100644--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/engine_configuration.hpp+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/engine_configuration.hpp@@ -11,11 +11,13 @@ namespace cldnn {/// @brief Defines available engine typesenum class engine_types : int32_t {ocl,+ sycl};inline std::ostream& operator<<(std::ostream& os, const engine_types& type) {switch (type) {case engine_types::ocl: os << "ocl"; break;+ case engine_types::sycl: os << "sycl"; break;default: os << "unknown"; break;}diff --git a/src/plugins/intel_gpu/src/graph/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/CMakeLists.txtindex db25a90e42b..d82984205c0 100644--- a/src/plugins/intel_gpu/src/graph/CMakeLists.txt+++ b/src/plugins/intel_gpu/src/graph/CMakeLists.txt@@ -4,6 +4,7 @@set(TARGET_NAME "openvino_intel_gpu_graph")+file(GLOB_RECURSE SYCL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/impls/sycl/*")file(GLOB_RECURSE LIBRARY_SRC"${INCLUDE_DIR}/*.h""${INCLUDE_DIR}/*.hpp"@@ -22,6 +23,10 @@ if (NOT ENABLE_ONEDNN_FOR_GPU)endforeach(SOURCE_FILE)endif()+if(NOT OV_COMPILER_IS_INTEL_LLVM)+ list(REMOVE_ITEM LIBRARY_SRC ${SYCL_SOURCES})+endif()+add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC})target_include_directories(${TARGET_NAME} PUBLIC@@ -33,6 +38,11 @@ target_include_directories(${TARGET_NAME} PUBLICtarget_compile_options(${TARGET_NAME} PRIVATE$<$<CONFIG:Release>:$<IF:$<CXX_COMPILER_ID:MSVC>,/Os,-Os>>)+if(OV_COMPILER_IS_INTEL_LLVM)+ add_sycl_to_target(TARGET ${TARGET_NAME} SOURCES ${SYCL_SOURCES})+ target_compile_definitions(${TARGET_NAME} PUBLIC OV_GPU_WITH_SYCL)+endif()+target_link_libraries(${TARGET_NAME} PUBLIC OpenCL::OpenCL openvino::shape_inference)target_link_libraries(${TARGET_NAME} PRIVATE openvino_intel_gpu_kernelsopenvino_intel_gpu_runtimediff --git a/src/plugins/intel_gpu/src/graph/impls/sycl/README.md b/src/plugins/intel_gpu/src/graph/impls/sycl/README.mdnew file mode 100644index 00000000000..851ef8f5d18--- /dev/null+++ b/src/plugins/intel_gpu/src/graph/impls/sycl/README.md@@ -0,0 +1,16 @@+# How to build with DPC++ support++1. Install OneAPI base toolkit. Guide: https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2024-0/installation.html+2. Export environment:+ $ source /opt/intel/oneapi/setvars.sh++3. configure cmake with the following additional options:+ - `-DCMAKE_CXX_FLAGS:STRING=--gcc-install-dir=/lib/gcc/x86_64-linux-gnu/12/ -DCMAKE_C_FLAGS:STRING=--gcc-install-dir=/lib/gcc/x86_64-linux-gnu/12/`+ - This WA is needed if multiple GCC version available in the system+ - `-DCMAKE_CXX_STANDARD:STRING=17`+ - Sycl requires c++17+ - `-DENABLE_SYSTEM_OPENCL=OFF`+ - May help to avoid opencl icd/header conflicts as sycl package may have no clhpp headers+ - `-DCMAKE_C_COMPILER:FILEPATH=icx -DCMAKE_CXX_COMPILER:FILEPATH=icpx`+ - For now find_package(IntelSYCL) doesn't work if compiler is not icpx+4. make -j$(nproc)diff --git a/src/plugins/intel_gpu/src/graph/impls/sycl/primitive_sycl_base.h b/src/plugins/intel_gpu/src/graph/impls/sycl/primitive_sycl_base.hnew file mode 100644index 00000000000..a6b0e3512e8--- /dev/null+++ b/src/plugins/intel_gpu/src/graph/impls/sycl/primitive_sycl_base.h@@ -0,0 +1,90 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "primitive_inst.h"+#include "intel_gpu/runtime/memory.hpp"+#include "register.hpp"+#include "utils.hpp"+#include "runtime/ocl/ocl_event.hpp"++#include <vector>++#include "sycl/sycl.hpp"++namespace cldnn {+namespace sycl {++static std::mutex cacheAccessMutex;++template <class PType>+struct typed_primitive_sycl_impl : public typed_primitive_impl<PType> {+ const engine* _engine;++ typed_primitive_sycl_impl(const engine& engine, const ExecutionConfig& config, std::shared_ptr<WeightsReorderParams> weights_reorder = nullptr)+ : typed_primitive_impl<PType>(weights_reorder, "sycl_kernel"),+ _engine(&engine) { }++ typed_primitive_sycl_impl()+ : typed_primitive_impl<PType>({}, "undef"),+ _engine(nullptr) {+ }++ bool is_cpu() const override { return false; }+ bool is_onednn() const override { return false; }++ void save(BinaryOutputBuffer& ob) const override {+ }++ void load(BinaryInputBuffer& ib) override {+ }++protected:+ void init_kernels(const kernels_cache&, const kernel_impl_params&) override { }++ void set_arguments_impl(typed_primitive_inst<PType>& instance) override {+ if (instance.can_be_optimized())+ return;+ }++ void update_dispatch_data(const kernel_impl_params& impl_params) override {}++ void set_arguments_impl(typed_primitive_inst<PType>& instance, kernel_arguments_data& args) override {+ if (instance.can_be_optimized()) {+ return;+ }+ }++ event::ptr execute_impl(const std::vector<event::ptr>& /* events */,+ typed_primitive_inst<PType>& instance) override {+ auto& network = instance.get_network();+ auto& stream = network.get_stream();+ auto net_id = network.get_id();+ event::ptr event;+++ return event;+ }++ static event::ptr to_ocl_event(stream& stream, ::sycl::event e) {+ if (stream.get_queue_type() == QueueTypes::out_of_order) {+ auto native_events = get_native<::sycl::backend::opencl, ::sycl::event>(e);+ std::vector<event::ptr> events;+ for (auto& e : native_events) {+ events.push_back(std::make_shared<ocl::ocl_event>(cl::Event(e, true)));+ }+ return events.empty() ? stream.create_user_event(true) : stream.group_events(events);+ } else {+ return stream.create_user_event(true);+ }+ }++ std::vector<layout> get_internal_buffer_layouts_impl() const override {+ return {};+ }+};++} // namespace sycl+} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/graph/impls/sycl/register.cpp b/src/plugins/intel_gpu/src/graph/impls/sycl/register.cppnew file mode 100644index 00000000000..9d2ae6808fb--- /dev/null+++ b/src/plugins/intel_gpu/src/graph/impls/sycl/register.cpp@@ -0,0 +1,17 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "register.hpp"++namespace cldnn {+namespace sycl {++#define REGISTER_SYCL_IMPL(prim) \+ static detail::attach_##prim##_sycl attach_##prim++void register_implementations() {+}++} // namespace sycl+} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/graph/impls/sycl/register.hpp b/src/plugins/intel_gpu/src/graph/impls/sycl/register.hppnew file mode 100644index 00000000000..38fa9df02c5--- /dev/null+++ b/src/plugins/intel_gpu/src/graph/impls/sycl/register.hpp@@ -0,0 +1,23 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once+++namespace cldnn {+namespace sycl {+void register_implementations();++namespace detail {++#define REGISTER_SYCL_IMPL(prim) \+ struct attach_##prim##_sycl { \+ attach_##prim##_sycl(); \+ }++#undef REGISTER_SYCL_IMPL++} // namespace detail+} // namespace sycl+} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/graph/program.cpp b/src/plugins/intel_gpu/src/graph/program.cppindex 820bb87f4a9..40d858c38fe 100644--- a/src/plugins/intel_gpu/src/graph/program.cpp+++ b/src/plugins/intel_gpu/src/graph/program.cpp@@ -75,6 +75,9 @@#ifdef ENABLE_ONEDNN_FOR_GPU#include "impls/onednn/register.hpp"#endif+#ifdef OV_GPU_WITH_SYCL+#include "impls/sycl/register.hpp"+#endif#include "kernel_base.h"@@ -257,6 +260,9 @@ void program::init_primitives() {onednn::register_implementations();#endifcpu::register_implementations();+#ifdef OV_GPU_WITH_SYCL+ sycl::register_implementations();+#endifis_initialized = true;}}diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cppindex e3f7c2cfe2f..69bc3a912fd 100644--- a/src/plugins/intel_gpu/src/plugin/plugin.cpp+++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp@@ -145,7 +145,11 @@ Plugin::Plugin() {register_primitives();// Set OCL runtime which should be always available+#ifdef OV_GPU_WITH_SYCL+ cldnn::device_query device_query(cldnn::engine_types::sycl, cldnn::runtime_types::ocl);+#elsecldnn::device_query device_query(cldnn::engine_types::ocl, cldnn::runtime_types::ocl);+#endifm_device_map = device_query.get_available_devices();// Set default configs for each devicediff --git a/src/plugins/intel_gpu/src/plugin/remote_context.cpp b/src/plugins/intel_gpu/src/plugin/remote_context.cppindex b36fe7f38a7..6d24eaea401 100644--- a/src/plugins/intel_gpu/src/plugin/remote_context.cpp+++ b/src/plugins/intel_gpu/src/plugin/remote_context.cpp@@ -28,7 +28,12 @@ Type extract_object(const ov::AnyMap& params, const ov::Property<Type>& p) {RemoteContextImpl::RemoteContextImpl(const std::string& device_name, std::vector<cldnn::device::ptr> devices) : m_device_name(device_name) {OPENVINO_ASSERT(devices.size() == 1, "[GPU] Currently context can be created for single device only");+#ifdef OV_GPU_WITH_SYCL+ const auto engine_type = cldnn::engine_types::sycl;+#elseconst auto engine_type = cldnn::engine_types::ocl;+#endif+const auto runtime_type = cldnn::runtime_types::ocl;m_engine = cldnn::engine::create(engine_type, runtime_type, devices.front());diff --git a/src/plugins/intel_gpu/src/runtime/CMakeLists.txt b/src/plugins/intel_gpu/src/runtime/CMakeLists.txtindex 1439620b71e..23fce3a3354 100644--- a/src/plugins/intel_gpu/src/runtime/CMakeLists.txt+++ b/src/plugins/intel_gpu/src/runtime/CMakeLists.txt@@ -21,6 +21,12 @@ set(LIBRARY_SOURCES_ALL${LIBRARY_SOURCES_OCL})+file(GLOB_RECURSE SYCL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ocl/sycl_*.cpp")++if(NOT OV_COMPILER_IS_INTEL_LLVM)+ list(REMOVE_ITEM LIBRARY_SOURCES_ALL ${SYCL_SOURCES})+endif()+add_library(${TARGET_NAME} STATIC ${LIBRARY_SOURCES_ALL})if(NOT BUILD_SHARED_LIBS)@@ -44,6 +50,11 @@ target_compile_options(${TARGET_NAME} PRIVATEadd_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})+if(OV_COMPILER_IS_INTEL_LLVM)+ add_sycl_to_target(TARGET ${TARGET_NAME} SOURCES ${SYCL_SOURCES})+ target_compile_definitions(${TARGET_NAME} PUBLIC OV_GPU_WITH_SYYCL)+endif()+ov_set_threading_interface_for(${TARGET_NAME})target_link_libraries(${TARGET_NAME} PRIVATEdiff --git a/src/plugins/intel_gpu/src/runtime/device_query.cpp b/src/plugins/intel_gpu/src/runtime/device_query.cppindex 7cb419deee4..4306e7aada8 100644--- a/src/plugins/intel_gpu/src/runtime/device_query.cpp+++ b/src/plugins/intel_gpu/src/runtime/device_query.cpp@@ -17,6 +17,7 @@ device_query::device_query(engine_types engine_type,int ctx_device_id,int target_tile_id) {switch (engine_type) {+ case engine_types::sycl:case engine_types::ocl: {if (runtime_type != runtime_types::ocl)throw std::runtime_error("Unsupported runtime type for ocl engine");diff --git a/src/plugins/intel_gpu/src/runtime/engine.cpp b/src/plugins/intel_gpu/src/runtime/engine.cppindex e8879905ffe..7d1d016b77b 100644--- a/src/plugins/intel_gpu/src/runtime/engine.cpp+++ b/src/plugins/intel_gpu/src/runtime/engine.cpp@@ -252,6 +252,11 @@ void engine::subtract_memory_used(uint64_t bytes, allocation_type type) {std::shared_ptr<cldnn::engine> engine::create(engine_types engine_type, runtime_types runtime_type, const device::ptr device) {std::shared_ptr<cldnn::engine> ret;switch (engine_type) {+#ifdef OV_GPU_WITH_SYCL+ case engine_types::sycl:+ ret = ocl::create_sycl_engine(device, runtime_type);+ break;+#endif // OV_GPU_WITH_SYCLcase engine_types::ocl:ret = ocl::create_ocl_engine(device, runtime_type);break;diff --git a/src/plugins/intel_gpu/src/runtime/kernels_cache.cpp b/src/plugins/intel_gpu/src/runtime/kernels_cache.cppindex 3f19b348cca..d6dcaf5dd72 100644--- a/src/plugins/intel_gpu/src/runtime/kernels_cache.cpp+++ b/src/plugins/intel_gpu/src/runtime/kernels_cache.cpp@@ -620,7 +620,7 @@ void kernels_cache::add_to_cached_kernels(const std::vector<kernel::ptr>& kernel}void kernels_cache::save(BinaryOutputBuffer& ob) const {- OPENVINO_ASSERT(_engine.type() == engine_types::ocl, "[GPU] Not supported engine type");+ OPENVINO_ASSERT(_engine.type() == engine_types::ocl || _engine.type() == engine_types::sycl, "[GPU] Not supported engine type");ob << _cached_binaries.size();for (auto& cached_binary : _cached_binaries) {@@ -630,7 +630,7 @@ void kernels_cache::save(BinaryOutputBuffer& ob) const {}void kernels_cache::load(BinaryInputBuffer& ib) {- OPENVINO_ASSERT(_engine.type() == engine_types::ocl, "[GPU] Not supported engine type");+ OPENVINO_ASSERT(_engine.type() == engine_types::ocl || _engine.type() == engine_types::sycl, "[GPU] Not supported engine type");std::unordered_map<uint32_t, std::vector<unsigned char>> precompiled_kernels;diff --git a/src/plugins/intel_gpu/src/runtime/kernels_factory.cpp b/src/plugins/intel_gpu/src/runtime/kernels_factory.cppindex 7dd7be87365..448afa86360 100644--- a/src/plugins/intel_gpu/src/runtime/kernels_factory.cpp+++ b/src/plugins/intel_gpu/src/runtime/kernels_factory.cpp@@ -10,7 +10,9 @@ namespace kernels_factory {std::shared_ptr<kernel> create(engine& engine, cl_context context, cl_kernel kernel, std::string entry_point) {switch (engine.type()) {- case engine_types::ocl: return ocl::create_ocl_kernel(engine, context, kernel, entry_point);+ case engine_types::sycl:+ case engine_types::ocl:+ return ocl::create_ocl_kernel(engine, context, kernel, entry_point);default: throw std::runtime_error("Unsupported engine type in kernels_factory::create");}}diff --git a/src/plugins/intel_gpu/src/runtime/memory.cpp b/src/plugins/intel_gpu/src/runtime/memory.cppindex 4e7f9b37c39..5e79af34c6c 100644--- a/src/plugins/intel_gpu/src/runtime/memory.cpp+++ b/src/plugins/intel_gpu/src/runtime/memory.cpp@@ -47,7 +47,9 @@ memory::memory(engine* engine, const layout& layout, allocation_type type, std::std::unique_ptr<surfaces_lock> surfaces_lock::create(engine_types engine_type, std::vector<memory::ptr> mem, const stream& stream) {switch (engine_type) {- case engine_types::ocl: return std::unique_ptr<ocl::ocl_surfaces_lock>(new ocl::ocl_surfaces_lock(mem, stream));+ case engine_types::sycl:+ case engine_types::ocl:+ return std::unique_ptr<ocl::ocl_surfaces_lock>(new ocl::ocl_surfaces_lock(mem, stream));default: throw std::runtime_error("Unsupported engine type in surfaces_lock::create");}}diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine_factory.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine_factory.hppindex fad0a483e0c..2ddfe28ceeb 100644--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine_factory.hpp+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine_factory.hpp@@ -14,6 +14,9 @@ namespace ocl {// Factory for ocl_engine creation. It's moved outside of ocl_engine class to avoid possible CL includes conflict// between different engines in engine.cpp filestd::shared_ptr<cldnn::engine> create_ocl_engine(const device::ptr device, runtime_types runtime_type);+#ifdef OV_GPU_WITH_SYCL+std::shared_ptr<cldnn::engine> create_sycl_engine(const device::ptr device, runtime_types runtime_type);+#endif // OV_GPU_WITH_SYCL} // namespace ocl} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/runtime/ocl/sycl_engine.cpp b/src/plugins/intel_gpu/src/runtime/ocl/sycl_engine.cppnew file mode 100644index 00000000000..b5da32efbfa--- /dev/null+++ b/src/plugins/intel_gpu/src/runtime/ocl/sycl_engine.cpp@@ -0,0 +1,37 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "sycl_engine.hpp"+#include "sycl_stream.hpp"+++namespace cldnn {+namespace ocl {+++sycl_engine::sycl_engine(const device::ptr dev, runtime_types runtime_type)+ : ocl_engine(dev, runtime_type) {+ sycl_context = cldnn::make_unique<::sycl::context>(sycl::make_context<::sycl::backend::opencl>(get_cl_context().get()));+}++stream::ptr sycl_engine::create_stream(const ExecutionConfig& config) const {+ return std::make_shared<sycl_stream>(*this, config);+}++stream::ptr sycl_engine::create_stream(const ExecutionConfig& config, void* handle) const {+ return std::make_shared<sycl_stream>(*this, config, handle);+}++std::shared_ptr<cldnn::engine> create_sycl_engine(const device::ptr device, runtime_types runtime_type) {+ return std::make_shared<sycl_engine>(device, runtime_type);+}++::sycl::context& sycl_engine::get_sycl_context() const {+ OPENVINO_ASSERT(sycl_context != nullptr);++ return *sycl_context;+}++} // namespace ocl+} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/runtime/ocl/sycl_engine.hpp b/src/plugins/intel_gpu/src/runtime/ocl/sycl_engine.hppnew file mode 100644index 00000000000..253f6af6795--- /dev/null+++ b/src/plugins/intel_gpu/src/runtime/ocl/sycl_engine.hpp@@ -0,0 +1,28 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include <memory>+#include "ocl_engine.hpp"++#include "sycl/sycl.hpp"+++namespace cldnn {+namespace ocl {++class sycl_engine : public ocl_engine {+public:+ sycl_engine(const device::ptr dev, runtime_types runtime_type);++ stream_ptr create_stream(const ExecutionConfig& config) const override;+ stream_ptr create_stream(const ExecutionConfig& config, void *handle) const override;++ ::sycl::context& get_sycl_context() const;+ std::unique_ptr<::sycl::context> sycl_context = nullptr;+};++} // namespace ocl+} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/runtime/ocl/sycl_stream.cpp b/src/plugins/intel_gpu/src/runtime/ocl/sycl_stream.cppnew file mode 100644index 00000000000..e9be7a060ba--- /dev/null+++ b/src/plugins/intel_gpu/src/runtime/ocl/sycl_stream.cpp@@ -0,0 +1,30 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "sycl_stream.hpp"+#include "intel_gpu/runtime/utils.hpp"+#include "sycl_engine.hpp"++namespace cldnn {+namespace ocl {+++sycl_stream::sycl_stream(const sycl_engine& engine, const ExecutionConfig& config)+ : ocl_stream(engine, config) {+ sycl_queue = cldnn::make_unique<::sycl::queue>(::sycl::make_queue<::sycl::backend::opencl>(get_cl_queue().get(), engine.get_sycl_context()));+}+++sycl_stream::sycl_stream(const sycl_engine &engine, const ExecutionConfig& config, void *handle)+ : ocl_stream(engine, config, handle) {+ sycl_queue = cldnn::make_unique<::sycl::queue>(::sycl::make_queue<::sycl::backend::opencl>(get_cl_queue().get(), engine.get_sycl_context()));+}++::sycl::queue& sycl_stream::get_sycl_queue() {+ OPENVINO_ASSERT(sycl_queue != nullptr);+ return *sycl_queue;+}++} // namespace ocl+} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/runtime/ocl/sycl_stream.hpp b/src/plugins/intel_gpu/src/runtime/ocl/sycl_stream.hppnew file mode 100644index 00000000000..208b155d519--- /dev/null+++ b/src/plugins/intel_gpu/src/runtime/ocl/sycl_stream.hpp@@ -0,0 +1,26 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "ocl_stream.hpp"+#include "sycl_engine.hpp"++#include "sycl/sycl.hpp"+++namespace cldnn {+namespace ocl {++class sycl_stream : public ocl_stream {+public:+ sycl_stream(const sycl_engine& engine, const ExecutionConfig& config);+ sycl_stream(const sycl_engine &engine, const ExecutionConfig& config, void *handle);++ ::sycl::queue& get_sycl_queue();+ std::unique_ptr<::sycl::queue> sycl_queue = nullptr;+};++} // namespace ocl+} // namespace cldnndiff --git a/src/plugins/intel_gpu/src/runtime/stream.cpp b/src/plugins/intel_gpu/src/runtime/stream.cppindex 0ee63a78b80..0fab4d38a14 100644--- a/src/plugins/intel_gpu/src/runtime/stream.cpp+++ b/src/plugins/intel_gpu/src/runtime/stream.cpp@@ -12,7 +12,9 @@ namespace cldnn {QueueTypes stream::detect_queue_type(engine_types engine_type, void* queue_handle) {switch (engine_type) {- case engine_types::ocl: return ocl::ocl_stream::detect_queue_type(queue_handle);+ case engine_types::sycl:+ case engine_types::ocl:+ return ocl::ocl_stream::detect_queue_type(queue_handle);default: throw std::runtime_error("Invalid engine type");}}diff --git a/src/plugins/intel_gpu/tests/unit/CMakeLists.txt b/src/plugins/intel_gpu/tests/unit/CMakeLists.txtindex 8bff8f56c50..2c7a4b12735 100644--- a/src/plugins/intel_gpu/tests/unit/CMakeLists.txt+++ b/src/plugins/intel_gpu/tests/unit/CMakeLists.txt@@ -11,6 +11,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")ov_add_compiler_flags(/wd4305)endif()+if(OV_COMPILER_IS_INTEL_LLVM)+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")+ string(REPLACE "-pie" "" CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")+endif()+set(TARGET_NAME "ov_gpu_unit_tests")file(GLOB_RECURSE SOURCES_MAINdiff --git a/src/plugins/intel_npu/src/plugin/CMakeLists.txt b/src/plugins/intel_npu/src/plugin/CMakeLists.txtindex f071d001d44..30e4eae254d 100644--- a/src/plugins/intel_npu/src/plugin/CMakeLists.txt+++ b/src/plugins/intel_npu/src/plugin/CMakeLists.txt@@ -66,7 +66,7 @@ target_include_directories(${TARGET_NAME}${NPU_PLUGIN_SOURCE_DIR}/thirdparty/level-zero-ext)-if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR OV_COMPILER_IS_INTEL_LLVM)target_compile_options(${TARGET_NAME} PRIVATE -mavx2 -mf16c)elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")target_compile_options(${TARGET_NAME} PRIVATE /arch:AVX2)