[GPU] Fix U8 weights identification as a quantization case (#24488)

### Details:
- Fix the issue where `conv_params.quantization` was not correctly
identified as a quantization case when using U8 weights data (which is
allowed by ConvertConvolutionToInternal transformation pass)

### Tickets:
 - 139740
This commit is contained in:
Sergey Shlyapnikov 2024-05-21 16:10:27 +04:00 committed by GitHub
parent 24137ffdfc
commit 248c841e85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 56 additions and 1 deletions

View File

@ -137,7 +137,8 @@ public:
if ((impl_param.input_layouts[0].data_type == data_types::u8 ||
impl_param.input_layouts[0].data_type == data_types::i8) &&
impl_param.input_layouts[1].data_type == data_types::i8) {
(impl_param.input_layouts[1].data_type == data_types::i8 ||
impl_param.input_layouts[1].data_type == data_types::u8)) {
if (!primitive->weights_zero_points.empty() && !primitive->activations_zero_points.empty()) {
conv_params.quantization = kernel_selector::QuantizationType::ASYMMETRIC_DATA_AND_WEIGHTS;
} else if (!primitive->weights_zero_points.empty()) {

View File

@ -76,6 +76,60 @@ const std::vector<LayerTestsDefinitions::ConvolutionQDqTransformationParam> para
ov::element::u8.get_type_name()
},
// Actual:
//
// Constant
// | Constant Constant Constant Constant
// | /FP32 /FP32 /FP32 /FP32
// FakeQuantize FakeQuantize
// |FP32 |FP32
// | |
// Convert Constant Convert
// |U8 |U8 |U8
// | | |
// Convert Convert Convert Constant
// \FP32 /FP32 |FP32 /U8
// \ / | /
// Subtract Constant Subtract Constant
// \FP32 /FP32 |FP32 /FP32
// \ / | /
// Multiply Multiply
// \FP32 /FP32
// \ /
// Convolution
//
// Transformed:
//
// Parameter Constant Constant
// \U8 /U8 /U8
// \ / /
// Subtract Subtract
// \FP32 /FP32
// \ /
// Convolution Constant
// \FP32 /FP32
// \ /
// Multiply
{
{ 256ul, {{ 1, 1, 1, 1 }}, { -12.8f }, { 12.7f }, { 0.f }, { 255.f }, ov::element::f32 },
{ ov::element::u8, false },
{
{ov::element::f32},
{ {128.f}, ov::element::f32, {}, false, 1ul, ov::element::u8, true },
{ {0.1f}, ov::element::f32, {}, false }
},
{ std::vector<float>{ 15.f }, ov::element::f32},
{ 256ul, ov::Shape({ 1, 1, 1, 1 }), { 0.f }, { 25.5f }, { 0.f }, { 255.f }, ov::element::f32 },
{ ov::element::u8, false },
{
{ ov::element::f32, false },
{ {0.3f}, ov::element::f32, {}, false, 1ul, ov::element::u8, true },
{ {0.2f}, ov::element::f32, {}, false }
},
"Convolution",
ov::element::u8.get_type_name()
},
// Actual:
//
// Constant