Skip to content

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

[GPU] Use the reorder input size for weightless constants (#40019)

Aleksandr Voron861cf4473d15
diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp
index bec4c16bea8..69c79d7fae5 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp
@@ -199,6 +199,10 @@ struct weightless_cache_manager {
ib >> *reorder_rep.input_layout;
reorder_rep.reorder = std::make_shared<reorder>();
ib >> *reorder_rep.reorder;
+ if (!do_precision_conversion) {
+ // External weights describe the reorder input, not its padded destination.
+ original_size = reorder_rep.input_layout->bytes_count();
+ }
}
OPENVINO_ASSERT(weights_memory != nullptr, "weights_memory is nullptr!!!");
diff --git a/src/plugins/intel_gpu/tests/functional/behavior/model_cache.cpp b/src/plugins/intel_gpu/tests/functional/behavior/model_cache.cpp
index d29d68e1b96..2b83d225be2 100644
--- a/src/plugins/intel_gpu/tests/functional/behavior/model_cache.cpp
+++ b/src/plugins/intel_gpu/tests/functional/behavior/model_cache.cpp
@@ -276,6 +276,25 @@ TEST_P(CheckWeightlessCacheAccuracy, TiWithLstmCell) {
OV_ASSERT_NO_THROW(run());
}
+TEST_P(CheckWeightlessCacheAccuracy, ConvWithPaddedWeightsReorder) {
+ // Channel counts not divisible by the blocked weights format pad the reorder destination beyond the source
+ // constant, and the constant is the last one in the BIN file.
+ auto param = std::make_shared<ov::op::v0::Parameter>(model_dtype, ov::Shape({1, 3, 8, 8}));
+ auto conv = ov::test::utils::make_convolution(param,
+ model_dtype,
+ {3, 3},
+ {1, 1},
+ {1, 1},
+ {1, 1},
+ {1, 1},
+ ov::op::PadType::EXPLICIT,
+ 5);
+ auto result = std::make_shared<ov::op::v0::Result>(conv);
+ model = std::make_shared<ov::Model>(ov::ResultVector{result}, ov::ParameterVector{param});
+ model->set_friendly_name("ConvWithPaddedWeightsReorder");
+ OV_ASSERT_NO_THROW(run());
+}
+
class CheckWeightlessCacheAccuracyLowPrecision : public CheckWeightlessCacheAccuracy {};
class CheckModelCacheOnednnConvAZP : public ::testing::Test {