Skip to content

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

[GPU] Add condition for FC grouped zp size exception (#30548)

Min, Byungil7e3b02ba0abe
diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/fully_connected_gpu_bf_tiled.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/fully_connected_gpu_bf_tiled.cl
index 68a156f4fb7..0941c8dec9a 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/fully_connected_gpu_bf_tiled.cl
+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/fully_connected_gpu_bf_tiled.cl
@@ -440,11 +440,11 @@ inline void FUNC(fc_bf_tiled_kernel_default)(
(offset_ifm / DECOMPRESSION_ZP_GROUP_SIZE) * DECOMPRESSION_ZP_FEATURE_PITCH;
ACCUMULATOR_TYPE dzp = decompression_zp[zp_offset];
#else
- #if OUTER_OFM > 1
- ACCUMULATOR_TYPE dzp = decompression_zp[offset_ofm];
- #else
- ACCUMULATOR_TYPE dzp = d_zps[fi % DECOMPRESSION_ZP_LENGTH];
- #endif
+ #if OUTER_OFM > 1
+ ACCUMULATOR_TYPE dzp = decompression_zp[offset_ofm];
+ #else
+ ACCUMULATOR_TYPE dzp = d_zps[fi % DECOMPRESSION_ZP_LENGTH];
+ #endif
#endif
#else
ACCUMULATOR_TYPE dzp = ACCUMULATOR_VAL_ZERO;
@@ -1195,8 +1195,10 @@ inline void FUNC(fc_bf_tiled_kernel_dyn_quan)(
#if COMPRESSED_WEIGHTS_INT8 && DECOMPRESSION_ZP_TERM && DECOMPRESSION_ZP_GROUPS_NUM > 1 && !DECOMPRESSION_ZP_SCALAR
unroll_for(uint fi = 0; fi < TILE_OFM; ++fi) {
- #if FILTER_LOAD_BLOCK_SIZE % DECOMPRESSION_ZP_GROUP_SIZE != 0
- #error "FC bf_tiled kernel: Not support DECOMPRESSION_ZP_GROUPS_NUM > 1"
+ #if FILTER_LOAD_BLOCK_SIZE > DECOMPRESSION_ZP_GROUP_SIZE && FILTER_LOAD_BLOCK_SIZE % DECOMPRESSION_ZP_GROUP_SIZE != 0
+ #error "FC bf_tiled kernel: Not support DECOMPRESSION_ZP_GROUPS_NUM > 1 with unaligned DECOMPRESSION_ZP_GROUP_SIZE"
+ #elif FILTER_LOAD_BLOCK_SIZE < DECOMPRESSION_ZP_GROUP_SIZE && DECOMPRESSION_ZP_GROUP_SIZE % FILTER_LOAD_BLOCK_SIZE != 0
+ #error "FC bf_tiled kernel: Not support DECOMPRESSION_ZP_GROUPS_NUM > 1 with unaligned FILTER_LOAD_BLOCK_SIZE"
#endif
const uint ni_offset = ni * TILE_IFM * SIMD + local_id * FILTER_LOAD_ITERS * FILTER_LOAD_BLOCK_SIZE;
diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/fully_connected_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/fully_connected_gpu_test.cpp
index 5782a3ffe93..b57a0294a78 100644
--- a/src/plugins/intel_gpu/tests/unit/test_cases/fully_connected_gpu_test.cpp
+++ b/src/plugins/intel_gpu/tests/unit/test_cases/fully_connected_gpu_test.cpp
@@ -3860,7 +3860,7 @@ void test_compressed_int4_scale_dynamic_batch_gemv(bool is_caching_test,
void test_compressed_int8_scale_dyn_quan_weight_u8(bool is_dynamic, int batch = 1, int ifm = 512, int ofm = 2048,
size_t quantize_group_size = 32, int scales_group_size = 128,
- bool is_wzp_test = false, bool is_wzp_scalar = false) {
+ bool is_wzp_test = false, bool is_wzp_scalar = false, int wzp_size = 1) {
tests::random_generator rg(GET_SUITE_NAME);
auto& engine = get_test_engine();
@@ -3877,7 +3877,7 @@ void test_compressed_int4_scale_dynamic_batch_gemv(bool is_caching_test,
auto weights_mem = engine.allocate_memory({ {ofm_num, ifm_num}, data_types::u8, format::bfyx });
auto scale_mem = engine.allocate_memory({ {ofm_num, ifm_num / scales_group_size}, data_types::f16, format::fbyx });
- auto dcomp_zp_mem = engine.allocate_memory({ {wzp_num, 1}, data_types::u8, format::bfyx });
+ auto dcomp_zp_mem = engine.allocate_memory({ {wzp_num, wzp_size}, data_types::u8, format::bfyx });
auto input_data = rg.generate_random_1d<ov::float16>(batch_num * ifm_num, -2.f, 2.f);
@@ -5346,6 +5346,9 @@ TEST_F(fully_connected_gpu_tests, dynamic_multi_inference_multiple_shapes_cached
this->test_dynamic_multi_inference_multiple_shapes(true);
}
+TEST_F(fully_connected_gpu_tests, compressed_int8_dynamic_quantize_grouped_wzp_test) {
+ this->test_compressed_int8_scale_dyn_quan_weight_u8(false, 320, 1024, 1024, 32, 32, true, false, 32);
+}
using fully_connected_dynamic_test_params = std::tuple<
std::vector<ov::Dimension::value_type>, // batch_sizes