Skip to content

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

[GPU] New option dynamic_quantization_group_size_unsupported (#30415)

Mingyu Kim27d40fecef1e
diff --git a/src/inference/include/openvino/runtime/intel_gpu/properties.hpp b/src/inference/include/openvino/runtime/intel_gpu/properties.hpp
index 5b0f2df9261..22064c57159 100644
--- a/src/inference/include/openvino/runtime/intel_gpu/properties.hpp
+++ b/src/inference/include/openvino/runtime/intel_gpu/properties.hpp
@@ -132,6 +132,16 @@ static constexpr Property<bool> enable_sdpa_optimization{"GPU_ENABLE_SDPA_OPTIMI
* @ingroup ov_runtime_ocl_gpu_prop_cpp_api
*/
static constexpr Property<bool> enable_kernels_reuse{"GPU_ENABLE_KERNELS_REUSE"};
+
+/**
+ * @brief This property defines maximum group size for dynamic quantization optimization
+ * @ingroup ov_runtime_cpp_prop_api
+ *
+ * If dynamic_quantization_group_size is larger than this max value, dynamic quantization will be disabled.
+ */
+static constexpr Property<uint64_t, PropertyMutability::RW> dynamic_quantization_group_size_max{
+ "GPU_DYNAMIC_QUANTIZATION_GROUP_SIZE_MAX"};
+
} // namespace hint
/**
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 b940a6d2b6e..2c5a9b048d5 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
@@ -168,6 +168,7 @@ static constexpr Property<ShapePredictor::Settings, ov::PropertyMutability::RW>
static constexpr Property<std::vector<std::string>, ov::PropertyMutability::RW> load_dump_raw_binary{"GPU_LOAD_DUMP_RAW_BINARY"};
static constexpr Property<std::vector<std::string>, ov::PropertyMutability::RW> start_after_processes{"GPU_START_AFTER_PROCESSES"};
static constexpr Property<bool, ov::PropertyMutability::RW> could_use_flashattn_v2{"GPU_COULD_USE_FLASHATTN_V2"};
+static constexpr Property<uint64_t, PropertyMutability::RW> dynamic_quantization_group_size_max{"GPU_DYNAMIC_QUANTIZATION_GROUP_SIZE_MAX"};
} // namespace ov::intel_gpu
namespace cldnn {
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 5c255f87895..f634dfb6b2a 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/options.inl
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/options.inl
@@ -25,7 +25,8 @@ OV_CONFIG_RELEASE_OPTION(ov::internal, exclusive_async_requests, false, "")
OV_CONFIG_RELEASE_OPTION(ov::internal, query_model_ratio, 1.0f, "")
OV_CONFIG_RELEASE_OPTION(ov, cache_mode, ov::CacheMode::OPTIMIZE_SPEED, "Cache mode defines the trade-off between the model compilation time and the disk space required for the cache")
OV_CONFIG_RELEASE_OPTION(ov, cache_encryption_callbacks, ov::EncryptionCallbacks{}, "Callbacks used to encrypt/decrypt the model")
-OV_CONFIG_RELEASE_OPTION(ov::hint, dynamic_quantization_group_size, 0, "")
+OV_CONFIG_RELEASE_OPTION(ov::hint, dynamic_quantization_group_size, 0, "Dynamic quantization group size")
+OV_CONFIG_RELEASE_OPTION(ov::intel_gpu::hint, dynamic_quantization_group_size_max, UINT64_MAX, "Maximum dynamic quantization group size. When group_size is set as a higher value than this number, dynamic quantization will be turned off")
OV_CONFIG_RELEASE_OPTION(ov::hint, kv_cache_precision, ov::element::dynamic, "")
OV_CONFIG_RELEASE_OPTION(ov::intel_gpu::hint, enable_kernels_reuse, false, "")
OV_CONFIG_RELEASE_OPTION(ov, weights_path, "", "Path to the model weights file used for weightless caching")
diff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
index 4a1ec6a8d3c..3d8413b3076 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
@@ -1195,6 +1195,7 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {
if (device_info.supports_immad) {
bool asymmetric_dyn_quant = config.get_asym_dynamic_quantization();
auto dynamic_quantization_group_size = config.get_dynamic_quantization_group_size();
+ auto dynamic_quantization_group_size_max = config.get_dynamic_quantization_group_size_max();
pass_config->set_callback<ov::intel_gpu::DynamicQuantizeFullyConnected>([=](const_node_ptr& root) -> bool {
for (size_t i = 0 ; i < root->get_input_node_shared_ptr(0)->get_output_size(); ++i) {
if (root->get_input_node_shared_ptr(0)->get_output_element_type(i) == ov::element::Type_t::f32) {
@@ -1234,7 +1235,12 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {
return false;
});
- manager.register_pass<ov::intel_gpu::DynamicQuantizeFullyConnected>(dynamic_quantization_group_size, asymmetric_dyn_quant);
+ if (dynamic_quantization_group_size_max < dynamic_quantization_group_size) {
+ GPU_DEBUG_INFO << "dyn_quan is turned off because group_size is larger than max size "
+ << dynamic_quantization_group_size << "/" << dynamic_quantization_group_size_max << std::endl;
+ } else {
+ manager.register_pass<ov::intel_gpu::DynamicQuantizeFullyConnected>(dynamic_quantization_group_size, asymmetric_dyn_quant);
+ }
}
// Remove Pad in front of MaxPool if both the pads_begin and pads_end are zero.
diff --git a/src/plugins/intel_gpu/src/runtime/execution_config.cpp b/src/plugins/intel_gpu/src/runtime/execution_config.cpp
index 6d71501799a..c5bed5428d2 100644
--- a/src/plugins/intel_gpu/src/runtime/execution_config.cpp
+++ b/src/plugins/intel_gpu/src/runtime/execution_config.cpp
@@ -127,6 +127,7 @@ void ExecutionConfig::apply_rt_info(const IRemoteContext* context, const ov::RTM
}
apply_rt_info_property(ov::hint::dynamic_quantization_group_size, rt_info);
+ apply_rt_info_property(ov::intel_gpu::hint::dynamic_quantization_group_size_max, rt_info);
// WEIGHTS_PATH is used for the weightless cache mechanism which is used only with
// ov::CacheMode::OPTIMIZE_SIZE setting. Not setting WEIGHTS_PATH will result in not
diff --git a/src/plugins/intel_gpu/src/runtime/memory.cpp b/src/plugins/intel_gpu/src/runtime/memory.cpp
index 6f1ce319e14..f69a3124da7 100644
--- a/src/plugins/intel_gpu/src/runtime/memory.cpp
+++ b/src/plugins/intel_gpu/src/runtime/memory.cpp
@@ -24,7 +24,7 @@ MemoryTracker::MemoryTracker(engine* engine, void* buffer_ptr, size_t buffer_siz
, m_alloc_type(alloc_type) {
if (m_engine) {
m_engine->add_memory_used(m_buffer_size, m_alloc_type);
- GPU_DEBUG_LOG << "Allocate " << m_buffer_size << " bytes of " << m_alloc_type << " allocation type ptr = " << m_buffer_ptr
+ GPU_DEBUG_TRACE_DETAIL << "Allocate " << m_buffer_size << " bytes of " << m_alloc_type << " allocation type ptr = " << m_buffer_ptr
<< " (current=" << m_engine->get_used_device_memory(m_alloc_type) << ";"
<< " max=" << m_engine->get_max_used_device_memory(m_alloc_type) << ")" << std::endl;
}
@@ -35,7 +35,7 @@ MemoryTracker::~MemoryTracker() {
try {
m_engine->subtract_memory_used(m_buffer_size, m_alloc_type);
} catch (...) {}
- GPU_DEBUG_LOG << "Free " << m_buffer_size << " bytes of " << m_alloc_type << " allocation type ptr = " << m_buffer_ptr
+ GPU_DEBUG_TRACE_DETAIL << "Free " << m_buffer_size << " bytes of " << m_alloc_type << " allocation type ptr = " << m_buffer_ptr
<< " (current=" << m_engine->get_used_device_memory(m_alloc_type) << ";"
<< " max=" << m_engine->get_max_used_device_memory(m_alloc_type) << ")" << std::endl;
}