Skip to content

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

Using environmental variables to enable/disable CM usage (#29643)

Mikolaj Roszczyk7614843b0456
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp
index 5ef5f00b636..06d1a3f3e01 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp
@@ -129,6 +129,7 @@ static constexpr Property<std::string, PropertyMutability::RW> config_file{"CONF
static constexpr Property<float, PropertyMutability::RW> buffers_preallocation_ratio{"GPU_BUFFERS_PREALLOCATION_RATIO"};
static constexpr Property<size_t, PropertyMutability::RW> max_kernels_per_batch{"GPU_MAX_KERNELS_PER_BATCH"};
static constexpr Property<bool, PropertyMutability::RW> use_onednn{"GPU_USE_ONEDNN"};
+static constexpr Property<bool, PropertyMutability::RW> use_cm{"GPU_USE_CM"};
static constexpr Property<bool, ov::PropertyMutability::RW> help{"HELP"};
static constexpr Property<size_t, ov::PropertyMutability::RW> verbose{"VERBOSE"};
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/options.inl b/src/plugins/intel_gpu/include/intel_gpu/runtime/options.inl
index b67a73f6309..b47397167d8 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/options.inl
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/options.inl
@@ -44,6 +44,7 @@ OV_CONFIG_RELEASE_INTERNAL_OPTION(ov::intel_gpu, force_implementations, ImplForc
OV_CONFIG_RELEASE_INTERNAL_OPTION(ov::intel_gpu, partial_build_program, false, "Early exit from model compilation process which allows faster execution graph dumping")
OV_CONFIG_RELEASE_INTERNAL_OPTION(ov::intel_gpu, allow_new_shape_infer, false, "Switch between new and old shape inference flow. Shall be removed soon")
OV_CONFIG_RELEASE_INTERNAL_OPTION(ov::intel_gpu, use_onednn, false, "Enable/Disable onednn for usage for particular model/platform")
+OV_CONFIG_RELEASE_INTERNAL_OPTION(ov::intel_gpu, use_cm, true, "Enable/Disable CM for usage for particular model/platform")
OV_CONFIG_RELEASE_INTERNAL_OPTION(ov::intel_gpu, max_kernels_per_batch, 8, "Controls how many kernels we combine into batch for more efficient ocl compilation")
OV_CONFIG_RELEASE_INTERNAL_OPTION(ov::intel_gpu, impls_cache_capacity, 300, "Controls capacity of LRU implementations cache that is created for each program object for dynamic models")
diff --git a/src/plugins/intel_gpu/src/graph/impls/cm/xetla_lstm_seq.hpp b/src/plugins/intel_gpu/src/graph/impls/cm/xetla_lstm_seq.hpp
index 2803dd3d2f9..30cbdfc3d9e 100644
--- a/src/plugins/intel_gpu/src/graph/impls/cm/xetla_lstm_seq.hpp
+++ b/src/plugins/intel_gpu/src/graph/impls/cm/xetla_lstm_seq.hpp
@@ -45,7 +45,7 @@ struct LSTMSeqImplementationManager : public ImplementationManager {
const auto& info = engine.get_device_info();
// XeTLA LSTM optimized for Xe2 architectures
- if (!check_cm_jit_support(engine, config) || info.arch != gpu_arch::xe2) {
+ if (!check_cm_jit_support(engine, config) || info.arch != gpu_arch::xe2 || !config.get_use_cm()) {
return false;
}
diff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
index 8cac8002675..3f1ef703cc8 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
@@ -555,7 +555,7 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {
const auto &lstm_seq = ov::as_type_ptr<const ov::op::v5::LSTMSequence>(node);
auto &engine = m_context->get_engine();
- if (!cldnn::check_cm_jit_support(engine, config) || engine.get_device_info().arch != cldnn::gpu_arch::xe2) {
+ if (!cldnn::check_cm_jit_support(engine, config) || engine.get_device_info().arch != cldnn::gpu_arch::xe2 || !config.get_use_cm()) {
return false;
}