Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[MLIR] New Graph Compiler runtime as a wrapper around OV stream (#38566)

Andrey Pavlenko08f82584374a
diff --git a/.github/workflows/dev_gpu_linux_mlir.yml b/.github/workflows/dev_gpu_linux_mlir.yml
index 5540992c105..be3bb4ee763 100644
--- a/.github/workflows/dev_gpu_linux_mlir.yml
+++ b/.github/workflows/dev_gpu_linux_mlir.yml
@@ -171,7 +171,7 @@ jobs:
LLVM_BUILD_TYPE: 'Release'
GC_DYLINK: 'OFF'
LLVM_CMAKE_ARGS: '-DMLIR_ENABLE_BINDINGS_PYTHON=OFF'
- GC_CMAKE_ARGS: '-DGC_ENABLE_TEST=OFF -DGC_ENABLE_TOOLS=OFF -DGC_ENABLE_PYTHON_BINDINGS=OFF'
+ GC_CMAKE_ARGS: '-DGC_ENABLE_TEST=OFF -DGC_ENABLE_TOOLS=OFF -DGC_ENABLE_ZE=OFF'
LLVM_BUILD_TARGET: install
LLVM_INSTALL_DIR: ${{ github.workspace }}/graph-compiler/externals/llvm/Release
GC_INSTALL_DIR: ${{ github.workspace }}/graph-compiler/build/Release/install
@@ -328,7 +328,9 @@ jobs:
runner: "[ 'self-hosted', 'dgpu', 'BMG-precommit', 'Linux' ]"
runner-group: 'Intel-GPU'
image: ${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_24_04_x64_dgpu }}
- options: "--group-add 44 --group-add 993 --device /dev/dri/renderD129:/dev/dri/renderD129 -e OV_GPU_ENABLE_MLIR=1"
+ # FIXME: Without OV_GPU_ALLOW_NEW_SHAPE_INFER, mlir_RMS test fails due to shape [1,64,1,1].
+ # To be fixed in a separate, memory layout related, PR.
+ options: "--group-add 44 --group-add 993 --device /dev/dri/renderD129:/dev/dri/renderD129 -e OV_GPU_ENABLE_MLIR=1 -e OV_GPU_ALLOW_NEW_SHAPE_INFER=1"
test_filter: 'mlir_*'
Overall_Status:
diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake
index d492c0035a3..057a2d489d3 100644
--- a/cmake/developer_package/plugins/plugins.cmake
+++ b/cmake/developer_package/plugins/plugins.cmake
@@ -31,7 +31,6 @@ endif()
# [SOURCES <sources>]
# [OBJECT_LIBRARIES <object_libs>]
# [VERSION_DEFINES_FOR <source>]
-# [LINKABLE] Build as a shared library so tests can link it
# [SKIP_INSTALL]
# [SKIP_REGISTRATION] Skip creation of <device>.xml
# [ADD_CLANG_FORMAT]
@@ -39,8 +38,7 @@ endif()
# )
#
function(ov_add_plugin)
- set(options SKIP_INSTALL PSEUDO_DEVICE ADD_CLANG_FORMAT ADD_CLANG_TIDY AS_EXTENSION SKIP_REGISTRATION LINKABLE
- DISPATCH_GROUP)
+ set(options SKIP_INSTALL PSEUDO_DEVICE ADD_CLANG_FORMAT ADD_CLANG_TIDY AS_EXTENSION SKIP_REGISTRATION DISPATCH_GROUP)
set(oneValueArgs NAME DEVICE_NAME VERSION_DEFINES_FOR PSEUDO_PLUGIN_FOR)
set(multiValueArgs DEFAULT_CONFIG SOURCES OBJECT_LIBRARIES)
cmake_parse_arguments(OV_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -62,11 +60,7 @@ function(ov_add_plugin)
endforeach()
if(BUILD_SHARED_LIBS)
- if(OV_PLUGIN_LINKABLE)
- set(library_type SHARED)
- else()
- set(library_type MODULE)
- endif()
+ set(library_type MODULE)
else()
set(library_type STATIC)
endif()
diff --git a/cmake/features.cmake b/cmake/features.cmake
index 449c48b8769..01938af26ef 100644
--- a/cmake/features.cmake
+++ b/cmake/features.cmake
@@ -72,7 +72,7 @@ ov_dependent_option (ENABLE_INTEL_NPU_INTERNAL "NPU plugin internal components f
ov_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
ov_dependent_option (ENABLE_NPU_DEBUG_CAPS "enable NPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_NPU" OFF)
ov_dependent_option (ENABLE_GPU_DEBUG_CAPS "enable GPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_GPU" OFF)
-ov_dependent_option (ENABLE_MLIR_FOR_GPU "Enable MLIR / Graph Compiler based execution in GPU plugin [EXPERIMENTAL, NOT PRODUCTION-READY]" OFF "ENABLE_INTEL_GPU;ENABLE_GPU_DEBUG_CAPS" OFF)
+ov_dependent_option (ENABLE_MLIR_FOR_GPU "Enable MLIR / Graph Compiler based execution in GPU plugin [EXPERIMENTAL, NOT PRODUCTION-READY]" OFF "ENABLE_INTEL_GPU;ENABLE_GPU_DEBUG_CAPS;NOT GPU_RT_TYPE STREQUAL SYCL" OFF)
ov_dependent_option (ENABLE_CPU_DEBUG_CAPS "enable CPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_CPU" OFF)
ov_dependent_option (ENABLE_SNIPPETS_DEBUG_CAPS "enable Snippets debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS" OFF)
diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txt
index 5d184f927b1..376a5ecd6e3 100644
--- a/src/plugins/intel_gpu/CMakeLists.txt
+++ b/src/plugins/intel_gpu/CMakeLists.txt
@@ -137,9 +137,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
ov_add_compiler_flags(-Werror)
endif()
-# Directory-wide on purpuse: the macro guards virtual methods in
-# include/intel_gpu/runtime, so ENABLE_MLIR_FOR_GPU must be defined consistently in all targets
-# sharing those headers.
+# Directory-wide on purpose: the macro guards cldnn::network data members in
+# include/intel_gpu/graph/network.hpp, so ENABLE_MLIR_FOR_GPU must be defined consistently in all
+# targets sharing that header.
if(ENABLE_MLIR_FOR_GPU)
add_compile_definitions(ENABLE_MLIR_FOR_GPU)
endif()
@@ -172,16 +172,9 @@ function(ov_gpu_build_stack RT_TYPE SUFFIX MODULE_NAME)
add_subdirectory(src/kernel_selector kernel_selector${SUFFIX})
add_subdirectory(src/graph graph${SUFFIX})
- # MLIR runs on OpenCL only: ocl_stream is the sole implementer of the ENABLE_MLIR_FOR_GPU
- # stream hooks, so a COMBINED build gives the backend to the OCL twin alone.
- set(stack_with_mlir ${ENABLE_MLIR_FOR_GPU})
- if(GPU_RT_TYPE STREQUAL "COMBINED" AND NOT RT_TYPE STREQUAL "OCL")
- set(stack_with_mlir OFF)
- endif()
-
# One per stack: the objects link this stack's graph library, so a COMBINED build cannot
# share a single target between the twins.
- if(stack_with_mlir)
+ if(ENABLE_MLIR_FOR_GPU)
set(mlir_lib openvino_intel_gpu_mlir_obj${SUFFIX})
add_library(${mlir_lib} OBJECT ${GPU_MLIR_SOURCES})
target_link_libraries(${mlir_lib} PRIVATE openvino::runtime openvino_intel_gpu_graph${SUFFIX} GraphCompiler)
@@ -192,14 +185,12 @@ function(ov_gpu_build_stack RT_TYPE SUFFIX MODULE_NAME)
ov_apply_clang_tidy(TARGET ${mlir_lib})
set(GPU_PLUGIN_OBJECT_LIBRARIES ${mlir_lib})
- set(GPU_PLUGIN_OPTIONS LINKABLE)
endif()
ov_add_plugin(NAME ${MODULE_NAME}
DEVICE_NAME "GPU"
SOURCES ${PLUGIN_SOURCES}
OBJECT_LIBRARIES ${GPU_PLUGIN_OBJECT_LIBRARIES}
- ${GPU_PLUGIN_OPTIONS}
DEFAULT_CONFIG ${PLUGIN_DEFAULT_CONFIG}
VERSION_DEFINES_FOR src/plugin/plugin.cpp
# ADD_CLANG_TIDY makes ov_add_plugin apply clang-tidy to this target.
@@ -222,7 +213,7 @@ function(ov_gpu_build_stack RT_TYPE SUFFIX MODULE_NAME)
target_link_libraries(${MODULE_NAME} PRIVATE openvino_intel_gpu_graph${SUFFIX} openvino::pugixml)
- if(stack_with_mlir)
+ if(ENABLE_MLIR_FOR_GPU)
target_link_libraries(${MODULE_NAME} PRIVATE GraphCompiler)
# Per target, unlike ENABLE_MLIR_FOR_GPU: must be defined by everyone linking
# openvino_intel_gpu_mlir_obj, since only it provides mlir::transformMLIR().
diff --git a/src/plugins/intel_gpu/docs/mlir/overall_flow.md b/src/plugins/intel_gpu/docs/mlir/overall_flow.md
index d52be064a1e..71356b48083 100644
--- a/src/plugins/intel_gpu/docs/mlir/overall_flow.md
+++ b/src/plugins/intel_gpu/docs/mlir/overall_flow.md
@@ -19,10 +19,12 @@ and inserts an `ov::intel_gpu::op::MLIROp` operation representing the converted
An actual compilation and execution of the converted MLIR module happens in a separate project called
`graph-compiler (GC)` - the project is "ingress-agnostic" and doesn't depend on OV specifically, it handles
-an arbitrary mlir-linalg-code as an input and produces a GPU-binary combined with a cpu-side launching code
-(using OpenCL runtime). The OpenVINO side is only responsible for matching a suitable subgraph in `ov::Model`,
-converting it to MLIR as is (all the optimizations are made on the graph-compiler side), and providing the
-runtime-info on inference (OpenCL queue/context handlers, buffers, etc).
+an arbitrary mlir-linalg-code as an input and produces a GPU-binary combined with a cpu-side launching code.
+The generated host code drives the `gc::gpu::GpuRuntime<Kernel, Event, Memory>` interface, which the plugin implements
+on top of `cldnn::stream`/`cldnn::engine` with `cldnn::event::ptr` events and `cldnn::memory::ptr` memory, so the kernels are scheduled into the command list of the OV stream. The
+OpenVINO side is only responsible for matching a suitable subgraph in `ov::Model`, converting it to MLIR as is
+(all the optimizations are made on the graph-compiler side), and providing the runtime-info on inference
+(buffers, dependencies, etc).
`MLIROp` naturally follows the OV's compile/infer semantic: on model compilation the MLIR module is fully
compiled to a binary (even if the module has dynamic shapes), on `infer()` it launches the compiled binary
@@ -30,34 +32,37 @@ compiled to a binary (even if the module has dynamic shapes), on `infer()` it la
## Communication with the graph-compiler
-`MLIROp` communicates with the graph-compiler using its public api (the actual communication is delegated to a
-separate `intel_gpu::mlir::MLIREvaluateGcGPU` class that is defined under `transformations/mlir` to avoid
-bringing mlir/gc includes to the main plugin). The simplified flow is following:
+The MLIR/GC dependent code lives under `transformations/mlir` to avoid bringing mlir/gc includes to the main
+plugin, and is reached through the MLIR-free `MLIRGpuProgram` in `transformations/mlir/interface/gpu_runtime.hpp`.
+The simplified flow is following:
**A. Compilation:**
-During `transformMLIR` each partitioned subgraph is lowered to an MLIR linalg module and wrapped into an
-`MLIROp`. The op's execution engine, `MLIREvaluateGcGPU`, is constructed first, and its constructor hands the
-module to the Graph Compiler - `gc::gpu::OclModuleBuilder(module).build(device, context)` - which JIT-compiles
-it and returns a `gc::gpu::OclModule`: a binary holding both the generated GPU kernels and the host code that
-launches them.
+During `transformMLIR` each partitioned subgraph is lowered to an MLIR linalg module (using the shared
+`MLIRContext`) and wrapped into an `MLIROp` that owns a `GcGpuProgram`. Its constructor submits the module to
+`gc::gpu::GpuCompiler::compile()`, which **returns immediately** and compiles in the background, so the
+subgraphs of a model are compiled in parallel. The compiler serializes the module and keeps the results in an
+internal cache keyed by the source, the architecture and the compilation options.
-By the time the `MLIROp` is inserted into the `ov::Model`, the subgraph it replaces is already fully compiled
-into a device binary.
+The background compilation is joined at the end of the compilation phase, in `CreateMLIROp()`
+(`plugin/ops/mlir_op.cpp`), when the `ov::Model` is converted into a `cldnn::program`: from that point on
+`MLIROp` holds a ready `gc::gpu::Program` and the compilation errors are reported at `compile_model()` time
+rather than at the first inference.
**B. Inference:**
The op becomes a `cldnn::mlir_primitive` that owns nothing but the `MLIROp` itself - there is no GPU kernel to
-compile or cache for it. At inference `mlir_primitive_impl::execute_impl`:
+compile or cache for it. At inference `mlir_primitive_impl::execute_impl` calls `MLIRGpuProgram::execute()`,
+which:
-* extracts the native OpenCL handles (`cl_mem` / USM pointers, `cl_command_queue`, dependency `cl_event`s) out
- of the cldnn runtime;
-* passes them through an `ov::EvaluationContext` into `MLIROp::evaluate()`;
-* turns the resulting `cl_event`s back into cldnn events.
+* stores one memref per input/output buffer via `gc::gpu::ArgsBuilder` (the USM pointer plus the shape and the
+ dense row-major strides of the leading dimensions expected by the module);
+* calls `gc::gpu::Program::main(args, runtime, deps, nDeps)`, passing the dependency events of the primitive;
+* aggregates the events returned by the program into the event of the primitive.
-The native handles are exposed by `get_native_handle()` accessors added to `cldnn::memory`, `cldnn::event` and
-`cldnn::stream`. Only the OCL runtime implements them, so the MLIR path is OCL-only for now
-(`mlir_primitive_impl` throws if a handle is unavailable).
+The compiled program is shared by all the streams of the model. Each `cldnn::network` owns one `GcGpuRuntime`
+bound to its stream, created through `MLIRGpuRuntime::create`. The plugin registers this factory through
+`register_mlir_gpu_runtime()`.
## Code organization
@@ -66,11 +71,10 @@ dedicated OBJECT library `openvino_intel_gpu_mlir_obj` that alone gets the MLIR/
`GraphCompiler`; the object library is then linked into the plugin. This keeps `mlir/*.h` and `gc/*.h` out of
every other translation unit.
-The only headers other plugin code may include are the ones from `transformations/mlir/interface/`
-(`convert.hpp`, `mlir_evaluate_base.hpp`, `properties.hpp`) - they are MLIR/GC free. The same applies to the
-`MLIROp` (`include/intel_gpu/op/mlir_op.hpp`) and `cldnn::mlir_primitive`
-(`include/intel_gpu/primitives/mlir_primitive.hpp`) declarations: no MLIR/GC types cross this boundary, so the
-whole `graph` library stays MLIR-free.
+The headers `convert.hpp` and `gpu_runtime.hpp` in `transformations/mlir/interface/` are MLIR/GC free.
+The same applies to the `MLIROp` (`include/intel_gpu/op/mlir_op.hpp`) and
+`cldnn::mlir_primitive` (`include/intel_gpu/primitives/mlir_primitive.hpp`) declarations: no MLIR/GC types
+cross this boundary, so the whole `graph` library stays MLIR-free.
## Feature enabling
diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp
index b1ca6d9fbad..7c62c9d2ca4 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp
@@ -27,6 +27,9 @@
namespace ov::intel_gpu {
class OutputMemoryBlock;
+namespace mlir {
+struct MLIRGpuRuntime;
+} // namespace mlir
} // namespace ov::intel_gpu
namespace cldnn {
@@ -187,6 +190,13 @@ public:
uint32_t get_id() const { return net_id; }
stream& get_stream() const { return *_stream; }
stream::ptr get_stream_ptr() const { return _stream; }
+ ov::intel_gpu::mlir::MLIRGpuRuntime* gc_runtime() const {
+#ifdef ENABLE_MLIR_FOR_GPU
+ return _gc_runtime.get();
+#else
+ return nullptr;
+#endif
+ }
bool is_internal() const { return _internal; }
bool is_primary_stream() const { return _is_primary_stream; }
bool is_dynamic() const { return _is_dynamic; }
@@ -318,5 +328,9 @@ private:
friend class NetworkDebugHelper;
friend class NodeDebugHelper;
#endif
+
+#ifdef ENABLE_MLIR_FOR_GPU
+ std::unique_ptr<ov::intel_gpu::mlir::MLIRGpuRuntime> _gc_runtime;
+#endif
};
} // namespace cldnn
diff --git a/src/plugins/intel_gpu/include/intel_gpu/op/mlir_op.hpp b/src/plugins/intel_gpu/include/intel_gpu/op/mlir_op.hpp
index cdc7a3e1247..64f1d4ccb89 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/op/mlir_op.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/op/mlir_op.hpp
@@ -9,14 +9,14 @@
#include <vector>
#include "openvino/core/any.hpp"
+#include "openvino/core/node.hpp"
#include "openvino/core/partial_shape.hpp"
#include "openvino/core/type/element_type.hpp"
#include "openvino/op/op.hpp"
-#include "openvino/runtime/tensor.hpp"
namespace ov::intel_gpu {
namespace mlir {
-class MLIREvaluateBase;
+class MLIRGpuProgram;
} // namespace mlir
namespace op {
@@ -27,7 +27,7 @@ using OVOutputTypes = std::vector<std::tuple<ov::element::Type, ov::PartialShape
using DimensionsMap = std::vector<std::vector<std::tuple<size_t, size_t>>>;
class MLIROp : public ov::op::Op {
- std::shared_ptr<mlir::MLIREvaluateBase> engine;
+ std::shared_ptr<mlir::MLIRGpuProgram> program;
OVOutputTypes output_types;
DimensionsMap dimensions_map;
@@ -36,13 +36,17 @@ public:
MLIROp() = default;
- MLIROp(const ov::OutputVector& args, std::shared_ptr<mlir::MLIREvaluateBase> engine, OVOutputTypes output_types, DimensionsMap dimensions_map);
+ MLIROp(const ov::OutputVector& args,
+ std::shared_ptr<mlir::MLIRGpuProgram> program,
+ OVOutputTypes output_types,
+ DimensionsMap dimensions_map);
+
+ const std::shared_ptr<mlir::MLIRGpuProgram>& get_program() const {
+ return program;
+ }
void validate_and_infer_types() override;
std::shared_ptr<ov::Node> clone_with_new_inputs(const ov::OutputVector& new_args) const override;
- bool evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const override;
- bool evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs, const ov::EvaluationContext& evaluationContext) const override;
- bool has_evaluate() const override;
std::vector<ov::PartialShape> shape_infer(const std::vector<ov::PartialShape>& input_shapes) const;
};
diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/mlir_primitive.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/mlir_primitive.hpp
index 577c9a01013..e6c4288816e 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/primitives/mlir_primitive.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/mlir_primitive.hpp
@@ -11,14 +11,14 @@
#include "openvino/core/partial_shape.hpp"
#include "primitive.hpp"
-namespace ov {
-class Node; // forward-decl — the underlying op is ov::intel_gpu::op::MLIROp
-}
+namespace ov::intel_gpu::op {
+class MLIROp;
+} // namespace ov::intel_gpu::op
namespace cldnn {
/// @brief Primitive that wraps an ov::intel_gpu::op::MLIROp node. Its execute_impl
-/// (see impls/common/mlir_primitive.cpp) forwards to MLIROp::evaluate().
+/// (see impls/common/mlir_primitive.cpp) calls MLIRGpuProgram::execute().
struct mlir_primitive : public primitive_base<mlir_primitive> {
CLDNN_DECLARE_PRIMITIVE(mlir_primitive)
@@ -28,7 +28,7 @@ struct mlir_primitive : public primitive_base<mlir_primitive> {
mlir_primitive(const primitive_id& id,
const std::vector<input_info>& inputs,
- std::shared_ptr<ov::Node> op,
+ std::shared_ptr<ov::intel_gpu::op::MLIROp> op,
shape_infer_function shape_infer_f,
size_t num_outputs,
const std::vector<optional_data_type>& out_types)
@@ -36,7 +36,7 @@ struct mlir_primitive : public primitive_base<mlir_primitive> {
op(std::move(op)),
shape_infer_f(std::move(shape_infer_f)) {}
- std::shared_ptr<ov::Node> op;
+ std::shared_ptr<ov::intel_gpu::op::MLIROp> op;
shape_infer_function shape_infer_f;
void save(BinaryOutputBuffer& /*ob*/) const override {
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/event.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/event.hpp
index cb0e35689dd..449f22009d0 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/event.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/event.hpp
@@ -45,10 +45,6 @@ public:
// returns true if handler has been successfully added
bool add_event_handler(event_handler handler, void* data);
-#ifdef ENABLE_MLIR_FOR_GPU
- // return a handle to an underlying event implementation (i.e. cl_event for OpenCL)
- virtual void* get_native_handle() { return nullptr; }
-#endif
std::vector<instrumentation::profiling_interval> get_profiling_info();
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/memory.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/memory.hpp
index 151a529bf80..6dbc68ae43a 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/memory.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/memory.hpp
@@ -55,10 +55,6 @@ struct memory {
}
// only supports gpu_usm
virtual void* buffer_ptr() const { return nullptr; }
-#ifdef ENABLE_MLIR_FOR_GPU
- // Returns the handle to the underlying memory object (e.g. cl_mem for OpenCL)
- virtual void* get_native_handle() const { return nullptr; }
-#endif
size_t size() const { return _bytes_count; }
size_t count() const { return _layout.count(); }
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp
index 767ec610a33..654658f6074 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp
@@ -75,18 +75,10 @@ public:
virtual void wait_for_events(const std::vector<event::ptr>& events) = 0;
virtual event::ptr create_user_event(bool set) = 0;
virtual event::ptr create_base_event() = 0;
-#ifdef ENABLE_MLIR_FOR_GPU
- // Wraps an already existing native event handle (i.e. cl_event for OpenCL) into cldnn::event
- virtual event::ptr create_base_event(void* /*handle*/) { return nullptr; }
-#endif
virtual std::unique_ptr<surfaces_lock> create_surfaces_lock(const std::vector<memory::ptr> &mem) const = 0;
virtual event::ptr aggregate_events(const std::vector<event::ptr>& events, bool group = false, bool is_output = false);
QueueTypes get_queue_type() const { return m_queue_type; }
-#ifdef ENABLE_MLIR_FOR_GPU
- // Returns the handle to the underlying stream object (e.g. cl_command_queue for OpenCL)
- virtual void* get_native_handle() const { return nullptr; }
-#endif
SyncMethods get_sync_method() const { return m_sync_method; }
static SyncMethods get_expected_sync_method(const ExecutionConfig& config);
diff --git a/src/plugins/intel_gpu/sources.cmake b/src/plugins/intel_gpu/sources.cmake
index 65f71955a29..ce2f76795f0 100644
--- a/src/plugins/intel_gpu/sources.cmake
+++ b/src/plugins/intel_gpu/sources.cmake
@@ -236,8 +236,8 @@ set(GPU_PLUGIN_MLIR_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/plugin/transformations/mlir/common/convert_common.cpp
${CMAKE_CURRENT_LIST_DIR}/src/plugin/transformations/mlir/conversion/patterns.cpp
${CMAKE_CURRENT_LIST_DIR}/src/plugin/transformations/mlir/convert.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/src/plugin/transformations/mlir/gc_gpu_runtime.cpp
${CMAKE_CURRENT_LIST_DIR}/src/plugin/transformations/mlir/graph_converter.cpp
- ${CMAKE_CURRENT_LIST_DIR}/src/plugin/transformations/mlir/mlir_evaluate.cpp
${CMAKE_CURRENT_LIST_DIR}/src/plugin/transformations/mlir/subgraph_tracker.cpp
)
diff --git a/src/plugins/intel_gpu/src/graph/impls/common/mlir_primitive.cpp b/src/plugins/intel_gpu/src/graph/impls/common/mlir_primitive.cpp
index e59de03b595..39957dabbb1 100644
--- a/src/plugins/intel_gpu/src/graph/impls/common/mlir_primitive.cpp
+++ b/src/plugins/intel_gpu/src/graph/impls/common/mlir_primitive.cpp
@@ -9,18 +9,17 @@
# include <memory>
# include <vector>
+# include "intel_gpu/op/mlir_op.hpp"
# include "intel_gpu/primitives/mlir_primitive.hpp"
-# include "intel_gpu/runtime/stream.hpp"
-# include "intel_gpu/runtime/tensor_accessor.hpp" // cldnn::make_tensor
# include "mlir_primitive_inst.h"
-# include "openvino/core/node.hpp"
-# include "openvino/runtime/intel_gpu/remote_properties.hpp"
-# include "plugin/transformations/mlir/interface/properties.hpp"
+# include "plugin/transformations/mlir/interface/gpu_runtime.hpp"
# include "register.hpp"
# include "registry/implementation_map.hpp"
namespace cldnn::common {
+namespace {
+
struct mlir_primitive_impl : typed_primitive_impl<mlir_primitive> {
using parent = typed_primitive_impl<mlir_primitive>;
using parent::parent;
@@ -40,115 +39,13 @@ struct mlir_primitive_impl : typed_primitive_impl<mlir_primitive> {
void set_node_params(const program_node& /*arg*/) override {}
event::ptr execute_impl(const std::vector<event::ptr>& dependent_events, mlir_primitive_inst& instance) override {
- auto& stream = instance.get_network().get_stream();
const auto& prim = instance.node->get_primitive();
- const auto& op = prim->op;
- OPENVINO_ASSERT(op, "[GPU] MLIROp is not set for mlir_primitive '", prim->id);
-
- ov::TensorVector input_gpu_tensors;
- ov::TensorVector output_gpu_tensors;
- std::vector<bool> is_usm_ptr;
- input_gpu_tensors.reserve(instance.inputs_memory_count());
- output_gpu_tensors.reserve(instance.outputs_memory_count());
- is_usm_ptr.reserve(instance.inputs_memory_count() + instance.outputs_memory_count());
-
- auto process_buffer = [&is_usm_ptr](const memory::ptr& mem, ov::TensorVector& tensors) {
- // make_tensor() below builds a dense ov::Tensor from the logical shape, so a padded layout
- // would result in wrong data offset and strides being passed to the MLIR kernel.
- OPENVINO_ASSERT(!static_cast<bool>(mem->get_layout().data_padding), "[GPU] Padded buffers are not supported by mlir_primitive yet");
- switch (mem->get_allocation_type()) {
- case allocation_type::cl_mem: {
- if (void* cl_buff = mem->get_native_handle()) {
- tensors.push_back(make_tensor(mem->get_layout(), cl_buff));
- is_usm_ptr.push_back(false);
- } else {
- OPENVINO_THROW("Memory handle is null for cl_mem");
- }
- break;
- }
- case allocation_type::usm_host:
- case allocation_type::usm_shared:
- case allocation_type::usm_device: {
- auto* usm_ptr = mem->buffer_ptr();
- // Seems to only occur with Out-Of-Order queues sometimes. Can't reproduce this anymore, uncomment if needed.
- // HACK: force move to device, can we do better than this?
- // auto gpu_buff = dynamic_cast<cldnn::ocl::gpu_usm*>(mem.get());
- // auto& usm_helper = gpu_buff->get_buffer().getUsmHelper();
- // usm_helper.enqueue_memcpy(
- // dynamic_cast<cldnn::ocl::ocl_stream&>(stream).get_cl_queue(),
- // usm_ptr,
- // usm_ptr,
- // mem->get_layout().bytes_count());
- tensors.push_back(make_tensor(mem->get_layout(), usm_ptr));
- is_usm_ptr.push_back(true);
- break;
- }
- default:
- OPENVINO_THROW("Unsupported memory type");
- }
- };
-
- for (size_t i = 0; i < instance.inputs_memory_count(); i++) {
- process_buffer(instance.input_memory_ptr(i), input_gpu_tensors);
- }
-
- for (size_t i = 0; i < instance.outputs_memory_count(); i++) {
- process_buffer(instance.output_memory_ptr(i), output_gpu_tensors);
- }
-
- ov::EvaluationContext meta;
- if (void* queue = stream.get_native_handle()) {
- meta.insert(ov::intel_gpu::ocl_queue(queue));
- } else {
- OPENVINO_THROW("Unsupported queue type");
- }
- meta.insert(ov::internal::mlir_meta::is_kernel_arg_usm(is_usm_ptr));
-
- std::vector<void*> events_list;
- std::vector<void*> result_events;
- const bool need_result_events = instance.get_config().get_enable_profiling() || stream.get_queue_type() == QueueTypes::out_of_order;
- if (need_result_events) {
- meta.insert(ov::internal::mlir_meta::result_events(&result_events));
- }
- event::ptr marker;
- if (stream.get_queue_type() == QueueTypes::out_of_order) {
- std::vector<event::ptr> depends;
- depends.reserve(dependent_events.size());
- for (const auto& ev : dependent_events) {
- if (!ev) {
- continue;
- }
- if (void* cl_ev = ev->get_native_handle()) {
- events_list.push_back(cl_ev);
- } else {
- depends.push_back(ev);
- }
- }
- if (!depends.empty()) {
- marker = stream.enqueue_marker(depends, true);
- if (void* cl_ev = marker->get_native_handle()) {
- events_list.push_back(cl_ev);
- }
- }
- if (!events_list.empty()) {
- meta.insert(ov::internal::mlir_meta::wait_list(events_list));
- }
- }
-
- const bool evaluated = op->evaluate(output_gpu_tensors, input_gpu_tensors, meta);
- OPENVINO_ASSERT(evaluated, "[GPU] Couldn't execute MLIROp ", op->get_friendly_name());
-
- if (!result_events.empty()) {
- std::vector<event::ptr> events;
- events.reserve(result_events.size());
- for (auto* event : result_events) {
- events.push_back(stream.create_base_event(event));
- }
- return stream.aggregate_events(events, true);
- }
-
- OPENVINO_ASSERT(!need_result_events, "Result cl_events are not set");
- return stream.create_user_event(true);
+ const auto& mlir_op = prim->op;
+ OPENVINO_ASSERT(mlir_op != nullptr, "[GPU] MLIROp is not set for mlir_primitive '", prim->id, "'");
+ const auto& program = mlir_op->get_program();
+ auto* runtime = instance.get_network().gc_runtime();
+ OPENVINO_ASSERT(runtime != nullptr, "[GPU] MLIR runtime is not available for mlir_primitive '", prim->id, "'");
+ return program->execute(*runtime, *mlir_op, instance, dependent_events, instance.needs_completion_event() || instance.is_output());
}
static std::unique_ptr<primitive_impl> create(const mlir_primitive_node& arg, const kernel_impl_params& /*params*/) {
@@ -167,8 +64,14 @@ struct mlir_primitive_impl : typed_primitive_impl<mlir_primitive> {
[[nodiscard]] bool is_cpu() const override {
return false;
}
+
+ [[nodiscard]] bool supports_replay() const override {
+ return false;
+ }
};
+} // namespace
+
std::unique_ptr<primitive_impl> MLIRPrimitiveImplementationManager::create_impl(const program_node& node, const kernel_impl_params& params) const {
assert(node.is_type<mlir_primitive>());
return mlir_primitive_impl::create(static_cast<const mlir_primitive_node&>(node), params);
diff --git a/src/plugins/intel_gpu/src/graph/include/mlir_primitive_inst.h b/src/plugins/intel_gpu/src/graph/include/mlir_primitive_inst.h
index 33f4daf285e..7c2cd62c979 100644
--- a/src/plugins/intel_gpu/src/graph/include/mlir_primitive_inst.h
+++ b/src/plugins/intel_gpu/src/graph/include/mlir_primitive_inst.h
@@ -21,6 +21,8 @@ public:
program_node& input(size_t idx = 0) const {
return get_dependency(idx);
}
+
+ std::vector<size_t> get_shape_infer_dependencies() const override { return {}; }
};
using mlir_primitive_node = typed_program_node<mlir_primitive>;
diff --git a/src/plugins/intel_gpu/src/graph/mlir_primitive.cpp b/src/plugins/intel_gpu/src/graph/mlir_primitive.cpp
index 00f14a93bc2..adc57254ff7 100644
--- a/src/plugins/intel_gpu/src/graph/mlir_primitive.cpp
+++ b/src/plugins/intel_gpu/src/graph/mlir_primitive.cpp
@@ -7,6 +7,7 @@
# include <sstream>
# include <string>
+# include "intel_gpu/op/mlir_op.hpp"
# include "json_object.h"
# include "mlir_primitive_inst.h"
# include "openvino/core/partial_shape.hpp"
diff --git a/src/plugins/intel_gpu/src/graph/network.cpp b/src/plugins/intel_gpu/src/graph/network.cpp
index afa1f47d60c..775cdf1bded 100644
--- a/src/plugins/intel_gpu/src/graph/network.cpp
+++ b/src/plugins/intel_gpu/src/graph/network.cpp
@@ -52,6 +52,9 @@
#include "reshape_inst.h"
#include "stateless_kv_inst.h"
#include "to_string_utils.h"
+#ifdef ENABLE_MLIR_FOR_GPU
+# include "plugin/transformations/mlir/interface/gpu_runtime.hpp"
+#endif
#ifdef GPU_DEBUG_CONFIG
# include <sys/stat.h>
@@ -276,6 +279,11 @@ network::network(program::ptr program, stream::ptr stream, bool is_internal, boo
preallocate_shape_info_buffers();
add_default_output_chains();
prepare_record_replay();
+#ifdef ENABLE_MLIR_FOR_GPU
+ if (ov::intel_gpu::mlir::MLIRGpuRuntime::create) {
+ _gc_runtime = ov::intel_gpu::mlir::MLIRGpuRuntime::create(*_stream, _engine);
+ }
+#endif
}
network::network(program::ptr program, bool is_internal, bool is_primary_stream)
diff --git a/src/plugins/intel_gpu/src/plugin/ops/mlir_op.cpp b/src/plugins/intel_gpu/src/plugin/ops/mlir_op.cpp
index 5661508fd6a..8337ef5f084 100644
--- a/src/plugins/intel_gpu/src/plugin/ops/mlir_op.cpp
+++ b/src/plugins/intel_gpu/src/plugin/ops/mlir_op.cpp
@@ -9,6 +9,7 @@
# include "intel_gpu/plugin/common_utils.hpp"
# include "intel_gpu/plugin/program_builder.hpp"
# include "intel_gpu/primitives/mlir_primitive.hpp"
+# include "plugin/transformations/mlir/interface/gpu_runtime.hpp"
namespace ov::op::internal {
using MLIR = ov::intel_gpu::op::MLIROp;
@@ -20,17 +21,15 @@ static void CreateMLIROp(ProgramBuilder& p, const std::shared_ptr<ov::op::intern
auto inputs = p.GetInputInfo(op);
const std::string layer_name = layer_type_name_ID(op);
const size_t num_outputs = op->get_output_size();
+ const auto& program = op->get_program();
+ OPENVINO_ASSERT(program, "[GPU] MLIROp '", layer_name, "' has no compiled program");
+ program->wait_compiled(); // The compilation is running in the background
cldnn::mlir_primitive::shape_infer_function shape_infer_f = [op](const std::vector<ov::PartialShape>& input_shapes) {
return op->shape_infer(input_shapes);
};
- cldnn::mlir_primitive primitive(layer_name,
- inputs,
- op, // shared_ptr<ov::Node>
- std::move(shape_infer_f),
- num_outputs,
- get_output_data_types(op));
+ cldnn::mlir_primitive primitive(layer_name, inputs, op, std::move(shape_infer_f), num_outputs, get_output_data_types(op));
p.add_primitive(*op, primitive);
}
diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cpp
index e88aca3d6cc..b41ac5c709d 100644
--- a/src/plugins/intel_gpu/src/plugin/plugin.cpp
+++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp
@@ -50,6 +50,10 @@
#include "transformations/rt_info/fused_names_attribute.hpp"
#include "transformations/utils/utils.hpp"
+#ifdef OV_GPU_MLIR_BACKEND_LINKED
+# include "transformations/mlir/interface/gpu_runtime.hpp"
+#endif
+
// Undef DEVICE_TYPE macro which can be defined somewhere in windows headers as DWORD and conflict with our metric
#ifdef DEVICE_TYPE
#undef DEVICE_TYPE
@@ -264,6 +268,9 @@ std::map<std::string, RemoteContextImpl::Ptr> Plugin::get_default_contexts() con
}
Plugin::Plugin() {
+#ifdef OV_GPU_MLIR_BACKEND_LINKED
+ ov::intel_gpu::mlir::register_mlir_gpu_runtime();
+#endif
set_device_name("GPU");
register_primitives();
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/common/convert_common.hpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/common/convert_common.hpp
index faf37aeba91..acf0df3d378 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations/mlir/common/convert_common.hpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations/mlir/common/convert_common.hpp
@@ -4,14 +4,18 @@
#pragma once
+#include <cstdint>
#include <iostream>
+#include <memory>
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/BuiltinAttributes.h"
+#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/MLIRContext.h"
+#include "mlir/IR/OwningOpRef.h"
#include "openvino/op/constant.hpp"
#include "typedefs.hpp"
@@ -19,6 +23,9 @@ namespace ov::intel_gpu::mlir {
using namespace ::mlir;
+class MLIRGpuProgram;
+std::shared_ptr<MLIRGpuProgram> create_gpu_program(::mlir::OwningOpRef<::mlir::ModuleOp> module, uint32_t device_id);
+
// Verbose logging of the MLIR pipeline, controlled by the global ov::intel_gpu::mlir_debug option
bool is_debug();
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/convert.cpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/convert.cpp
index e937fd2339f..859193ee71e 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations/mlir/convert.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations/mlir/convert.cpp
@@ -49,11 +49,8 @@
#include "mlir/IR/Dialect.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/ValueRange.h"
-#include "mlir/InitAllDialects.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Target/LLVMIR/ModuleTranslation.h"
-#include "mlir_evaluate.hpp"
#include "openvino/core/dimension.hpp"
#include "openvino/core/symbol.hpp"
#include "subgraph_tracker.hpp"
@@ -222,7 +219,7 @@ mlir::OwningOpRef<mlir::ModuleOp> ngraph_to_mlir(MLIRContext* context,
}
// This pass converts a group of nodes into a single MLIROp
-NodePtr ngraph_to_mlir_op(MLIRContext* context, const SubgraphPtr& subgraph, const std::shared_ptr<ov::EvaluationContext>& loweringContext) {
+NodePtr ngraph_to_mlir_op(MLIRContext* context, const SubgraphPtr& subgraph, uint32_t device_id) {
SmallVector<size_t> keptInputIndices;
mlir::OwningOpRef<mlir::ModuleOp> module =
ngraph_to_mlir(context, subgraph->inputs, subgraph->nodes, subgraph->outputs, keptInputIndices, subgraph->function_name);
@@ -269,10 +266,9 @@ NodePtr ngraph_to_mlir_op(MLIRContext* context, const SubgraphPtr& subgraph, con
}
output_map.emplace_back(dm);
}
- return std::make_shared<ov::intel_gpu::op::MLIROp>(inputs,
- std::make_shared<MLIREvaluateGcGPU>(std::move(module), loweringContext),
- output_types,
- output_map);
+
+ auto program = ov::intel_gpu::mlir::create_gpu_program(std::move(module), device_id);
+ return std::make_shared<ov::intel_gpu::op::MLIROp>(inputs, std::move(program), output_types, output_map);
};
void replace_subgraph(const SubgraphPtr& subgraph, const NodePtr& node) {
@@ -458,18 +454,19 @@ public:
class Partitioner : public ov::pass::ModelPass {
MLIRContext* context;
- std::shared_ptr<ov::EvaluationContext> loweringContext;
+ uint32_t device_id;
public:
OPENVINO_MODEL_PASS_RTTI("Partitioner");
- Partitioner(MLIRContext* context, std::shared_ptr<ov::EvaluationContext> loweringContext)
- : context(context),
- loweringContext(std::move(std::move(loweringContext))) {}
+ Partitioner(MLIRContext* context, uint32_t device_id) : context(context), device_id(device_id) {}
bool run_on_model(const std::shared_ptr<ov::Model>& model) override {
SubgraphTracker tracker([this](const SubgraphPtr& subgraph) {
- auto mlir_op = ngraph_to_mlir_op(context, subgraph, loweringContext);
+ // Compilation of the created op runs in the background, so the subgraphs of the model are
+ // compiled in parallel. It is joined at the end of the compilation phase, see
+ // CreateMLIROp().
+ auto mlir_op = ngraph_to_mlir_op(context, subgraph, device_id);
replace_subgraph(subgraph, mlir_op);
OPENVINO_MLIR_DEBUG_PRINT("Created MLIR op: " << mlir_op);
});
@@ -488,10 +485,7 @@ namespace {
using namespace mlir;
using namespace ov::intel_gpu::mlir;
-void injectMLIR(const std::shared_ptr<ov::Model>& model,
- MLIRContext* context,
- const ov::intel_gpu::ExecutionConfig& config,
- const std::shared_ptr<ov::EvaluationContext>& loweringContext) {
+void injectMLIR(const std::shared_ptr<ov::Model>& model, MLIRContext* context, const ov::intel_gpu::ExecutionConfig& config, uint32_t device_id) {
ov::pass::Manager manager;
using namespace ov::op;
manager.set_per_pass_validation(false);
@@ -528,14 +522,14 @@ void injectMLIR(const std::shared_ptr<ov::Model>& model,
manager.register_pass<UnsqueezePattern>();
manager.register_pass<MatMulPattern>();
manager.register_pass<PatternMatcher>(config.get_mlir_patterns());
- manager.register_pass<Partitioner>(context, loweringContext);
+ manager.register_pass<Partitioner>(context, device_id);
manager.run_passes(model);
model->validate_nodes_and_infer_types();
}
MLIRContext* get_shared_mlir_context() {
static auto context = [] {
- auto ctx = std::make_unique<MLIRContext>(gc::getDialectRegistry());
+ auto ctx = std::make_unique<MLIRContext>(mlir::gc::getDialectRegistry());
ctx->loadAllAvailableDialects();
return ctx;
}();
@@ -544,8 +538,6 @@ MLIRContext* get_shared_mlir_context() {
} // namespace
-void ov::intel_gpu::mlir::transformMLIR(const std::shared_ptr<ov::Model>& model,
- const ov::intel_gpu::ExecutionConfig& config,
- const std::shared_ptr<ov::EvaluationContext>& loweringContext) {
- injectMLIR(model, get_shared_mlir_context(), config, loweringContext);
+void ov::intel_gpu::mlir::transformMLIR(const std::shared_ptr<ov::Model>& model, const ov::intel_gpu::ExecutionConfig& config, uint32_t device_id) {
+ injectMLIR(model, get_shared_mlir_context(), config, device_id);
}
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/gc_gpu_runtime.cpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/gc_gpu_runtime.cpp
new file mode 100644
index 00000000000..7141cdf60fd
--- /dev/null
+++ b/src/plugins/intel_gpu/src/plugin/transformations/mlir/gc_gpu_runtime.cpp
@@ -0,0 +1,494 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <llvm/ADT/SmallVector.h>
+
+#include <algorithm>
+#include <cstdint>
+#include <cstring>
+#include <deque>
+#include <exception>
+#include <memory>
+#include <string>
+#include <type_traits>
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+#include "common/convert_common.hpp"
+#include "gc/GpuCompiler.h"
+#include "gc/Runtime/GpuRuntime.h"
+#include "intel_gpu/runtime/engine.hpp"
+#include "intel_gpu/runtime/kernel.hpp"
+#include "intel_gpu/runtime/kernel_args.hpp"
+#include "intel_gpu/runtime/kernel_builder.hpp"
+#include "intel_gpu/runtime/layout.hpp"
+#include "intel_gpu/runtime/memory.hpp"
+#include "intel_gpu/runtime/stream.hpp"
+#include "interface/gpu_runtime.hpp"
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/OwningOpRef.h"
+#include "openvino/core/except.hpp"
+#include "openvino/core/node.hpp"
+#include "primitive_inst.h"
+
+namespace ov::intel_gpu::mlir {
+
+namespace {
+
+using ProgramArgs = std::vector<void*>;
+using ProgramArgStorage = std::deque<::gc::gpu::ArgStorage>;
+using ::gc::gpu::ArgType;
+
+cldnn::scalar_desc::Types to_scalar_type(ArgType type) {
+ switch (type) {
+ case ArgType::I8:
+ return cldnn::scalar_desc::Types::INT8;
+ case ArgType::UI8:
+ return cldnn::scalar_desc::Types::UINT8;
+ case ArgType::I16:
+ return cldnn::scalar_desc::Types::INT16;
+ case ArgType::UI16:
+ return cldnn::scalar_desc::Types::UINT16;
+ case ArgType::I32:
+ return cldnn::scalar_desc::Types::INT32;
+ case ArgType::UI32:
+ return cldnn::scalar_desc::Types::UINT32;
+ case ArgType::I64:
+ return cldnn::scalar_desc::Types::INT64;
+ case ArgType::UI64:
+ return cldnn::scalar_desc::Types::UINT64;
+ case ArgType::F32:
+ return cldnn::scalar_desc::Types::FLOAT32;
+ case ArgType::F64:
+ return cldnn::scalar_desc::Types::FLOAT64;
+ case ArgType::PTR:
+ break;
+ }
+ OPENVINO_THROW("[GPU] Unexpected scalar ArgType for an MLIR kernel");
+}
+
+// Created by the compiled program and destroyed by it, thus outliving the runtime.
+// Holds no per-stream state: the kernels and their argument descriptors are cached
+// by the stream-local runtime, see GcGpuRuntime::kernel_data().
+struct GcKernel {
+ GcKernel(const uint8_t* bin, size_t size, std::string name, uint32_t n_args, const ArgType* arg_types)
+ : bin(bin),
+ size(size),
+ name(std::move(name)),
+ argTypes(arg_types, arg_types + n_args) {}
+
+ const uint8_t* const bin;
+ const size_t size;
+ const std::string name;
+ const std::vector<ArgType> argTypes;
+};
+
+// The handles passed to the generated code are typed: Event* and Memory* are the
+// addresses of the slots, owned by GcGpuRuntime::events and GcGpuRuntime::memories.
+class GcGpuRuntime final : public ::gc::gpu::GpuRuntime<GcKernel, cldnn::event::ptr, cldnn::memory::ptr>, public MLIRGpuRuntime {
+public:
+ GcGpuRuntime(cldnn::stream& stream, cldnn::engine& engine) : gpuStream(stream), gpuEngine(engine) {
+ const auto& info = engine.get_device_info();
+ deviceInfo = ::gc::gpu::DeviceInfo{info.device_id};
+ deviceInfo.name = info.dev_name;
+ deviceInfo.maxWgSize = static_cast<uint32_t>(info.max_work_group_size);
+ }
+
+ [[nodiscard]] cldnn::stream& stream() const {
+ return gpuStream;
+ }
+
+ [[nodiscard]] const ::gc::gpu::DeviceInfo& getDeviceInfo() const override {
+ return deviceInfo;
+ }
+
+ Kernel* createKernel(const uint8_t* data, size_t size, const char* name, uint32_t n_args, ArgType* arg_types) override {
+ return guard([&] {
+ return new GcKernel(data, size, name, n_args, arg_types);
+ });
+ }
+
+ // Called by the GC-generated code via gcGpuDestroyKernelName, the program owns the kernels.
+ static void destroyKernel(Kernel* kernel) {
+ delete kernel;
+ }
+
+ Event* launch(Kernel* kernel,
+ void** args,
+ uint32_t n_args,
+ uint32_t grid_x,
+ uint32_t grid_y,
+ uint32_t grid_z,
+ uint32_t block_x,
+ uint32_t block_y,
+ uint32_t block_z,
+ Event* const* deps,
+ uint32_t n_deps) override {
+ return guard([&] {
+ OPENVINO_DEBUG_ASSERT(grid_x && grid_y && grid_z && block_x && block_y && block_z, "[GPU] MLIR kernel launch with a zero grid or local size");
+
+ const auto& gc_kernel = *kernel;
+ auto& kd = kernel_data(gc_kernel, n_args);
+
+ auto& global = kd.desc.workGroups.global;
+ auto& local = kd.desc.workGroups.local;
+ global[0] = static_cast<size_t>(grid_x) * block_x;
+ global[1] = static_cast<size_t>(grid_y) * block_y;
+ global[2] = static_cast<size_t>(grid_z) * block_z;
+ local[0] = block_x;
+ local[1] = block_y;
+ local[2] = block_z;
+
+ set_arg_values(kd, gc_kernel.argTypes, args);
+ gpuStream.set_arguments(*kd.kernel, kd.desc, kd.args);
+ auto* ev = store_event(gpuStream.enqueue_kernel(*kd.kernel, kd.desc, kd.args, collect_events(deps, n_deps), /*is_output_event=*/true));
+ eventScratch.clear();
+ kd.args.intermediates.clear();
+ return ev;
+ });
+ }
+
+ Memory* allocDevice(size_t size, size_t alignment) override {
+ return alloc(size, alignment, cldnn::allocation_type::usm_device);
+ }
+ Memory* allocShared(size_t size, size_t alignment) override {
+ return alloc(size, alignment, cldnn::allocation_type::usm_shared);
+ }
+ Memory* allocHost(size_t size, size_t alignment) override {
+ return alloc(size, alignment, cldnn::allocation_type::usm_host);
+ }
+
+ void free(Memory* ptr) override {
+ // After a failure wait() is a no-op, kernels may still use the buffer: keep it until finish().
+ if (!error) {
+ ptr->reset();
+ }
+ }
+
+ Event* memcpy(const Memory* src, Memory* dst, size_t size, Event* const* deps, uint32_t n_deps) override {
+ return guard([&] {
+ // copy_from() takes no dependencies, order the copy after them on the queue.
+ if (const auto& evs = collect_events(deps, n_deps); !evs.empty()) {
+ gpuStream.enqueue_barrier(evs);
+ }
+ eventScratch.clear();
+ return store_event((*dst)->copy_from(gpuStream, **src, 0, 0, size, /*blocking=*/false));
+ });
+ }
+
+ void wait(Event* const* events, uint32_t n_events) override {
+ guard([&] {
+ gpuStream.wait_for_events(collect_events(events, n_events));
+ std::for_each_n(events, n_events, [](Event* ev) {
+ ev->reset();
+ });
+ eventScratch.clear();
+ });
+ }
+
+ Memory* store_memory(cldnn::memory::ptr mem) {
+ memories.push_back(std::move(mem));
+ return &memories.back();
+ }
+
+ Event* store_event(cldnn::event::ptr event) {
+ events.push_back(std::move(event));
+ return &events.back();
+ }
+
+ // Copies the events into the scratch vector, reused to keep the capacity.
+ const std::vector<cldnn::event::ptr>& collect_events(Event* const* events, uint32_t n) {
+ eventScratch.clear();
+ for (uint32_t i = 0; i < n; ++i) {
+ if (const auto& ev = *events[i]) {
+ eventScratch.push_back(ev);
+ }
+ }
+ return eventScratch;
+ }
+
+ static void register_self() {
+ MLIRGpuRuntime::create = &create_runtime;
+ }
+
+private:
+ struct KernelData {
+ cldnn::kernel::ptr kernel;
+ // The argument and scalar descriptors are built once, only the values change per launch.
+ cldnn::kernel_arguments_desc desc;
+ cldnn::kernel_arguments_data args;
+ };
+
+ // The kernels are stream-local, while GcKernel is shared by all the streams running the program.
+ // The program, and thus the GcKernel keys, outlive this runtime.
+ KernelData& kernel_data(const GcKernel& kernel, uint32_t n_args) {
+ OPENVINO_DEBUG_ASSERT(kernel.argTypes.size() == n_args,
+ "[GPU] An MLIR kernel is launched with ",
+ n_args,
+ " arguments, while ",
+ kernel.argTypes.size(),
+ " are declared");
+
+ if (auto it = kernels.find(&kernel); it != kernels.end()) {
+ return it->second;
+ }
+
+ KernelData kd;
+ std::vector<cldnn::kernel::ptr> built;
+ gpuEngine.create_kernel_builder()->build_kernels(kernel.bin, kernel.size, cldnn::KernelFormat::NATIVE_BIN, "", built);
+ auto found = std::find_if(built.begin(), built.end(), [&kernel](const cldnn::kernel::ptr& k) {
+ return k->get_id() == kernel.name;
+ });
+ OPENVINO_ASSERT(found != built.end(), "[GPU] Kernel '", kernel.name, "' is not found in the compiled MLIR module");
+ kd.kernel = std::move(*found);
+
+ uint32_t mem_idx = 0;
+ kd.desc.arguments.reserve(n_args);
+ for (auto type : kernel.argTypes) {
+ if (type == ArgType::PTR) {
+ kd.desc.arguments.push_back({cldnn::argument_desc::Types::INTERNAL_BUFFER, mem_idx++});
+ } else {
+ kd.desc.arguments.push_back({cldnn::argument_desc::Types::SCALAR, static_cast<uint32_t>(kd.desc.scalars.size())});
+ kd.desc.scalars.push_back({to_scalar_type(type), {}});
+ }
+ }
+ kd.args.intermediates.reserve(mem_idx);
+ auto& cached = kernels.emplace(&kernel, std::move(kd)).first->second;
+ cached.args.scalars = &cached.desc.scalars;
+ return cached;
+ }
+
+ static void set_arg_values(KernelData& kd, const std::vector<ArgType>& types, void** args) {
+ kd.args.intermediates.clear();
+ size_t scalar_idx = 0;
+ for (size_t i = 0; i < types.size(); ++i) {
+ if (types[i] == ArgType::PTR) {
+ // A pointer argument is a Memory*, returned by alloc*() or passed via storeMemref().
+ auto* held = *static_cast<Memory**>(args[i]);
+ OPENVINO_ASSERT(held && *held, "[GPU] MLIR kernel pointer argument ", i, " is null");
+ kd.args.intermediates.push_back(*held);
+ } else {
+ std::memcpy(&kd.desc.scalars[scalar_idx++].v, args[i], ::gc::gpu::argSize(types[i]));
+ }
+ }
+ }
+
+ Memory* alloc(size_t size, size_t alignment, cldnn::allocation_type type) {
+ return guard([&] {
+ cldnn::layout layout({static_cast<int64_t>(std::max<size_t>(size, 1))}, ov::element::u8, cldnn::format::bfyx);
+ auto mem = gpuEngine.allocate_memory(layout, type, /*reset=*/false);
+ void* ptr = mem->buffer_ptr();
+ OPENVINO_ASSERT(ptr != nullptr, "[GPU] Failed to allocate ", size, " bytes of USM memory");
+ // USM allocator chooses alignment; only verify the GC request.
+ OPENVINO_ASSERT(alignment == 0 || reinterpret_cast<uintptr_t>(ptr) % alignment == 0,
+ "[GPU] USM allocation is not aligned to ",
+ alignment,
+ " bytes as requested by an MLIR program");
+ return store_memory(std::move(mem));
+ });
+ }
+
+ // Runs the given function and captures any exception, turning subsequent calls into no-ops.
+ template <typename F>
+ auto guard(F&& fn) noexcept -> decltype(fn()) {
+ using R = decltype(fn());
+ if (!error) {
+ try {
+ return fn();
+ } catch (...) {
+ error = std::current_exception();
+ }
+ }
+ if constexpr (std::is_same_v<R, Event*>) {
+ return &noEvent;
+ } else if constexpr (std::is_same_v<R, Memory*>) {
+ return &noMemory;
+ } else if constexpr (!std::is_void_v<R>) {
+ return R{};
+ }
+ }
+
+ void reset() noexcept {
+ events.clear();
+ memories.clear();
+ eventScratch.clear();
+ eventHandles.clear();
+ error = nullptr;
+ }
+
+ friend class GcGpuProgram;
+ cldnn::stream& gpuStream;
+ cldnn::engine& gpuEngine;
+ ::gc::gpu::DeviceInfo deviceInfo;
+ std::unordered_map<const GcKernel*, KernelData> kernels;
+ std::deque<cldnn::memory::ptr> memories;
+ std::deque<cldnn::event::ptr> events;
+ std::vector<cldnn::event::ptr> eventScratch;
+ std::vector<Event*> eventHandles;
+ ProgramArgs args;
+ ProgramArgStorage arg_storage;
+ std::exception_ptr error;
+ // Null slots returned by the callbacks after a failure.
+ Event noEvent;
+ Memory noMemory;
+
+ static std::unique_ptr<MLIRGpuRuntime> create_runtime(cldnn::stream& stream, cldnn::engine& engine) {
+ return std::make_unique<GcGpuRuntime>(stream, engine);
+ }
+};
+
+class GcGpuProgram final : public MLIRGpuProgram {
+public:
+ GcGpuProgram(::gc::gpu::GpuCompiler& compiler, ::mlir::OwningOpRef<::mlir::ModuleOp> module, uint32_t device_id) {
+ const bool dump = is_debug();
+ if (dump) {
+ OPENVINO_MLIR_DEBUG_PRINT("-------------- Source MLIR --------------");
+ module->dump();
+ OPENVINO_MLIR_DEBUG_PRINT("-----------------------------------------");
+ }
+
+ ::gc::gpu::GpuCompiler::Options opts(device_id);
+ opts.wait = false;
+ opts.dump = dump;
+ future = compiler.compile<GcGpuRuntime>(std::move(module), opts);
+ }
+
+ void wait_compiled() override {
+ if (program) {
+ return;
+ }
+ program = future.get();
+ OPENVINO_ASSERT(program != nullptr, "[GPU] Failed to compile an MLIR subgraph with the Graph Compiler");
+ future = {};
+ }
+
+ cldnn::event::ptr execute(MLIRGpuRuntime& runtime,
+ const ov::Node& op,
+ cldnn::primitive_inst& instance,
+ const std::vector<cldnn::event::ptr>& deps,
+ bool need_event) override {
+ OPENVINO_ASSERT(program != nullptr, "[GPU] MLIR program is not compiled");
+ OPENVINO_ASSERT(op.get_input_size() == instance.inputs_memory_count(), "[GPU] mlir_primitive '", instance.id(), "': input count mismatch");
+ OPENVINO_ASSERT(op.get_output_size() == instance.outputs_memory_count(), "[GPU] mlir_primitive '", instance.id(), "': output count mismatch");
+ // GcGpuRuntime is the only MLIRGpuRuntime, see create_runtime().
+ auto& rt = static_cast<GcGpuRuntime&>(runtime);
+ const struct Cleanup {
+ GcGpuRuntime& rt;
+ ~Cleanup() {
+ rt.reset();
+ }
+ } cleanup{rt};
+
+ ::gc::gpu::ArgsBuilder<ProgramArgs, ProgramArgStorage> builder(rt.args, rt.arg_storage);
+ const auto store_memref = [&](const cldnn::memory::ptr& mem, size_t idx, bool input, unsigned rank, ov::element::Type type) {
+ const auto argument = [&]() -> std::string {
+ if (!input) {
+ return "output " + std::to_string(idx);
+ }
+ const auto& dependency = instance.dependencies().at(idx);
+ return "input " + std::to_string(idx) + " from dependency '" + dependency.first->id() + "' (" +
+ dependency.first->get_node().get_primitive()->type_string() + ")";
+ };
+
+ const auto& layout = mem->get_layout();
+ OPENVINO_ASSERT(cldnn::format::is_default_format(layout.format), "[GPU] Only plain layouts are supported by mlir_primitive '", instance.id(), "'");
+ OPENVINO_ASSERT(!layout.data_padding, "[GPU] mlir_primitive '", instance.id(), "', ", argument(), ": padded buffers are not supported");
+ OPENVINO_ASSERT(mem->buffer_ptr() != nullptr, "[GPU] mlir_primitive '", instance.id(), "' requires USM buffers");
+ OPENVINO_ASSERT(layout.data_type == type,
+ "[GPU] mlir_primitive '",
+ instance.id(),
+ "', ",
+ argument(),
+ ": element type mismatch, layout ",
+ layout.data_type,
+ " vs ",
+ type);
+ auto* held = rt.store_memory(mem);
+
+ const auto& ps = layout.get_partial_shape();
+ OPENVINO_ASSERT(ps.size() >= rank, "[GPU] mlir_primitive '", instance.id(), "': expected rank ", rank, ", got ", ps.size());
+ // A plain unpadded layout is dense row-major: the strides are the trailing dimension products.
+ llvm::SmallVector<int64_t, 12> strides(ps.size());
+ int64_t stride = 1;
+ for (size_t i = ps.size(); i--;) {
+ OPENVINO_ASSERT(ps[i].is_static(), "[GPU] mlir_primitive '", instance.id(), "' requires static buffer dimensions");
+ OPENVINO_ASSERT(i < rank || ps[i].get_length() == 1,
+ "[GPU] mlir_primitive '",
+ instance.id(),
+ "': trailing dimension ",
+ i,
+ " of ",
+ argument(),
+ " is not 1");
+ strides[i] = stride;
+ stride *= ps[i].get_length();
+ }
+
+ builder.storeMemref(
+ held,
+ rank,
+ [&](unsigned i) {
+ return ps[i].get_length();
+ },
+ [&](unsigned i) {
+ return strides[i];
+ });
+ };
+
+ llvm::SmallVector<unsigned, 16> ranks;
+ ranks.reserve(op.get_input_size() + op.get_output_size());
+ const auto store_all = [&](size_t n, bool input) {
+ for (size_t i = 0; i < n; ++i) {
+ const auto rank = input ? op.get_input_partial_shape(i).rank() : op.get_output_partial_shape(i).rank();
+ OPENVINO_ASSERT(rank.is_static(), "[GPU] MLIR subgraph arguments must have a static rank");
+ const auto r = static_cast<unsigned>(rank.get_length());
+ store_memref(input ? instance.input_memory_ptr(i) : instance.output_memory_ptr(i),
+ i,
+ input,
+ r,
+ input ? op.get_input_element_type(i) : op.get_output_element_type(i));
+ ranks.push_back(r);
+ }
+ };
+ store_all(op.get_input_size(), /*input=*/true);
+ store_all(op.get_output_size(), /*input=*/false);
+
+ for (const auto& dep : deps) {
+ rt.eventHandles.push_back(rt.store_event(dep));
+ }
+
+ auto** events = program->main(builder.build(*program),
+ &rt,
+ rt.eventHandles.empty() ? nullptr : rt.eventHandles.data(),
+ static_cast<uint32_t>(rt.eventHandles.size()));
+ if (rt.error) {
+ try {
+ rt.stream().finish();
+ } catch (...) {
+ }
+ std::rethrow_exception(rt.error);
+ }
+ // Copy the completions out; do not wait(). OV owns the events after this.
+ // main() waits for the buffers it has allocated and frees them, so dropping the frame is safe.
+ const auto& completions = rt.collect_events(events, program->eventNum());
+ return completions.empty() ? rt.stream().enqueue_marker(deps, need_event) : rt.stream().aggregate_events(completions, /*group=*/true, need_event);
+ }
+
+private:
+ ::gc::gpu::FutureProgram future;
+ std::shared_ptr<::gc::gpu::Program> program;
+};
+
+} // namespace
+
+void register_mlir_gpu_runtime() {
+ GcGpuRuntime::register_self();
+}
+
+std::shared_ptr<MLIRGpuProgram> create_gpu_program(::mlir::OwningOpRef<::mlir::ModuleOp> module, uint32_t device_id) {
+ return std::make_shared<GcGpuProgram>(::gc::gpu::GpuCompiler::get(), std::move(module), device_id);
+}
+
+} // namespace ov::intel_gpu::mlir
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/convert.hpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/convert.hpp
index 9a587af3b22..1101ca572ed 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/convert.hpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/convert.hpp
@@ -4,17 +4,17 @@
#pragma once
+#include <cstdint>
#include <memory>
#include "intel_gpu/runtime/execution_config.hpp"
-#include "openvino/core/any.hpp"
#include "openvino/core/model.hpp"
namespace ov::intel_gpu::mlir {
-// 'config' is needed for the per-model ov::intel_gpu::mlir_patterns option
-void transformMLIR(const std::shared_ptr<ov::Model>& model,
- const ExecutionConfig& config,
- const std::shared_ptr<ov::EvaluationContext>& loweringContext);
+// Replaces the supported subgraphs of the model with MLIROp and starts the background compilation of
+// each of them. 'config' is needed for the per-model ov::intel_gpu::mlir_patterns option and
+// 'device_id' is the hardware device ID the programs are compiled for.
+void transformMLIR(const std::shared_ptr<ov::Model>& model, const ExecutionConfig& config, uint32_t device_id);
} // namespace ov::intel_gpu::mlir
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/gpu_runtime.hpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/gpu_runtime.hpp
new file mode 100644
index 00000000000..d92bfa4fa93
--- /dev/null
+++ b/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/gpu_runtime.hpp
@@ -0,0 +1,56 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <memory>
+#include <vector>
+
+#include "intel_gpu/runtime/event.hpp"
+
+namespace cldnn {
+class stream;
+class engine;
+struct network;
+class primitive_inst;
+} // namespace cldnn
+
+namespace ov {
+class Node;
+} // namespace ov
+
+namespace ov::intel_gpu::mlir {
+
+struct MLIRGpuRuntime {
+public:
+ virtual ~MLIRGpuRuntime() = default;
+ MLIRGpuRuntime(const MLIRGpuRuntime&) = delete;
+ MLIRGpuRuntime& operator=(const MLIRGpuRuntime&) = delete;
+
+protected:
+ MLIRGpuRuntime() = default;
+ friend struct ::cldnn::network;
+ inline static std::unique_ptr<MLIRGpuRuntime> (*create)(cldnn::stream&, cldnn::engine&) = nullptr;
+};
+
+class MLIRGpuProgram {
+public:
+ virtual ~MLIRGpuProgram() = default;
+ MLIRGpuProgram(const MLIRGpuProgram&) = delete;
+ MLIRGpuProgram& operator=(const MLIRGpuProgram&) = delete;
+
+ virtual void wait_compiled() = 0;
+ virtual cldnn::event::ptr execute(MLIRGpuRuntime& runtime,
+ const ov::Node& op,
+ cldnn::primitive_inst& instance,
+ const std::vector<cldnn::event::ptr>& deps,
+ bool need_event) = 0;
+
+protected:
+ MLIRGpuProgram() = default;
+};
+
+void register_mlir_gpu_runtime();
+
+} // namespace ov::intel_gpu::mlir
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/mlir_evaluate_base.hpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/mlir_evaluate_base.hpp
deleted file mode 100644
index faa81d4d9e3..00000000000
--- a/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/mlir_evaluate_base.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#pragma once
-
-#include <vector>
-
-#include "openvino/core/node.hpp"
-#include "openvino/runtime/tensor.hpp"
-
-namespace ov::intel_gpu::mlir {
-
-class MLIREvaluateBase {
-public:
- [[nodiscard]] virtual bool requires_packed_args() const = 0;
- virtual bool invoke(const ov::TensorVector& inputs, ov::TensorVector& outputs, const ov::EvaluationContext& evaluationContext) = 0;
- virtual bool invoke_packed(std::vector<void*>& args, const ov::EvaluationContext& evaluationContext) = 0;
- virtual ~MLIREvaluateBase() = default;
-};
-
-} // namespace ov::intel_gpu::mlir
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/properties.hpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/properties.hpp
deleted file mode 100644
index a9a273a2191..00000000000
--- a/src/plugins/intel_gpu/src/plugin/transformations/mlir/interface/properties.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#pragma once
-
-#include <vector>
-
-#include "openvino/runtime/properties.hpp"
-
-namespace ov::internal::mlir_meta {
-
-/**
- * @brief This key identifies a list of cl_event to wait for a kernel execution.
- */
-static constexpr Property<std::vector<void*>> wait_list{"EVENTS_WAIT_LIST"};
-
-/**
- * @brief This key identifies a pointer to a list that should be filled with
- * result cl_events of a kernel execution.
- */
-static constexpr Property<std::vector<void*>*> result_events{"RESULT_EVENTS"};
-
-/**
- * @brief This key identifies whether the kernel argument at [i] position is USM pointer
- */
-static constexpr Property<std::vector<bool>> is_kernel_arg_usm{"IS_KERNEL_ARG_USM"};
-
-} // namespace ov::internal::mlir_meta
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/mlir_evaluate.cpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/mlir_evaluate.cpp
deleted file mode 100644
index 185bb1ad98c..00000000000
--- a/src/plugins/intel_gpu/src/plugin/transformations/mlir/mlir_evaluate.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "mlir_evaluate.hpp"
-
-#include <memory>
-#include <vector>
-
-#include "common/convert_common.hpp"
-#include "gc/ExecutionEngine/GPURuntime/GpuOclRuntime.h"
-#include "gc/Transforms/Passes.h"
-#include "interface/properties.hpp"
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
-#include "openvino/runtime/intel_gpu/remote_properties.hpp"
-
-namespace ov::intel_gpu::mlir {
-
-using namespace ::mlir;
-
-static cl_device_id extract_device_from_context(cl_context context) {
- size_t devices_size = 0;
- cl_int err = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, nullptr, &devices_size);
- if (err != CL_SUCCESS) {
- OPENVINO_THROW("Error getting context info: ", err);
- }
- if (devices_size / sizeof(cl_device_id) != 1) {
- OPENVINO_THROW("Expected exactly one device in the context, got ", devices_size);
- }
-
- cl_device_id devices = nullptr;
- // cl_device_id is itself a pointer type and clGetContextInfo takes its output buffer as 'void*',
- // so the extra level of indirection is dictated by the OpenCL API and cannot be avoided here.
- // NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
- err = clGetContextInfo(context, CL_CONTEXT_DEVICES, devices_size, &devices, nullptr);
- if (err != CL_SUCCESS) {
- OPENVINO_THROW("Error getting device IDs: ", err);
- }
-
- return devices;
-}
-
-MLIREvaluateGcGPU::MLIREvaluateGcGPU(OwningOpRef<::mlir::ModuleOp> _module, const std::shared_ptr<ov::EvaluationContext>& loweringContext) {
- if (::ov::intel_gpu::mlir::is_debug()) {
- OPENVINO_MLIR_DEBUG_PRINT("-------------- Source MLIR --------------");
- _module->dump();
- OPENVINO_MLIR_DEBUG_PRINT("-----------------------------------------");
- }
-
- gc::gpu::OclModuleBuilderOpts opts;
- gc::gpu::OclModuleBuilder builder(std::move(_module), opts);
-
- auto it = loweringContext->find(ov::intel_gpu::ocl_context.name());
- if (it == loweringContext->end()) {
- OPENVINO_THROW("No cl_context provided for OpenCL execution");
- }
- auto* context = reinterpret_cast<cl_context>(it->second.as<ov::intel_gpu::gpu_handle_param>());
- // assuming there's always one device per context
- auto* device = extract_device_from_context(context);
-
- if (auto mod = builder.build(device, context)) {
- module = std::make_unique<const gc::gpu::OclModule>(*mod);
- } else {
- OPENVINO_THROW("Failed to build gc::gpuOclModule module");
- }
-}
-
-bool MLIREvaluateGcGPU::invoke(const ov::TensorVector& inputs, ov::TensorVector& outputs, const ov::EvaluationContext& evaluationContext) {
- gc::gpu::OclContext ctx = build_ocl_context(evaluationContext);
- gc::gpu::StaticExecutor<> exec(*module);
-
- auto it = evaluationContext.find(ov::internal::mlir_meta::is_kernel_arg_usm.name());
- if (it == evaluationContext.end()) {
- OPENVINO_THROW("No is_kernel_arg_usm provided for OpenCL execution");
- }
- std::vector<bool> arg_types = it->second.as<std::vector<bool>>();
-
- for (size_t i = 0; i < inputs.size(); ++i) {
- exec.arg(inputs[i].data(), arg_types[i]);
- }
- for (size_t i = 0, j = inputs.size(); i < outputs.size(); ++i, ++j) {
- exec.arg(outputs[i].data(), arg_types[j]);
- }
-
- exec(ctx);
-
- // Hands the completion events over via the mlir_meta::result_events vector, from which
- // cldnn::mlir_primitive builds the event returned by the primitive
- maybe_set_result_events(evaluationContext, ctx);
- return true;
-}
-
-bool MLIREvaluateGcGPU::invoke_packed(std::vector<void*>& args, const ov::EvaluationContext& evaluationContext) {
- gc::gpu::OclContext ctx = build_ocl_context(evaluationContext);
- gc::gpu::DynamicExecutor<> exec(*module);
-
- // Layout (5 pointers per memref, see MemRefDescriptor::append_to_packed_args
- // in transformations/op/mlir_op.cpp):
- // [aligned, rank, shape*, strides*, is_usm]
- constexpr size_t kStride = 5;
- OPENVINO_ASSERT(args.size() % kStride == 0, "[GPU] MLIREvaluateGcGPU::invoke_packed: malformed args vector");
- for (size_t i = 0; i < args.size(); i += kStride) {
- exec.arg(
- /*alignedPtr=*/args[i],
- /*rank=*/static_cast<size_t>(reinterpret_cast<uintptr_t>(args[i + 1])),
- /*shape=*/reinterpret_cast<int64_t*>(args[i + 2]),
- /*strides=*/reinterpret_cast<int64_t*>(args[i + 3]),
- /*isUsm=*/reinterpret_cast<uintptr_t>(args[i + 4]) != 0);
- }
- exec(ctx);
- // Hands the completion events over via the mlir_meta::result_events vector, from which
- // cldnn::mlir_primitive builds the event returned by the primitive
- maybe_set_result_events(evaluationContext, ctx);
- return true;
-}
-
-void MLIREvaluateGcGPU::maybe_set_result_events(const ov::EvaluationContext& evaluationContext, gc::gpu::OclContext& ctx) {
- auto events_it = evaluationContext.find(ov::internal::mlir_meta::result_events.name());
- if (events_it == evaluationContext.end()) {
- return;
- }
-
- auto retain_event = [](cl_event event) {
- const auto err = clRetainEvent(event);
- if (err != CL_SUCCESS) {
- OPENVINO_THROW("Failed to retain MLIR result event, error: ", err);
- }
- };
-
- auto* events = events_it->second.as<std::vector<void*>*>();
- events->reserve(events->size() + ctx.events.size());
- for (auto* event : ctx.events) {
- retain_event(event);
- events->push_back(event);
- }
-}
-
-// Builds the gc::gpu::OclContext describing a single execution: the queue to enqueue to, the events
-// to wait for and whether Graph Compiler has to produce completion events.
-//
-// The wait-list is stored in the EvaluationContext as a std::vector<void*> owned by an
-// ov::Any, while OclContext takes a plain cl_event* + length, so they are copied into a local vector
-// first. The OclContext constructor clRetainEvent()s them and copies them into its own storage, so
-// that vector is no longer needed once the context is built.
-gc::gpu::OclContext MLIREvaluateGcGPU::build_ocl_context(const ov::EvaluationContext& evaluationContext) {
- auto it = evaluationContext.find(ov::intel_gpu::ocl_queue.name());
- if (it == evaluationContext.end()) {
- OPENVINO_THROW("No queue provided for OpenCL execution");
- }
- auto* queue = reinterpret_cast<cl_command_queue>(it->second.as<void*>());
-
- std::vector<void*> waitList;
- uint32_t waitListLen = 0;
-
- it = evaluationContext.find(ov::internal::mlir_meta::wait_list.name());
- if (it != evaluationContext.end()) {
- waitList = it->second.as<std::vector<void*>>();
- waitListLen = waitList.size();
- }
-
- const bool createEvents = evaluationContext.count(ov::internal::mlir_meta::result_events.name()) != 0;
- return gc::gpu::OclContext(module->runtime, queue, createEvents, waitListLen, reinterpret_cast<cl_event*>(waitList.data()));
-}
-
-} // namespace ov::intel_gpu::mlir
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/mlir/mlir_evaluate.hpp b/src/plugins/intel_gpu/src/plugin/transformations/mlir/mlir_evaluate.hpp
deleted file mode 100644
index 3de14c5c63f..00000000000
--- a/src/plugins/intel_gpu/src/plugin/transformations/mlir/mlir_evaluate.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#pragma once
-
-#include <memory>
-#include <vector>
-
-#include "gc/ExecutionEngine/GPURuntime/GpuOclRuntime.h"
-#include "interface/mlir_evaluate_base.hpp"
-#include "mlir/ExecutionEngine/ExecutionEngine.h"
-#include "mlir/IR/BuiltinOps.h"
-#include "openvino/core/any.hpp"
-#include "openvino/core/node.hpp"
-#include "openvino/runtime/tensor.hpp"
-
-namespace ov::intel_gpu::mlir {
-
-using ::mlir::ExecutionEngine;
-using ::mlir::ModuleOp;
-using ::mlir::OwningOpRef;
-
-class MLIREvaluateGcGPU : public MLIREvaluateBase {
- std::unique_ptr<const ::mlir::gc::gpu::OclModule> module;
-
-public:
- MLIREvaluateGcGPU(OwningOpRef<ModuleOp> _module, const std::shared_ptr<ov::EvaluationContext>& loweringContext);
-
- [[nodiscard]] bool requires_packed_args() const override {
- return !module->isStatic();
- }
- bool invoke(const ov::TensorVector& inputs, ov::TensorVector& outputs, const ov::EvaluationContext& evaluationContext) override;
- bool invoke_packed(std::vector<void*>& args, const ov::EvaluationContext& evaluationContext) override;
-
-private:
- ::mlir::gc::gpu::OclContext build_ocl_context(const ov::EvaluationContext& evaluationContext);
- static void maybe_set_result_events(const ov::EvaluationContext& evaluationContext, ::mlir::gc::gpu::OclContext& ctx);
-};
-
-} // namespace ov::intel_gpu::mlir
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/op/mlir_op.cpp b/src/plugins/intel_gpu/src/plugin/transformations/op/mlir_op.cpp
index 0712f95bd0c..b7bb56a1a8f 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations/op/mlir_op.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations/op/mlir_op.cpp
@@ -6,83 +6,20 @@
# include "intel_gpu/op/mlir_op.hpp"
-# include <algorithm>
-# include <cassert>
-# include <iterator>
# include <memory>
# include <utility>
# include <vector>
-# include "../mlir/interface/mlir_evaluate_base.hpp"
-# include "../mlir/interface/properties.hpp"
# include "openvino/core/shape.hpp"
namespace ov::intel_gpu::op {
-namespace {
-
-// Descriptor packed into the 5-slot layout expected by
-// MLIREvaluateGcGPU::invoke_packed:
-// [aligned, rank, shape*, strides*, is_usm]
-// TODO: u4/i4 types are not supported
-struct MemRefDescriptor {
- MemRefDescriptor() = default;
-
- MemRefDescriptor(ov::Tensor tensor, const ov::PartialShape& module_input_shape) : allocated(tensor.data()), aligned(tensor.data()) {
- OPENVINO_ASSERT(module_input_shape.rank().is_static(), "MLIROp: module_input_shape rank must be static");
- const auto module_rank = static_cast<size_t>(module_input_shape.rank().get_length());
- OPENVINO_ASSERT(module_rank <= tensor.get_shape().size(),
- "MLIROp: tensor rank (",
- tensor.get_shape().size(),
- ") is smaller than expected module rank (",
- module_rank,
- ")");
-
- // Keep only the leading `module_rank` dims; the trailing ones must all be 1
- auto it = std::next(tensor.get_shape().begin(), module_rank);
- shape.assign(tensor.get_shape().begin(), it);
- if (std::any_of(it, tensor.get_shape().end(), [](size_t dim) {
- return dim != 1;
- })) {
- OPENVINO_THROW("Mismatch in shape sizes");
- }
-
- strides.resize(shape.size());
- const auto& byte_strides = tensor.get_strides();
- auto element_size = tensor.get_element_type().size();
- for (size_t i = 0; i < strides.size(); ++i) {
- assert(byte_strides[i] % element_size == 0);
- // TODO: handle case when stride is not aligned (restrict at OV API level)
- strides[i] = byte_strides[i] / element_size;
- }
- }
-
- explicit MemRefDescriptor(const ov::Tensor& tensor) : MemRefDescriptor(tensor, tensor.get_shape()) {}
-
- void* allocated = nullptr;
- void* aligned = nullptr;
- int64_t offset = 0L;
- std::vector<int64_t> shape;
- std::vector<int64_t> strides;
-
- void append_to_packed_args(std::vector<void*>& args, bool is_usm) {
- args.push_back(aligned);
- // The kernel ABI passes scalars in the same 'void*' slots as pointers, so integer-to-pointer
- // casts are required here; there is no pointer-typed alternative.
- // NOLINTNEXTLINE(performance-no-int-to-ptr)
- args.push_back(reinterpret_cast<void*>(static_cast<uintptr_t>(shape.size())));
- args.push_back(shape.data());
- args.push_back(strides.data());
- // NOLINTNEXTLINE(performance-no-int-to-ptr)
- args.push_back(reinterpret_cast<void*>(static_cast<uintptr_t>(is_usm)));
- }
-};
-
-} // namespace
-
-MLIROp::MLIROp(const ov::OutputVector& args, std::shared_ptr<mlir::MLIREvaluateBase> engine, OVOutputTypes output_types, DimensionsMap dimensions_map)
+MLIROp::MLIROp(const ov::OutputVector& args,
+ std::shared_ptr<mlir::MLIRGpuProgram> program,
+ OVOutputTypes output_types,
+ DimensionsMap dimensions_map)
: Op(args),
- engine(std::move(engine)),
+ program(std::move(program)),
output_types(std::move(output_types)),
dimensions_map(std::move(dimensions_map)) {
constructor_validate_and_infer_types();
@@ -161,61 +98,7 @@ void MLIROp::validate_and_infer_types() {
}
std::shared_ptr<ov::Node> MLIROp::clone_with_new_inputs(const ov::OutputVector& new_args) const {
- return std::make_shared<MLIROp>(new_args, engine, output_types, dimensions_map);
-}
-
-bool MLIROp::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs, const ov::EvaluationContext& evaluationContext) const {
- if (!engine->requires_packed_args()) {
- return engine->invoke(inputs, outputs, evaluationContext);
- }
-
- std::vector<MemRefDescriptor> memref_args;
- memref_args.reserve(inputs.size() + outputs.size());
- for (size_t i = 0; i < inputs.size(); ++i) {
- const auto& initial_shape = get_input_partial_shape(i);
- memref_args.emplace_back(inputs[i], initial_shape);
- }
- for (size_t i = 0; i < outputs.size(); ++i) {
- // TODO: Optimize by adding all dimensions to dimensions_map, not only dynamic
- ov::Shape target;
- ov::PartialShape expected = get_output_partial_shape(i);
- for (size_t j = 0; j < expected.size(); ++j) {
- auto dim = expected[j];
- if (dim.is_dynamic()) {
- size_t input_index = 0, dim_index = 0;
- std::tie(input_index, dim_index) = dimensions_map[i][j];
- target.push_back(inputs[input_index].get_shape()[dim_index]);
- } else {
- target.push_back(dim.get_length());
- }
- }
- outputs[i].set_shape(target);
- memref_args.emplace_back(outputs[i]);
- }
-
- std::vector<bool> is_usm;
- auto it = evaluationContext.find(ov::internal::mlir_meta::is_kernel_arg_usm.name());
- if (it != evaluationContext.end()) {
- is_usm = it->second.as<std::vector<bool>>();
- } else {
- is_usm.assign(memref_args.size(), false);
- }
- OPENVINO_ASSERT(is_usm.size() == memref_args.size(), "[GPU] MLIROp::evaluate: is_usm and memref count mismatch");
-
- std::vector<void*> args;
- for (size_t k = 0; k < memref_args.size(); ++k) {
- memref_args[k].append_to_packed_args(args, is_usm[k]);
- }
-
- return engine->invoke_packed(args, evaluationContext);
-}
-
-bool MLIROp::evaluate(ov::TensorVector& outputs, const ov::TensorVector& inputs) const {
- return evaluate(outputs, inputs, ov::EvaluationContext());
-}
-
-bool MLIROp::has_evaluate() const {
- return true;
+ return std::make_shared<MLIROp>(new_args, program, output_types, dimensions_map);
}
} // namespace ov::intel_gpu::op
diff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
index f12e9ce51a4..5091a2dc79b 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
@@ -1739,14 +1739,7 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {
// Guarded by OV_GPU_MLIR_BACKEND_LINKED rather than ENABLE_MLIR_FOR_GPU: this file is also
// compiled into ov_gpu_unit_tests, which does not link the MLIR objects providing transformMLIR().
#ifdef OV_GPU_MLIR_BACKEND_LINKED
- auto loweringContext = std::make_shared<ov::EvaluationContext>();
- auto it = m_context->get_property().find(ov::intel_gpu::ocl_context.name());
- if (it != m_context->get_property().end()) {
- // We assume here that there's only one device per context and that an
- // actual device will be extracted later by the 'mlir_op'.
- loweringContext->insert(ov::intel_gpu::ocl_context(it->second.as<ov::intel_gpu::gpu_handle_param>()));
- }
- ov::intel_gpu::mlir::transformMLIR(func, config, loweringContext);
+ ov::intel_gpu::mlir::transformMLIR(func, config, device_info.device_id);
#else
OPENVINO_THROW("[GPU] Property 'GPU_ENABLE_MLIR' (or OV_GPU_ENABLE_MLIR env var) is enabled, "
"but this binary was built without Graph Compiler support. "
diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_base_event.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_base_event.hpp
index 5ce1ec27985..c2b56e1ef43 100644
--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_base_event.hpp
+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_base_event.hpp
@@ -26,9 +26,6 @@ public:
explicit ocl_base_event(uint64_t queue_stamp = 0) : _queue_stamp(queue_stamp) { }
uint64_t get_queue_stamp() const { return _queue_stamp; }
virtual cl::Event& get() = 0;
-#ifdef ENABLE_MLIR_FOR_GPU
- void* get_native_handle() override { return static_cast<void*>(get().get()); }
-#endif
protected:
uint64_t _queue_stamp = 0;
diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_memory.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_memory.hpp
index 8adc37ccfd4..8151344421c 100644
--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_memory.hpp
+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_memory.hpp
@@ -47,9 +47,6 @@ struct gpu_buffer : public lockable_gpu_mem, public memory {
void* buffer_ptr() const override {
return get_buffer().get();
}
-#ifdef ENABLE_MLIR_FOR_GPU
- void* get_native_handle() const override { return static_cast<void*>(get_buffer().get()); }
-#endif
event::ptr copy_from(stream& stream, const void* data_ptr, size_t src_offset, size_t dst_offset, size_t size, bool blocking) override;
event::ptr copy_from(stream& stream, const memory& src_mem, size_t src_offset, size_t dst_offset, size_t size, bool blocking) override;
diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp
index fa3749b2f98..1a50c26942f 100644
--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp
+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp
@@ -403,14 +403,6 @@ event::ptr ocl_stream::create_base_event() {
return std::make_shared<ocl_event>(ret_ev, ++_queue_counter);
}
-#ifdef ENABLE_MLIR_FOR_GPU
-event::ptr ocl_stream::create_base_event(void* handle) {
- cl::Event ret_ev;
- ret_ev = reinterpret_cast<cl_event>(handle);
- return std::make_shared<ocl_event>(ret_ev, ++_queue_counter);
-}
-#endif
-
std::unique_ptr<surfaces_lock> ocl_stream::create_surfaces_lock(const std::vector<memory::ptr>& mem) const {
return std::unique_ptr<ocl::ocl_surfaces_lock>(new ocl::ocl_surfaces_lock(mem, *this));
}
diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp
index 94ee7c565eb..79f8f6ef0ac 100644
--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp
+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp
@@ -19,9 +19,6 @@ namespace ocl {
class ocl_stream : public stream {
public:
const ocl_queue_type& get_cl_queue() const { return _command_queue; }
-#ifdef ENABLE_MLIR_FOR_GPU
- void* get_native_handle() const override { return static_cast<void*>(get_cl_queue().get()); }
-#endif
ocl_stream(const ocl_engine& engine, const ExecutionConfig& config);
ocl_stream(const ocl_engine &engine, const ExecutionConfig& config, void *handle);
@@ -52,9 +49,6 @@ public:
void enqueue_barrier(const std::vector<event::ptr>& deps) override;
event::ptr create_user_event(bool set) override;
event::ptr create_base_event() override;
-#ifdef ENABLE_MLIR_FOR_GPU
- event::ptr create_base_event(void* handle) override;
-#endif
std::unique_ptr<surfaces_lock> create_surfaces_lock(const std::vector<memory::ptr> &mem) const override;
const cl::UsmHelper& get_usm_helper() const { return _engine.get_usm_helper(); }
diff --git a/src/plugins/intel_gpu/thirdparty/cmake/graph-compiler.cmake b/src/plugins/intel_gpu/thirdparty/cmake/graph-compiler.cmake
index e9e56ceaf7c..77a7cd43a34 100644
--- a/src/plugins/intel_gpu/thirdparty/cmake/graph-compiler.cmake
+++ b/src/plugins/intel_gpu/thirdparty/cmake/graph-compiler.cmake
@@ -9,8 +9,8 @@ find_package(GraphCompiler QUIET CONFIG)
if (NOT GraphCompiler_FOUND)
option(GRAPH_COMPILER_DYLINK "Use dynamic linking with GraphCompiler" OFF)
- set(GRAPH_COMPILER_REPO "https://github.com/dchigarev/graph-compiler" CACHE STRING "GraphCompiler repository URL")
- set(GRAPH_COMPILER_TAG "ov_pin/0.1.1" CACHE STRING "GraphCompiler git tag/branch")
+ set(GRAPH_COMPILER_REPO "https://github.com/intel/graph-compiler" CACHE STRING "GraphCompiler repository URL")
+ set(GRAPH_COMPILER_TAG "v1" CACHE STRING "GraphCompiler git tag/branch")
message(STATUS "GraphCompiler not found, fetching from: ${GRAPH_COMPILER_REPO}")
include(FetchContent)
FetchContent_Declare(
@@ -21,7 +21,7 @@ if (NOT GraphCompiler_FOUND)
)
set(GC_ENABLE_TEST OFF CACHE BOOL "" FORCE)
set(GC_ENABLE_TOOLS OFF CACHE BOOL "" FORCE)
- set(GC_ENABLE_PYTHON_BINDINGS OFF CACHE BOOL "" FORCE)
+ set(GC_ENABLE_ZE OFF CACHE BOOL "" FORCE)
set(GC_DYLINK ${GRAPH_COMPILER_DYLINK} CACHE BOOL "" FORCE)
set(_ov_build_shared_libs ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS ${GRAPH_COMPILER_DYLINK})