OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[GPU] BF16 OCL: gather kernel support (#37116)
Kamil Wieloch24e76769a78c
diff --git a/src/plugins/intel_gpu/src/graph/impls/cpu/gather.cpp b/src/plugins/intel_gpu/src/graph/impls/cpu/gather.cppindex fb9b71b6653..d7817514439 100644--- a/src/plugins/intel_gpu/src/graph/impls/cpu/gather.cpp+++ b/src/plugins/intel_gpu/src/graph/impls/cpu/gather.cpp@@ -128,6 +128,7 @@ attach_gather_impl::attach_gather_impl() {auto types = {data_types::f32,data_types::f16,+ data_types::bf16,data_types::i32,data_types::i64,data_types::i8,diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/gather.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/gather.cppindex 254fff3250c..01b988ebf39 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl/gather.cpp+++ b/src/plugins/intel_gpu/src/graph/impls/ocl/gather.cpp@@ -206,6 +206,7 @@ attach_gather_impl::attach_gather_impl() {auto dyn_types = {data_types::f32,data_types::f16,+ data_types::bf16,data_types::i8,data_types::u8,data_types::i4,@@ -228,24 +229,28 @@ attach_gather_impl::attach_gather_impl() {implementation_map<gather>::add(impl_types::ocl, shape_types::static_shape, typed_primitive_impl_ocl<gather>::create<gather_impl>, {std::make_tuple(data_types::f32, format::fyxb),std::make_tuple(data_types::f16, format::fyxb),+ std::make_tuple(data_types::bf16, format::fyxb),std::make_tuple(data_types::i32, format::fyxb),std::make_tuple(data_types::i8, format::fyxb),std::make_tuple(data_types::u8, format::fyxb),std::make_tuple(data_types::f32, format::yxfb),std::make_tuple(data_types::f16, format::yxfb),+ std::make_tuple(data_types::bf16, format::yxfb),std::make_tuple(data_types::i32, format::yxfb),std::make_tuple(data_types::i8, format::yxfb),std::make_tuple(data_types::u8, format::yxfb),std::make_tuple(data_types::f32, format::byxf),std::make_tuple(data_types::f16, format::byxf),+ std::make_tuple(data_types::bf16, format::byxf),std::make_tuple(data_types::i32, format::byxf),std::make_tuple(data_types::i8, format::byxf),std::make_tuple(data_types::u8, format::byxf),std::make_tuple(data_types::f32, format::bfyx),std::make_tuple(data_types::f16, format::bfyx),+ std::make_tuple(data_types::bf16, format::bfyx),std::make_tuple(data_types::i32, format::bfyx),std::make_tuple(data_types::i8, format::bfyx),std::make_tuple(data_types::u8, format::bfyx),@@ -254,90 +259,105 @@ attach_gather_impl::attach_gather_impl() {std::make_tuple(data_types::f32, format::bfzyx),std::make_tuple(data_types::f16, format::bfzyx),+ std::make_tuple(data_types::bf16, format::bfzyx),std::make_tuple(data_types::i32, format::bfzyx),std::make_tuple(data_types::i8, format::bfzyx),std::make_tuple(data_types::u8, format::bfzyx),std::make_tuple(data_types::f32, format::bfwzyx),std::make_tuple(data_types::f16, format::bfwzyx),+ std::make_tuple(data_types::bf16, format::bfwzyx),std::make_tuple(data_types::i32, format::bfwzyx),std::make_tuple(data_types::i8, format::bfwzyx),std::make_tuple(data_types::u8, format::bfwzyx),std::make_tuple(data_types::f32, format::b_fs_yx_fsv4),std::make_tuple(data_types::f16, format::b_fs_yx_fsv4),+ std::make_tuple(data_types::bf16, format::b_fs_yx_fsv4),std::make_tuple(data_types::i32, format::b_fs_yx_fsv4),std::make_tuple(data_types::i8, format::b_fs_yx_fsv4),std::make_tuple(data_types::u8, format::b_fs_yx_fsv4),std::make_tuple(data_types::f32, format::b_fs_yx_fsv16),std::make_tuple(data_types::f16, format::b_fs_yx_fsv16),+ std::make_tuple(data_types::bf16, format::b_fs_yx_fsv16),std::make_tuple(data_types::i32, format::b_fs_yx_fsv16),std::make_tuple(data_types::i8, format::b_fs_yx_fsv16),std::make_tuple(data_types::u8, format::b_fs_yx_fsv16),std::make_tuple(data_types::f32, format::b_fs_yx_fsv32),std::make_tuple(data_types::f16, format::b_fs_yx_fsv32),+ std::make_tuple(data_types::bf16, format::b_fs_yx_fsv32),std::make_tuple(data_types::i32, format::b_fs_yx_fsv32),std::make_tuple(data_types::i8, format::b_fs_yx_fsv32),std::make_tuple(data_types::u8, format::b_fs_yx_fsv32),std::make_tuple(data_types::f32, format::b_fs_zyx_fsv16),std::make_tuple(data_types::f16, format::b_fs_zyx_fsv16),+ std::make_tuple(data_types::bf16, format::b_fs_zyx_fsv16),std::make_tuple(data_types::i32, format::b_fs_zyx_fsv16),std::make_tuple(data_types::i8, format::b_fs_zyx_fsv16),std::make_tuple(data_types::u8, format::b_fs_zyx_fsv16),std::make_tuple(data_types::f32, format::b_fs_zyx_fsv32),std::make_tuple(data_types::f16, format::b_fs_zyx_fsv32),+ std::make_tuple(data_types::bf16, format::b_fs_zyx_fsv32),std::make_tuple(data_types::i32, format::b_fs_zyx_fsv32),std::make_tuple(data_types::i8, format::b_fs_zyx_fsv32),std::make_tuple(data_types::u8, format::b_fs_zyx_fsv32),std::make_tuple(data_types::f32, format::bs_fs_yx_bsv4_fsv2),std::make_tuple(data_types::f16, format::bs_fs_yx_bsv4_fsv2),+ std::make_tuple(data_types::bf16, format::bs_fs_yx_bsv4_fsv2),std::make_tuple(data_types::i32, format::bs_fs_yx_bsv4_fsv2),std::make_tuple(data_types::i8, format::bs_fs_yx_bsv4_fsv2),std::make_tuple(data_types::u8, format::bs_fs_yx_bsv4_fsv2),std::make_tuple(data_types::f32, format::bs_fs_yx_bsv4_fsv4),std::make_tuple(data_types::f16, format::bs_fs_yx_bsv4_fsv4),+ std::make_tuple(data_types::bf16, format::bs_fs_yx_bsv4_fsv4),std::make_tuple(data_types::i32, format::bs_fs_yx_bsv4_fsv4),std::make_tuple(data_types::i8, format::bs_fs_yx_bsv4_fsv4),std::make_tuple(data_types::u8, format::bs_fs_yx_bsv4_fsv4),std::make_tuple(data_types::f32, format::bs_fs_yx_bsv8_fsv2),std::make_tuple(data_types::f16, format::bs_fs_yx_bsv8_fsv2),+ std::make_tuple(data_types::bf16, format::bs_fs_yx_bsv8_fsv2),std::make_tuple(data_types::i32, format::bs_fs_yx_bsv8_fsv2),std::make_tuple(data_types::i8, format::bs_fs_yx_bsv8_fsv2),std::make_tuple(data_types::u8, format::bs_fs_yx_bsv8_fsv2),std::make_tuple(data_types::f32, format::bs_fs_yx_bsv8_fsv4),std::make_tuple(data_types::f16, format::bs_fs_yx_bsv8_fsv4),+ std::make_tuple(data_types::bf16, format::bs_fs_yx_bsv8_fsv4),std::make_tuple(data_types::i32, format::bs_fs_yx_bsv8_fsv4),std::make_tuple(data_types::i8, format::bs_fs_yx_bsv8_fsv4),std::make_tuple(data_types::u8, format::bs_fs_yx_bsv8_fsv4),std::make_tuple(data_types::f32, format::bs_fs_yx_bsv16_fsv16),std::make_tuple(data_types::f16, format::bs_fs_yx_bsv16_fsv16),+ std::make_tuple(data_types::bf16, format::bs_fs_yx_bsv16_fsv16),std::make_tuple(data_types::i32, format::bs_fs_yx_bsv16_fsv16),std::make_tuple(data_types::i8, format::bs_fs_yx_bsv16_fsv16),std::make_tuple(data_types::u8, format::bs_fs_yx_bsv16_fsv16),std::make_tuple(data_types::f32, format::bs_fs_yx_bsv32_fsv16),std::make_tuple(data_types::f16, format::bs_fs_yx_bsv32_fsv16),+ std::make_tuple(data_types::bf16, format::bs_fs_yx_bsv32_fsv16),std::make_tuple(data_types::i32, format::bs_fs_yx_bsv32_fsv16),std::make_tuple(data_types::i8, format::bs_fs_yx_bsv32_fsv16),std::make_tuple(data_types::u8, format::bs_fs_yx_bsv32_fsv16),std::make_tuple(data_types::f32, format::bs_fs_yx_bsv32_fsv32),std::make_tuple(data_types::f16, format::bs_fs_yx_bsv32_fsv32),+ std::make_tuple(data_types::bf16, format::bs_fs_yx_bsv32_fsv32),std::make_tuple(data_types::i32, format::bs_fs_yx_bsv32_fsv32),std::make_tuple(data_types::i8, format::bs_fs_yx_bsv32_fsv32),std::make_tuple(data_types::u8, format::bs_fs_yx_bsv32_fsv32),std::make_tuple(data_types::f32, format::fs_b_yx_fsv32),std::make_tuple(data_types::f16, format::fs_b_yx_fsv32),+ std::make_tuple(data_types::bf16, format::fs_b_yx_fsv32),std::make_tuple(data_types::i32, format::fs_b_yx_fsv32),std::make_tuple(data_types::i8, format::fs_b_yx_fsv32),std::make_tuple(data_types::u8, format::fs_b_yx_fsv32),diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/gather_ref.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/gather_ref.clindex e72a126884b..b523246983c 100644--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/gather_ref.cl+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/gather_ref.cl@@ -62,7 +62,7 @@ KERNEL(gather_ref)(const uint output_idx = GET_INDEX(OUTPUT,,ORDER);#if COMPRESSED_WEIGHTS- OUTPUT_TYPE val = OUTPUT_VAL_ZERO;+ OUTPUT_COMPUTE_TYPE val_compute = OUTPUT_VAL_ZERO;#if GATHER_AXIS_SHAPE_INFO_INDEXbool need_decompress = (INPUT_AXIS_INDEX >= 0 && INPUT_AXIS_INDEX < shape_info[GATHER_AXIS_SHAPE_INFO_INDEX]) ? true : false;@@ -75,43 +75,47 @@ KERNEL(gather_ref)(if (need_decompress) {#if DECOMPRESSION_ZP_TERM#if DECOMPRESSION_ZP_SCALAR- OUTPUT_TYPE zp = DECOMPRESSION_ZP_VALUE;+ OUTPUT_COMPUTE_TYPE zp = DECOMPRESSION_ZP_VALUE;#elseconst uint zp_offset = dictionary_idx / DECOMPRESSION_ZP_GROUP_SIZE;- OUTPUT_TYPE zp = TO_OUTPUT_TYPE(decompression_zp[zp_offset]);+ OUTPUT_COMPUTE_TYPE zp = TO_OUTPUT_COMPUTE_TYPE(DECODE_DECOMPRESSION_ZP_COMPUTE_TYPE(decompression_zp[zp_offset]));#endif#else- OUTPUT_TYPE zp = OUTPUT_VAL_ZERO;+ OUTPUT_COMPUTE_TYPE zp = OUTPUT_VAL_ZERO;#endifconst uint decomp_offset = dictionary_idx / DECOMPRESSION_SCALE_GROUP_SIZE;- DECOMPRESSION_SCALE_TYPE scale = decompression_scale[decomp_offset];+ DECOMPRESSION_SCALE_COMPUTE_TYPE scale = DECODE_DECOMPRESSION_SCALE_COMPUTE_TYPE(decompression_scale[decomp_offset]);#if COMPRESSED_WEIGHTS_INT8- OUTPUT_TYPE val_compressed = dictionary[dictionary_idx];- val = (val_compressed - zp) * scale;+ OUTPUT_COMPUTE_TYPE val_compressed = dictionary[dictionary_idx];+ val_compute = (val_compressed - zp) * scale;#elif COMPRESSED_WEIGHTS_INT4INPUT0_TYPE val_packed = dictionary[dictionary_idx / 2];- MAKE_VECTOR_TYPE(OUTPUT_TYPE, 2) val_unpacked = UNPACK_INT4x2(OUTPUT_TYPE, *((INT4_PACKED_TYPE*)&val_packed));+ MAKE_VECTOR_TYPE(OUTPUT_COMPUTE_TYPE, 2) val_unpacked = UNPACK_INT4x2(OUTPUT_COMPUTE_TYPE, *((INT4_PACKED_TYPE*)&val_packed));- OUTPUT_TYPE val_compressed = ((OUTPUT_TYPE*)(&val_unpacked))[dictionary_idx % 2];- val = (val_compressed - zp) * scale;+ OUTPUT_COMPUTE_TYPE val_compressed = ((OUTPUT_COMPUTE_TYPE*)(&val_unpacked))[dictionary_idx % 2];+ val_compute = (val_compressed - zp) * scale;#endif}+ // Variable val for fused ops+ OUTPUT_TYPE val = TO_OUTPUT_TYPE(val_compute);#else#if GATHER_AXIS_SHAPE_INFO_INDEX- INPUT0_TYPE val = (INPUT_AXIS_INDEX >= 0 && INPUT_AXIS_INDEX < shape_info[GATHER_AXIS_SHAPE_INFO_INDEX]) ? dictionary[dictionary_idx] : 0;+ INPUT0_COMPUTE_TYPE val_compute = (INPUT_AXIS_INDEX >= 0 && INPUT_AXIS_INDEX < shape_info[GATHER_AXIS_SHAPE_INFO_INDEX]) ? DECODE_INPUT0_COMPUTE_TYPE(dictionary[dictionary_idx]) : 0;#elif AXIS_DIM- INPUT0_TYPE val = (INPUT_AXIS_INDEX >= 0 && INPUT_AXIS_INDEX < AXIS_DIM) ? dictionary[dictionary_idx] : 0;+ INPUT0_COMPUTE_TYPE val_compute = (INPUT_AXIS_INDEX >= 0 && INPUT_AXIS_INDEX < AXIS_DIM) ? DECODE_INPUT0_COMPUTE_TYPE(dictionary[dictionary_idx]) : 0;#else- INPUT0_TYPE val = dictionary[dictionary_idx];+ INPUT0_COMPUTE_TYPE val_compute = DECODE_INPUT0_COMPUTE_TYPE(dictionary[dictionary_idx]);#endif+ // Variable val for fused ops+ INPUT0_TYPE val = TO_INPUT0_TYPE(val_compute);#endif#if HAS_FUSED_OPSFUSED_OPS;- output[output_idx] = TO_OUTPUT_TYPE(FUSED_OPS_RESULT);+ output[output_idx] = FUSED_OPS_RESULT;#else- output[output_idx] = ACTIVATION(val, ACTIVATION_PARAMS);+ output[output_idx] = TO_OUTPUT_TYPE(ACTIVATION(val_compute, ACTIVATION_PARAMS));#endif}diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cppindex a4c2829c7d9..b2ea84564e6 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cpp@@ -36,6 +36,7 @@ static size_t GetGatherChannelIndex(const gather_params& params) {ParamsKey GatherKernelRef::GetSupportedKey() const {ParamsKey k;k.EnableInputDataType(Datatype::F16);+ k.EnableInputDataType(Datatype::BF16);k.EnableInputDataType(Datatype::F32);k.EnableInputDataType(Datatype::INT32);k.EnableInputDataType(Datatype::UINT8);@@ -44,6 +45,7 @@ ParamsKey GatherKernelRef::GetSupportedKey() const {k.EnableInputDataType(Datatype::INT4);k.EnableOutputDataType(Datatype::F16);+ k.EnableOutputDataType(Datatype::BF16);k.EnableOutputDataType(Datatype::F32);k.EnableOutputDataType(Datatype::INT32);k.EnableOutputDataType(Datatype::INT8);@@ -269,7 +271,7 @@ JitConstants GatherKernelRef::GetJitConstants(const gather_params& params) constif (!params.fused_ops.empty()) {std::vector<std::string> idx_order;idx_order = GetOrder(params.outputs[0].GetDims().size());- FusedOpsConfiguration conf = { "", idx_order, "val", params.inputs[0].GetDType() };+ FusedOpsConfiguration conf = { "", idx_order, "val", params.compressed ? params.outputs[0].GetDType() : params.inputs[0].GetDType() };jit.Merge(MakeFusedOpsJitConstants(params, {conf}));}diff --git a/src/plugins/intel_gpu/tests/unit/fusions/gather_fusion_test.cpp b/src/plugins/intel_gpu/tests/unit/fusions/gather_fusion_test.cppindex e11d0eeabfd..36759213c61 100644--- a/src/plugins/intel_gpu/tests/unit/fusions/gather_fusion_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/fusions/gather_fusion_test.cpp@@ -107,6 +107,14 @@ public:#define CASE_GATHER_FP16_6 { 3, 2, 2 }, { 2, 3 }, { 2, 3, 2, 2 }, 0, data_types::f16, format::bfyx, data_types::f16, format::bfyx#define CASE_GATHER_FP16_7 { 2, 5, 2, 4 }, { 3, 2, 1}, { 2, 3, 2, 1, 2, 4 }, 1, data_types::f16, format::bfyx, data_types::f16, format::bfyx+#define CASE_GATHER_BF16_1 { 2, 3, 4, 1 }, { 4, 1, 1, 1 }, { 4, 3, 4, 1 }, 0, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx+#define CASE_GATHER_BF16_2 { 3, 2, 2, 1 }, { 2, 3, 1, 1 }, { 2, 3, 2, 2 }, 0, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx+#define CASE_GATHER_BF16_3 { 3, 1, 2, 1 }, { 2, 1, 1, 1 }, { 3, 2, 2, 1 }, 1, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx+#define CASE_GATHER_BF16_4 { 5, 2, 2, 2 }, { 3, 1, 1, 1 }, { 5, 2, 3, 2 }, 2, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx+#define CASE_GATHER_BF16_5 { 2, 3, 2, 1 }, { 3, 1, 1, 1 }, { 2, 3, 3, 1 }, 2, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx+#define CASE_GATHER_BF16_6 { 3, 2, 2 }, { 2, 3 }, { 2, 3, 2, 2 }, 0, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx+#define CASE_GATHER_BF16_7 { 2, 5, 2, 4 }, { 3, 2, 1}, { 2, 3, 2, 1, 2, 4 }, 1, data_types::bf16, format::bfyx, data_types::bf16, format::bfyx+#define CASE_GATHER_5D_FP32_1 { 2, 3, 1, 4, 1 }, { 4, 1, 1, 1 }, { 4, 3, 1, 4, 1 }, 0, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx#define CASE_GATHER_5D_FP32_2 { 2, 3, 2, 2, 2 }, { 2, 1, 1, 1 }, { 2, 2, 2, 2, 2 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx#define CASE_GATHER_5D_FP32_3 { 5, 3, 2, 2, 2 }, { 3, 1, 1, 1 }, { 5, 3, 2, 3, 2 }, 3, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx@@ -119,18 +127,35 @@ public:#define CASE_GATHER_5D_FP16_4 { 3, 2, 2, 2, 2 }, { 2, 3, 1, 1 }, { 3, 2, 2, 3, 2 }, 2, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx#define CASE_GATHER_5D_FP16_5 { 1, 1, 2, 1, 1 }, { 3, 1, 1, 1 }, { 1, 1, 1, 1, 3 }, 4, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx+#define CASE_GATHER_5D_BF16_1 { 3, 2, 1, 2, 1 }, { 2, 1, 1, 1 }, { 2, 2, 1, 2, 1 }, 0, data_types::bf16, format::bfzyx, data_types::bf16, format::bfzyx+#define CASE_GATHER_5D_BF16_2 { 1, 3, 1, 2, 1 }, { 2, 1, 1, 1 }, { 1, 2, 1, 2, 1 }, 1, data_types::bf16, format::bfzyx, data_types::bf16, format::bfzyx+#define CASE_GATHER_5D_BF16_3 { 2, 3, 3, 3, 1 }, { 1, 2, 1, 1 }, { 2, 3, 3, 1, 2 }, 3, data_types::bf16, format::bfzyx, data_types::bf16, format::bfzyx+#define CASE_GATHER_5D_BF16_4 { 3, 2, 2, 2, 2 }, { 2, 3, 1, 1 }, { 3, 2, 2, 3, 2 }, 2, data_types::bf16, format::bfzyx, data_types::bf16, format::bfzyx+#define CASE_GATHER_5D_BF16_5 { 1, 1, 2, 1, 1 }, { 3, 1, 1, 1 }, { 1, 1, 1, 1, 3 }, 4, data_types::bf16, format::bfzyx, data_types::bf16, format::bfzyx+#define CASE_GATHER_INT8_1 { 2, 3, 4, 1 }, { 4 }, { 4, 3, 4, 1 }, 0, data_types::i8, format::bfyx, data_types::f32, format::bfyxclass gather_quantize : public GatherPrimitiveFusingTest {};TEST_P(gather_quantize, basic) {auto p = GetParam();+ auto in_lo_layout = get_per_channel_layout(p);+ auto in_hi_layout = get_per_channel_layout(p);+ auto out_lo_layout = get_single_element_layout(p);+ auto out_hi_layout = get_single_element_layout(p);+ // quantize range params must be f32/f16 (prepare_quantization limitation)+ if (p.default_type == data_types::bf16) {+ in_lo_layout.data_type = data_types::f32;+ in_hi_layout.data_type = data_types::f32;+ out_lo_layout.data_type = data_types::f32;+ out_hi_layout.data_type = data_types::f32;+ }create_topologies(input_layout("input", get_input_layout(p)),data("gather_indices", get_mem(get_indices_layout(p), 0, static_cast<int>(get_axis_dim(p) - 1))),- data("in_lo", get_mem(get_per_channel_layout(p), min_random, 0)),- data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)),- data("out_lo", get_mem(get_single_element_layout(p), -127)),- data("out_hi", get_mem(get_single_element_layout(p), 127)),+ data("in_lo", get_mem(in_lo_layout, min_random, 0)),+ data("in_hi", get_mem(in_hi_layout, 1, max_random)),+ data("out_lo", get_mem(out_lo_layout, -127)),+ data("out_hi", get_mem(out_hi_layout, 127)),gather("gather_prim", input_info("input"), input_info("gather_indices"), p.axis, p.dictionary_shape.size(), p.out_shape),quantize("quantize", input_info("gather_prim"), input_info("in_lo"), input_info("in_hi"),input_info("out_lo"), input_info("out_hi"), 255, data_types::i8),@@ -165,6 +190,18 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_quantize, ::testing::ValuesIn(std::gather_test_params{ CASE_GATHER_5D_FP16_3, 2, 3 },gather_test_params{ CASE_GATHER_5D_FP16_4, 2, 3 },gather_test_params{ CASE_GATHER_5D_FP16_5, 2, 3 },++ gather_test_params{ CASE_GATHER_BF16_1, 2, 3 },+ gather_test_params{ CASE_GATHER_BF16_2, 2, 3 },+ gather_test_params{ CASE_GATHER_BF16_3, 2, 3 },+ gather_test_params{ CASE_GATHER_BF16_4, 2, 3 },+ gather_test_params{ CASE_GATHER_BF16_5, 2, 3 },++ gather_test_params{ CASE_GATHER_5D_BF16_1, 2, 3 },+ gather_test_params{ CASE_GATHER_5D_BF16_2, 2, 3 },+ gather_test_params{ CASE_GATHER_5D_BF16_3, 2, 3 },+ gather_test_params{ CASE_GATHER_5D_BF16_4, 2, 3 },+ gather_test_params{ CASE_GATHER_5D_BF16_5, 2, 3 },}));class gather_eltwise_activation : public GatherPrimitiveFusingTest {};@@ -208,6 +245,18 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_eltwise_activation, ::testing::Valugather_test_params{ CASE_GATHER_5D_FP16_3, 2, 4 },gather_test_params{ CASE_GATHER_5D_FP16_4, 2, 4 },gather_test_params{ CASE_GATHER_5D_FP16_5, 2, 4 },++ gather_test_params{ CASE_GATHER_BF16_1, 2, 4 },+ gather_test_params{ CASE_GATHER_BF16_2, 2, 4 },+ gather_test_params{ CASE_GATHER_BF16_3, 2, 4 },+ gather_test_params{ CASE_GATHER_BF16_4, 2, 4 },+ gather_test_params{ CASE_GATHER_BF16_5, 2, 4 },++ gather_test_params{ CASE_GATHER_5D_BF16_1, 2, 4 },+ gather_test_params{ CASE_GATHER_5D_BF16_2, 2, 4 },+ gather_test_params{ CASE_GATHER_5D_BF16_3, 2, 4 },+ gather_test_params{ CASE_GATHER_5D_BF16_4, 2, 4 },+ gather_test_params{ CASE_GATHER_5D_BF16_5, 2, 4 },}));class gather_eltwise_activation_dynamic : public GatherPrimitiveFusingTest {};@@ -235,11 +284,15 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_eltwise_activation_dynamic, ::testigather_test_params{ CASE_GATHER_FP32_6, 4, 6 },gather_test_params{ CASE_GATHER_FP16_6, 4, 7 },gather_test_params{ CASE_GATHER_FP16_7, 5, 8 },+ gather_test_params{ CASE_GATHER_BF16_6, 4, 7 },+ gather_test_params{ CASE_GATHER_BF16_7, 5, 8 },gather_test_params{ CASE_GATHER_INT8_1, 4, 7 },}));#define CASE_GATHER_RANK_DECREASE_FP16 { 1, 2, 4, 4, 8 }, { }, { 1, 4, 4, 8 }, 1, data_types::f16, format::bfzyx, data_types::f16, format::bfyx#define CASE_GATHER_RANK_INCREASE_FP16 { 2, 5, 2, 4 }, { 3, 2, 1 }, { 2, 3, 2, 1, 2, 4 }, 1, data_types::f16, format::bfyx, data_types::f16, format::bfyx+#define CASE_GATHER_RANK_DECREASE_BF16 { 1, 2, 4, 4, 8 }, { }, { 1, 4, 4, 8 }, 1, data_types::bf16, format::bfzyx, data_types::bf16, format::bfyx+#define CASE_GATHER_RANK_INCREASE_BF16 { 2, 5, 2, 4 }, { 3, 2, 1 }, { 2, 3, 2, 1, 2, 4 }, 1, data_types::bf16, format::bfyx, data_types::bf16, format::bfyxclass gather_rank_change_fusing : public GatherPrimitiveFusingTest {public:@@ -307,14 +360,19 @@ public:auto dyn_indices = layout{ov::PartialShape::dynamic(p.indices_shape.size()), p.data_type, format::bfyx};auto in_range_layout = use_per_tensor ? get_single_element_layout(p) : get_per_channel_layout(p);+ auto out_range_layout = get_single_element_layout(p);+ if (p.default_type == data_types::bf16) {+ in_range_layout.data_type = data_types::f32;+ out_range_layout.data_type = data_types::f32;+ }create_topologies(input_layout("input", dyn_input),input_layout("gather_indices", dyn_indices),data("in_lo", get_mem(in_range_layout, min_random, 0)),data("in_hi", get_mem(in_range_layout, 1, max_random)),- data("out_lo", get_mem(get_single_element_layout(p), -127)),- data("out_hi", get_mem(get_single_element_layout(p), 127)),+ data("out_lo", get_mem(out_range_layout, -127)),+ data("out_hi", get_mem(out_range_layout, 127)),gather("gather_prim", input_info("input"), input_info("gather_indices"),p.axis, p.dictionary_shape.size(), p.out_shape),quantize("quant", input_info("gather_prim"), input_info("in_lo"), input_info("in_hi"),@@ -373,4 +431,6 @@ TEST_P(gather_rank_change_fusing, quantize_per_tensor) {INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_rank_change_fusing, ::testing::ValuesIn(std::vector<gather_test_params>{gather_test_params{ CASE_GATHER_RANK_DECREASE_FP16, 2, 3 },gather_test_params{ CASE_GATHER_RANK_INCREASE_FP16, 2, 3 },+ gather_test_params{ CASE_GATHER_RANK_DECREASE_BF16, 2, 3 },+ gather_test_params{ CASE_GATHER_RANK_INCREASE_BF16, 2, 3 },}));diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/gather_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/gather_gpu_test.cppindex e796b68cdfc..0ef5d5e54dc 100644--- a/src/plugins/intel_gpu/tests/unit/test_cases/gather_gpu_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/test_cases/gather_gpu_test.cpp@@ -16,6 +16,10 @@using namespace cldnn;using namespace ::tests;+template<typename T> struct gather_test_type_traits;+template<> struct gather_test_type_traits<ov::float16> { static constexpr data_types dt = data_types::f16; };+template<> struct gather_test_type_traits<ov::bfloat16> { static constexpr data_types dt = data_types::bf16; };+template <class T>int get_not_one_dim(const T& a) {int ret = static_cast<int>(a.size());@@ -121,9 +125,11 @@ public:}};using gather8_test_f16i32 = gather8_test<ov::float16, int, data_types::f16, data_types::i32>;+using gather8_test_bf16i32 = gather8_test<ov::bfloat16, int, data_types::bf16, data_types::i32>;using gather8_test_f32i8 = gather8_test<float, char, data_types::f32, data_types::i8>;using gather8_test_i32i32 = gather8_test<int, int, data_types::i32, data_types::i32>;TEST_P(gather8_test_f16i32, gather8_test_f16i32) {}+TEST_P(gather8_test_bf16i32, gather8_test_bf16i32) {}TEST_P(gather8_test_f32i8, gather8_test_f32i8) {}TEST_P(gather8_test_i32i32, gather8_test_i32i32) {}@@ -137,6 +143,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_bd0_d4_i1,testing::Values(std::vector<int>{5, 44, 7, 8}),testing::Values(std::vector<int>{4, 1, 1, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_bd0_d4_i1_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0), // bdim in [0,get_not_one_dim(dict))+ testing::Values(0), // axis in [batch_dim,get_not_one_dim(dict))+ testing::Values(format::type::bfyx),+ testing::Values(format::type::bfyx),+ testing::Values(std::vector<int>{5, 44, 7, 8}),+ testing::Values(std::vector<int>{4, 1, 1, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_bd0_d2_i2,gather8_test_f16i32,testing::Combine(testing::Values(0),@@ -146,6 +161,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_bd0_d2_i2,testing::Values(std::vector<int>{8, 67, 1, 1}),testing::Values(std::vector<int>{4, 56, 1, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_bd0_d2_i2_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0),+ testing::Values(1),+ testing::Values(format::type::b_fs_yx_fsv4),+ testing::Values(format::type::b_fs_yx_fsv16),+ testing::Values(std::vector<int>{8, 67, 1, 1}),+ testing::Values(std::vector<int>{4, 56, 1, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32,gather8_test_f16i32,testing::Combine(testing::Values(0),@@ -155,6 +179,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32,testing::Values(std::vector<int>{3, 77, 4, 1}),testing::Values(std::vector<int>{2, 66, 1, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0),+ testing::Values(0, 1, 2),+ testing::Values(format::type::fs_b_yx_fsv32),+ testing::Values(format::type::fs_b_yx_fsv32),+ testing::Values(std::vector<int>{3, 77, 4, 1}),+ testing::Values(std::vector<int>{2, 66, 1, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32_bd1,gather8_test_f16i32,testing::Combine(testing::Values(1),@@ -164,6 +197,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32_bd1,testing::Values(std::vector<int>{3, 77, 44, 1}),testing::Values(std::vector<int>{3, 66, 55, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32_bd1_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(1),+ testing::Values(1, 2),+ testing::Values(format::type::fs_b_yx_fsv32),+ testing::Values(format::type::fs_b_yx_fsv32),+ testing::Values(std::vector<int>{3, 77, 44, 1}),+ testing::Values(std::vector<int>{3, 66, 55, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32_bd2,gather8_test_f16i32,testing::Combine(testing::Values(2),@@ -173,6 +215,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32_bd2,testing::Values(std::vector<int>{3, 4, 44, 6}),testing::Values(std::vector<int>{3, 4, 5, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_fs_b_yx_fsv32_bd2_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(2),+ testing::Values(2, 3),+ testing::Values(format::type::fs_b_yx_fsv32),+ testing::Values(format::type::fs_b_yx_fsv32),+ testing::Values(std::vector<int>{3, 4, 44, 6}),+ testing::Values(std::vector<int>{3, 4, 5, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_bs_fs_yx_bsv16_fsv16_bd0_dim4_to_dim5,gather8_test_f16i32,testing::Combine(testing::Values(0),@@ -182,6 +233,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_bs_fs_yx_bsv16_fsv16_bd0_dim4_to_dim5,testing::Values(std::vector<int>{3, 77, 44, 1}),testing::Values(std::vector<int>{3, 66, 55, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_bs_fs_yx_bsv16_fsv16_bd0_dim4_to_dim5_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0),+ testing::Values(0, 2),+ testing::Values(format::type::bs_fs_yx_bsv16_fsv16),+ testing::Values(format::type::b_fs_yx_fsv32),+ testing::Values(std::vector<int>{3, 77, 44, 1}),+ testing::Values(std::vector<int>{3, 66, 55, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_b_fs_yx_fsv16_bd0_dim4_to_dim5,gather8_test_f16i32,testing::Combine(testing::Values(0),@@ -191,6 +251,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_b_fs_yx_fsv16_bd0_dim4_to_dim5,testing::Values(std::vector<int>{3, 77, 44, 1}),testing::Values(std::vector<int>{3, 66, 55, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_b_fs_yx_fsv16_bd0_dim4_to_dim5_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0),+ testing::Values(0, 2),+ testing::Values(format::type::b_fs_yx_fsv16),+ testing::Values(format::type::b_fs_yx_fsv4),+ testing::Values(std::vector<int>{3, 77, 44, 1}),+ testing::Values(std::vector<int>{3, 66, 55, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_bfyx_bd0_dim4_to_dim6,gather8_test_f16i32,testing::Combine(testing::Values(0),@@ -200,6 +269,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_bfyx_bd0_dim4_to_dim6,testing::Values(std::vector<int>{3, 7, 4, 6}),testing::Values(std::vector<int>{3, 6, 5, 1}),testing::Values(impl_types::any)));+INSTANTIATE_TEST_SUITE_P(gather8_bfyx_bd0_dim4_to_dim6_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0),+ testing::Values(0, 2),+ testing::Values(format::type::bfyx),+ testing::Values(format::type::b_fs_yx_fsv4),+ testing::Values(std::vector<int>{3, 7, 4, 6}),+ testing::Values(std::vector<int>{3, 6, 5, 1}),+ testing::Values(impl_types::any)));INSTANTIATE_TEST_SUITE_P(gather8_bd0_d4_i1,gather8_test_f32i8,testing::Combine(testing::Values(0),@@ -273,6 +351,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_cpu_impl_bd0_d4_i1,testing::Values(std::vector<int>{5, 44, 7, 8}),testing::Values(std::vector<int>{4, 1}),testing::Values(impl_types::cpu)));+INSTANTIATE_TEST_SUITE_P(gather8_cpu_impl_bd0_d4_i1_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0), // bdim in [0,get_not_one_dim(dict))+ testing::Values(0), // axis in [batch_dim,get_not_one_dim(dict))+ testing::Values(format::type::bfyx),+ testing::Values(format::type::bfyx),+ testing::Values(std::vector<int>{5, 44, 7, 8}),+ testing::Values(std::vector<int>{4, 1}),+ testing::Values(impl_types::cpu)));INSTANTIATE_TEST_SUITE_P(gather8_cpu_impl_bd0_d2_i2,gather8_test_f16i32,testing::Combine(testing::Values(0),@@ -282,6 +369,15 @@ INSTANTIATE_TEST_SUITE_P(gather8_cpu_impl_bd0_d2_i2,testing::Values(std::vector<int>{8, 67, 1, 1}),testing::Values(std::vector<int>{4, 56}),testing::Values(impl_types::cpu)));+INSTANTIATE_TEST_SUITE_P(gather8_cpu_impl_bd0_d2_i2_bf16,+ gather8_test_bf16i32,+ testing::Combine(testing::Values(0),+ testing::Values(1),+ testing::Values(format::type::bfyx),+ testing::Values(format::type::bfyx),+ testing::Values(std::vector<int>{8, 67, 1, 1}),+ testing::Values(std::vector<int>{4, 56}),+ testing::Values(impl_types::cpu)));INSTANTIATE_TEST_SUITE_P(gather8_cpu_impl_bfyx,gather8_test_i32i32,testing::Combine(testing::Values(0),@@ -326,7 +422,8 @@ INSTANTIATE_TEST_SUITE_P(DISABLED_gather8_6d_f16i32,testing::Values(std::vector<int>{3, 5, 4, 1, 1, 1}),testing::Values(impl_types::any)));-TEST(gather8_gpu_fp16, d323_axisY_bdim_m1) {+template<typename T>+void gather8_d323_axisY_bdim_m1_test() {// Dictionary : 3x2x3x4x2// Indexes : 3x2x3x1// Axis : 3@@ -360,38 +457,38 @@ TEST(gather8_gpu_fp16, d323_axisY_bdim_m1) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, tensor{ 3, 2, 2, 4, 3} }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfzyx, tensor{ 3, 2, 2, 4, 3} }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 3 } }); // Indexesint64_t axis = 3;int64_t batch_dim = -1;bool negative_indexes = true;set_values(input1, {- ov::float16(1.f), ov::float16(2.f), ov::float16(3.f), ov::float16(4.f), ov::float16(5.f), ov::float16(6.f), ov::float16(7.f), ov::float16(8.f),- ov::float16(9.f), ov::float16(10.f), ov::float16(11.f), ov::float16(12.f), ov::float16(13.f), ov::float16(14.f), ov::float16(15.f), ov::float16(16.f),- ov::float16(17.f), ov::float16(18.f), ov::float16(19.f), ov::float16(20.f), ov::float16(21.f), ov::float16(22.f), ov::float16(23.f), ov::float16(24.f),+ T(1.f), T(2.f), T(3.f), T(4.f), T(5.f), T(6.f), T(7.f), T(8.f),+ T(9.f), T(10.f), T(11.f), T(12.f), T(13.f), T(14.f), T(15.f), T(16.f),+ T(17.f), T(18.f), T(19.f), T(20.f), T(21.f), T(22.f), T(23.f), T(24.f),- ov::float16(25.f), ov::float16(26.f), ov::float16(27.f), ov::float16(28.f), ov::float16(29.f), ov::float16(30.f), ov::float16(31.f), ov::float16(32.f),- ov::float16(33.f), ov::float16(34.f), ov::float16(35.f), ov::float16(36.f), ov::float16(37.f), ov::float16(38.f), ov::float16(39.f), ov::float16(40.f),- ov::float16(41.f), ov::float16(42.f), ov::float16(43.f), ov::float16(44.f), ov::float16(45.f), ov::float16(46.f), ov::float16(47.f), ov::float16(48.f),+ T(25.f), T(26.f), T(27.f), T(28.f), T(29.f), T(30.f), T(31.f), T(32.f),+ T(33.f), T(34.f), T(35.f), T(36.f), T(37.f), T(38.f), T(39.f), T(40.f),+ T(41.f), T(42.f), T(43.f), T(44.f), T(45.f), T(46.f), T(47.f), T(48.f),- ov::float16(49.f), ov::float16(50.f), ov::float16(51.f), ov::float16(52.f), ov::float16(53.f), ov::float16(54.f), ov::float16(55.f), ov::float16(56.f),- ov::float16(57.f), ov::float16(58.f), ov::float16(59.f), ov::float16(60.f), ov::float16(61.f), ov::float16(62.f), ov::float16(63.f), ov::float16(64.f),- ov::float16(65.f), ov::float16(66.f), ov::float16(67.f), ov::float16(68.f), ov::float16(69.f), ov::float16(70.f), ov::float16(71.f), ov::float16(72.f),+ T(49.f), T(50.f), T(51.f), T(52.f), T(53.f), T(54.f), T(55.f), T(56.f),+ T(57.f), T(58.f), T(59.f), T(60.f), T(61.f), T(62.f), T(63.f), T(64.f),+ T(65.f), T(66.f), T(67.f), T(68.f), T(69.f), T(70.f), T(71.f), T(72.f),- ov::float16(73.f), ov::float16(74.f), ov::float16(75.f), ov::float16(76.f), ov::float16(77.f), ov::float16(78.f), ov::float16(79.f), ov::float16(80.f),- ov::float16(81.f), ov::float16(82.f), ov::float16(83.f), ov::float16(84.f), ov::float16(85.f), ov::float16(86.f), ov::float16(87.f), ov::float16(88.f),- ov::float16(89.f), ov::float16(90.f), ov::float16(91.f), ov::float16(92.f), ov::float16(93.f), ov::float16(94.f), ov::float16(95.f), ov::float16(96.f),+ T(73.f), T(74.f), T(75.f), T(76.f), T(77.f), T(78.f), T(79.f), T(80.f),+ T(81.f), T(82.f), T(83.f), T(84.f), T(85.f), T(86.f), T(87.f), T(88.f),+ T(89.f), T(90.f), T(91.f), T(92.f), T(93.f), T(94.f), T(95.f), T(96.f),- ov::float16(97.f), ov::float16(98.f), ov::float16(99.f), ov::float16(100.f), ov::float16(101.f), ov::float16(102.f), ov::float16(103.f), ov::float16(104.f),- ov::float16(105.f), ov::float16(106.f), ov::float16(107.f), ov::float16(108.f), ov::float16(109.f), ov::float16(110.f), ov::float16(111.f), ov::float16(112.f),- ov::float16(113.f), ov::float16(114.f), ov::float16(115.f), ov::float16(116.f), ov::float16(117.f), ov::float16(118.f), ov::float16(119.f), ov::float16(120.f),+ T(97.f), T(98.f), T(99.f), T(100.f), T(101.f), T(102.f), T(103.f), T(104.f),+ T(105.f), T(106.f), T(107.f), T(108.f), T(109.f), T(110.f), T(111.f), T(112.f),+ T(113.f), T(114.f), T(115.f), T(116.f), T(117.f), T(118.f), T(119.f), T(120.f),- ov::float16(121.f), ov::float16(122.f), ov::float16(123.f), ov::float16(124.f), ov::float16(125.f), ov::float16(126.f), ov::float16(127.f), ov::float16(128.f),- ov::float16(129.f), ov::float16(130.f), ov::float16(131.f), ov::float16(132.f), ov::float16(133.f), ov::float16(134.f), ov::float16(135.f), ov::float16(136.f),- ov::float16(137.f), ov::float16(138.f), ov::float16(139.f), ov::float16(140.f), ov::float16(141.f), ov::float16(142.f), ov::float16(143.f), ov::float16(144.f)+ T(121.f), T(122.f), T(123.f), T(124.f), T(125.f), T(126.f), T(127.f), T(128.f),+ T(129.f), T(130.f), T(131.f), T(132.f), T(133.f), T(134.f), T(135.f), T(136.f),+ T(137.f), T(138.f), T(139.f), T(140.f), T(141.f), T(142.f), T(143.f), T(144.f)});set_values(input2, {@@ -420,7 +517,7 @@ TEST(gather8_gpu_fp16, d323_axisY_bdim_m1) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 2.f, 1.f, 2.f, 1.f, 2.f,@@ -451,12 +548,16 @@ TEST(gather8_gpu_fp16, d323_axisY_bdim_m1) {};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}+TEST(gather8_gpu_fp16, d323_axisY_bdim_m1) { gather8_d323_axisY_bdim_m1_test<ov::float16>(); }+TEST(gather8_gpu_bf16, d323_axisY_bdim_m1) { gather8_d323_axisY_bdim_m1_test<ov::bfloat16>(); }-TEST(gather7_gpu_fp16, d222_axisX_bdim_m1) {++template<typename T>+void gather7_d222_axisX_bdim_m1_test() {// Dictionary : 2x2x2x2x2x2// Indexes : 2x2x2x1// Axis : 5@@ -485,23 +586,23 @@ TEST(gather7_gpu_fp16, d222_axisX_bdim_m1) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfwzyx, tensor{ 2, 2, 2, 2, 2, 2} }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfwzyx, tensor{ 2, 2, 2, 2, 2, 2} }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 2 } }); // Indexesint64_t axis = 5;int64_t batch_dim = -1;set_values(input1, {- ov::float16(1.f), ov::float16(2.f), ov::float16(3.f), ov::float16(4.f), ov::float16(5.f), ov::float16(6.f), ov::float16(7.f), ov::float16(8.f),- ov::float16(9.f), ov::float16(10.f), ov::float16(11.f), ov::float16(12.f), ov::float16(13.f), ov::float16(14.f), ov::float16(15.f), ov::float16(16.f),+ T(1.f), T(2.f), T(3.f), T(4.f), T(5.f), T(6.f), T(7.f), T(8.f),+ T(9.f), T(10.f), T(11.f), T(12.f), T(13.f), T(14.f), T(15.f), T(16.f),- ov::float16(17.f), ov::float16(18.f), ov::float16(19.f), ov::float16(20.f), ov::float16(21.f), ov::float16(22.f), ov::float16(23.f), ov::float16(24.f),- ov::float16(25.f), ov::float16(26.f), ov::float16(27.f), ov::float16(28.f), ov::float16(29.f), ov::float16(30.f), ov::float16(31.f), ov::float16(32.f),+ T(17.f), T(18.f), T(19.f), T(20.f), T(21.f), T(22.f), T(23.f), T(24.f),+ T(25.f), T(26.f), T(27.f), T(28.f), T(29.f), T(30.f), T(31.f), T(32.f),- ov::float16(33.f), ov::float16(34.f), ov::float16(35.f), ov::float16(36.f), ov::float16(37.f), ov::float16(38.f), ov::float16(39.f), ov::float16(40.f),- ov::float16(41.f), ov::float16(42.f), ov::float16(43.f), ov::float16(44.f), ov::float16(45.f), ov::float16(46.f), ov::float16(47.f), ov::float16(48.f),+ T(33.f), T(34.f), T(35.f), T(36.f), T(37.f), T(38.f), T(39.f), T(40.f),+ T(41.f), T(42.f), T(43.f), T(44.f), T(45.f), T(46.f), T(47.f), T(48.f),- ov::float16(49.f), ov::float16(50.f), ov::float16(51.f), ov::float16(52.f), ov::float16(53.f), ov::float16(54.f), ov::float16(55.f), ov::float16(56.f),- ov::float16(57.f), ov::float16(58.f), ov::float16(59.f), ov::float16(60.f), ov::float16(61.f), ov::float16(62.f), ov::float16(63.f), ov::float16(64.f),+ T(49.f), T(50.f), T(51.f), T(52.f), T(53.f), T(54.f), T(55.f), T(56.f),+ T(57.f), T(58.f), T(59.f), T(60.f), T(61.f), T(62.f), T(63.f), T(64.f),});set_values(input2, {@@ -527,7 +628,7 @@ TEST(gather7_gpu_fp16, d222_axisX_bdim_m1) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f,@@ -541,11 +642,15 @@ TEST(gather7_gpu_fp16, d222_axisX_bdim_m1) {};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather7_gpu_fp16, d323_axisY_bdim_m1) {+TEST(gather7_gpu_fp16, d222_axisX_bdim_m1) { gather7_d222_axisX_bdim_m1_test<ov::float16>(); }+TEST(gather7_gpu_bf16, d222_axisX_bdim_m1) { gather7_d222_axisX_bdim_m1_test<ov::bfloat16>(); }++template<typename T>+void gather7_d323_axisY_bdim_m1_test() {// Dictionary : 3x2x3x4x2// Indexes : 3x2x3x1// Axis : 3@@ -579,37 +684,37 @@ TEST(gather7_gpu_fp16, d323_axisY_bdim_m1) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, tensor{ 3, 2, 2, 4, 3} }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfzyx, tensor{ 3, 2, 2, 4, 3} }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 3 } }); // Indexesint64_t axis = 3;int64_t batch_dim = -1;set_values(input1, {- ov::float16(1.f), ov::float16(2.f), ov::float16(3.f), ov::float16(4.f), ov::float16(5.f), ov::float16(6.f), ov::float16(7.f), ov::float16(8.f),- ov::float16(9.f), ov::float16(10.f), ov::float16(11.f), ov::float16(12.f), ov::float16(13.f), ov::float16(14.f), ov::float16(15.f), ov::float16(16.f),- ov::float16(17.f), ov::float16(18.f), ov::float16(19.f), ov::float16(20.f), ov::float16(21.f), ov::float16(22.f), ov::float16(23.f), ov::float16(24.f),+ T(1.f), T(2.f), T(3.f), T(4.f), T(5.f), T(6.f), T(7.f), T(8.f),+ T(9.f), T(10.f), T(11.f), T(12.f), T(13.f), T(14.f), T(15.f), T(16.f),+ T(17.f), T(18.f), T(19.f), T(20.f), T(21.f), T(22.f), T(23.f), T(24.f),- ov::float16(25.f), ov::float16(26.f), ov::float16(27.f), ov::float16(28.f), ov::float16(29.f), ov::float16(30.f), ov::float16(31.f), ov::float16(32.f),- ov::float16(33.f), ov::float16(34.f), ov::float16(35.f), ov::float16(36.f), ov::float16(37.f), ov::float16(38.f), ov::float16(39.f), ov::float16(40.f),- ov::float16(41.f), ov::float16(42.f), ov::float16(43.f), ov::float16(44.f), ov::float16(45.f), ov::float16(46.f), ov::float16(47.f), ov::float16(48.f),+ T(25.f), T(26.f), T(27.f), T(28.f), T(29.f), T(30.f), T(31.f), T(32.f),+ T(33.f), T(34.f), T(35.f), T(36.f), T(37.f), T(38.f), T(39.f), T(40.f),+ T(41.f), T(42.f), T(43.f), T(44.f), T(45.f), T(46.f), T(47.f), T(48.f),- ov::float16(49.f), ov::float16(50.f), ov::float16(51.f), ov::float16(52.f), ov::float16(53.f), ov::float16(54.f), ov::float16(55.f), ov::float16(56.f),- ov::float16(57.f), ov::float16(58.f), ov::float16(59.f), ov::float16(60.f), ov::float16(61.f), ov::float16(62.f), ov::float16(63.f), ov::float16(64.f),- ov::float16(65.f), ov::float16(66.f), ov::float16(67.f), ov::float16(68.f), ov::float16(69.f), ov::float16(70.f), ov::float16(71.f), ov::float16(72.f),+ T(49.f), T(50.f), T(51.f), T(52.f), T(53.f), T(54.f), T(55.f), T(56.f),+ T(57.f), T(58.f), T(59.f), T(60.f), T(61.f), T(62.f), T(63.f), T(64.f),+ T(65.f), T(66.f), T(67.f), T(68.f), T(69.f), T(70.f), T(71.f), T(72.f),- ov::float16(73.f), ov::float16(74.f), ov::float16(75.f), ov::float16(76.f), ov::float16(77.f), ov::float16(78.f), ov::float16(79.f), ov::float16(80.f),- ov::float16(81.f), ov::float16(82.f), ov::float16(83.f), ov::float16(84.f), ov::float16(85.f), ov::float16(86.f), ov::float16(87.f), ov::float16(88.f),- ov::float16(89.f), ov::float16(90.f), ov::float16(91.f), ov::float16(92.f), ov::float16(93.f), ov::float16(94.f), ov::float16(95.f), ov::float16(96.f),+ T(73.f), T(74.f), T(75.f), T(76.f), T(77.f), T(78.f), T(79.f), T(80.f),+ T(81.f), T(82.f), T(83.f), T(84.f), T(85.f), T(86.f), T(87.f), T(88.f),+ T(89.f), T(90.f), T(91.f), T(92.f), T(93.f), T(94.f), T(95.f), T(96.f),- ov::float16(97.f), ov::float16(98.f), ov::float16(99.f), ov::float16(100.f), ov::float16(101.f), ov::float16(102.f), ov::float16(103.f), ov::float16(104.f),- ov::float16(105.f), ov::float16(106.f), ov::float16(107.f), ov::float16(108.f), ov::float16(109.f), ov::float16(110.f), ov::float16(111.f), ov::float16(112.f),- ov::float16(113.f), ov::float16(114.f), ov::float16(115.f), ov::float16(116.f), ov::float16(117.f), ov::float16(118.f), ov::float16(119.f), ov::float16(120.f),+ T(97.f), T(98.f), T(99.f), T(100.f), T(101.f), T(102.f), T(103.f), T(104.f),+ T(105.f), T(106.f), T(107.f), T(108.f), T(109.f), T(110.f), T(111.f), T(112.f),+ T(113.f), T(114.f), T(115.f), T(116.f), T(117.f), T(118.f), T(119.f), T(120.f),- ov::float16(121.f), ov::float16(122.f), ov::float16(123.f), ov::float16(124.f), ov::float16(125.f), ov::float16(126.f), ov::float16(127.f), ov::float16(128.f),- ov::float16(129.f), ov::float16(130.f), ov::float16(131.f), ov::float16(132.f), ov::float16(133.f), ov::float16(134.f), ov::float16(135.f), ov::float16(136.f),- ov::float16(137.f), ov::float16(138.f), ov::float16(139.f), ov::float16(140.f), ov::float16(141.f), ov::float16(142.f), ov::float16(143.f), ov::float16(144.f)+ T(121.f), T(122.f), T(123.f), T(124.f), T(125.f), T(126.f), T(127.f), T(128.f),+ T(129.f), T(130.f), T(131.f), T(132.f), T(133.f), T(134.f), T(135.f), T(136.f),+ T(137.f), T(138.f), T(139.f), T(140.f), T(141.f), T(142.f), T(143.f), T(144.f)});set_values(input2, {@@ -638,7 +743,7 @@ TEST(gather7_gpu_fp16, d323_axisY_bdim_m1) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 2.f, 1.f, 2.f, 1.f, 2.f,@@ -669,11 +774,15 @@ TEST(gather7_gpu_fp16, d323_axisY_bdim_m1) {};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather7_gpu_fp16, d44_axisY_bdim1) {+TEST(gather7_gpu_fp16, d323_axisY_bdim_m1) { gather7_d323_axisY_bdim_m1_test<ov::float16>(); }+TEST(gather7_gpu_bf16, d323_axisY_bdim_m1) { gather7_d323_axisY_bdim_m1_test<ov::bfloat16>(); }++template<typename T>+void gather7_d44_axisY_bdim1_test() {// Dictionary : 4x3x5x1// Indexes : 4x4x1x1// Axis : 2@@ -697,27 +806,27 @@ TEST(gather7_gpu_fp16, d44_axisY_bdim1) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 4, 3, 1, 5 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, tensor{ 4, 3, 1, 5 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 4, 4, 1, 1 } }); // Indexesint64_t axis = 2;int64_t batch_dim = 1;set_values(input1, {- ov::float16(84.f), ov::float16( 7.f), ov::float16(10.f), ov::float16(69.f), ov::float16(13.f),- ov::float16(47.f), ov::float16(75.f), ov::float16( 8.f), ov::float16(65.f), ov::float16(28.f),- ov::float16( 5.f), ov::float16(12.f), ov::float16(56.f), ov::float16(54.f), ov::float16( 9.f),+ T(84.f), T( 7.f), T(10.f), T(69.f), T(13.f),+ T(47.f), T(75.f), T( 8.f), T(65.f), T(28.f),+ T( 5.f), T(12.f), T(56.f), T(54.f), T( 9.f),- ov::float16(31.f), ov::float16(12.f), ov::float16(71.f), ov::float16(55.f), ov::float16( 8.f),- ov::float16(73.f), ov::float16(16.f), ov::float16(29.f), ov::float16(81.f), ov::float16(81.f),- ov::float16(75.f), ov::float16( 8.f), ov::float16(74.f), ov::float16(75.f), ov::float16(51.f),+ T(31.f), T(12.f), T(71.f), T(55.f), T( 8.f),+ T(73.f), T(16.f), T(29.f), T(81.f), T(81.f),+ T(75.f), T( 8.f), T(74.f), T(75.f), T(51.f),- ov::float16( 7.f), ov::float16(29.f), ov::float16( 6.f), ov::float16(72.f), ov::float16(18.f),- ov::float16(38.f), ov::float16(54.f), ov::float16(19.f), ov::float16(70.f), ov::float16(16.f),- ov::float16(74.f), ov::float16(40.f), ov::float16(72.f), ov::float16(88.f), ov::float16(24.f),+ T( 7.f), T(29.f), T( 6.f), T(72.f), T(18.f),+ T(38.f), T(54.f), T(19.f), T(70.f), T(16.f),+ T(74.f), T(40.f), T(72.f), T(88.f), T(24.f),- ov::float16(14.f), ov::float16(75.f), ov::float16(74.f), ov::float16(82.f), ov::float16(25.f),- ov::float16(48.f), ov::float16(13.f), ov::float16(71.f), ov::float16(92.f), ov::float16( 9.f),- ov::float16(73.f), ov::float16( 8.f), ov::float16(80.f), ov::float16(27.f), ov::float16(64.f)+ T(14.f), T(75.f), T(74.f), T(82.f), T(25.f),+ T(48.f), T(13.f), T(71.f), T(92.f), T( 9.f),+ T(73.f), T( 8.f), T(80.f), T(27.f), T(64.f)});set_values(input2, {@@ -742,7 +851,7 @@ TEST(gather7_gpu_fp16, d44_axisY_bdim1) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {69.f, 10.f, 69.f, 13.f,@@ -763,11 +872,15 @@ TEST(gather7_gpu_fp16, d44_axisY_bdim1) {};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather7_gpu_fp16, d32_axisF_bdim_m1) {+TEST(gather7_gpu_fp16, d44_axisY_bdim1) { gather7_d44_axisY_bdim1_test<ov::float16>(); }+TEST(gather7_gpu_bf16, d44_axisY_bdim1) { gather7_d44_axisY_bdim1_test<ov::bfloat16>(); }++template<typename T>+void gather7_d32_axisF_bdim_m1_test() {// Dictionary : 3x2x1x1// Indexes : 3x2x1x1// Axis : 1@@ -786,15 +899,15 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim_m1) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Indexesint64_t axis = 1;size_t batch_dim = -1;set_values(input1, {- ov::float16(1.f), ov::float16(2.f),- ov::float16(3.f), ov::float16(4.f),- ov::float16(5.f), ov::float16(6.f)+ T(1.f), T(2.f),+ T(3.f), T(4.f),+ T(5.f), T(6.f)});set_values(input2, {@@ -817,7 +930,7 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim_m1) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 1.f,@@ -826,11 +939,15 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim_m1) {};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather7_gpu_fp16, d32_axisF_bdim1) {+TEST(gather7_gpu_fp16, d32_axisF_bdim_m1) { gather7_d32_axisF_bdim_m1_test<ov::float16>(); }+TEST(gather7_gpu_bf16, d32_axisF_bdim_m1) { gather7_d32_axisF_bdim_m1_test<ov::bfloat16>(); }++template<typename T>+void gather7_d32_axisF_bdim1_test() {// Dictionary : 3x2x1x1// Indexes : 3x2x1x1// Axis : 1@@ -849,15 +966,15 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim1) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Indexesint64_t axis = 1;int64_t batch_dim = 1;set_values(input1, {- ov::float16(1.f), ov::float16(2.f),- ov::float16(3.f), ov::float16(4.f),- ov::float16(5.f), ov::float16(6.f)+ T(1.f), T(2.f),+ T(3.f), T(4.f),+ T(5.f), T(6.f)});set_values(input2, {@@ -880,7 +997,7 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim1) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 1.f, 4.f,@@ -888,11 +1005,15 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim1) {};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather7_gpu_fp16, d32_axisF_bdim0) {+TEST(gather7_gpu_fp16, d32_axisF_bdim1) { gather7_d32_axisF_bdim1_test<ov::float16>(); }+TEST(gather7_gpu_bf16, d32_axisF_bdim1) { gather7_d32_axisF_bdim1_test<ov::bfloat16>(); }++template<typename T>+void gather7_d32_axisF_bdim0_test() {// Dictionary : 3x2x1x1// Indexes : 3x2x1x1// Axis : 1@@ -911,15 +1032,15 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim0) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Indexesint64_t axis = 1;size_t batch_dim = 0;set_values(input1, {- ov::float16(1.f), ov::float16(2.f),- ov::float16(3.f), ov::float16(4.f),- ov::float16(5.f), ov::float16(6.f)+ T(1.f), T(2.f),+ T(3.f), T(4.f),+ T(5.f), T(6.f)});set_values(input2, {@@ -942,7 +1063,7 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim0) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 1.f,@@ -959,11 +1080,15 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim0) {};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather_gpu_fp16, d14_axisB) {+TEST(gather7_gpu_fp16, d32_axisF_bdim0) { gather7_d32_axisF_bdim0_test<ov::float16>(); }+TEST(gather7_gpu_bf16, d32_axisF_bdim0) { gather7_d32_axisF_bdim0_test<ov::bfloat16>(); }++template<typename T>+void gather_d14_axisB_test() {// Dictionary : 2x2x1x1// Indexes : 1x4x1x1// Axis : 0@@ -981,13 +1106,13 @@ TEST(gather_gpu_fp16, d14_axisB) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 2, 2, 1, 1 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, { 2, 2, 1, 1 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 1, 4, 1, 1 } }); // Indexesint64_t axis = 0;set_values(input1, {- ov::float16(1.0f), ov::float16(2.0f),- ov::float16(3.0f), ov::float16(4.0f)+ T(1.0f), T(2.0f),+ T(3.0f), T(4.0f)});set_values(input2, {@@ -1010,18 +1135,22 @@ TEST(gather_gpu_fp16, d14_axisB) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 2.f, 3.f, 4.f, 3.f, 4.f, 1.f, 2.f};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather_gpu_fp16, d222_axisB) {+TEST(gather_gpu_fp16, d14_axisB) { gather_d14_axisB_test<ov::float16>(); }+TEST(gather_gpu_bf16, d14_axisB) { gather_d14_axisB_test<ov::bfloat16>(); }++template<typename T>+void gather_d222_axisB_test() {// Dictionary : 3x2x2x1// Indexes : 2x2x1x1// Axis : 0@@ -1040,16 +1169,16 @@ TEST(gather_gpu_fp16, d222_axisB) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 2 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, tensor{ 3, 2, 1, 2 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexesint64_t axis = 0;set_values(input1, {- ov::float16(1.f), ov::float16(2.f), ov::float16(3.f),- ov::float16(4.f), ov::float16(5.f), ov::float16(6.f),+ T(1.f), T(2.f), T(3.f),+ T(4.f), T(5.f), T(6.f),- ov::float16(7.f), ov::float16(8.f), ov::float16(9.f),- ov::float16(10.f), ov::float16(11.f), ov::float16(12.f)+ T(7.f), T(8.f), T(9.f),+ T(10.f), T(11.f), T(12.f)});set_values(input2, {@@ -1072,18 +1201,22 @@ TEST(gather_gpu_fp16, d222_axisB) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, 5.f, 6.f, 7.f, 8.f};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather_gpu_fp16, d22_axisY) {+TEST(gather_gpu_fp16, d222_axisB) { gather_d222_axisB_test<ov::float16>(); }+TEST(gather_gpu_bf16, d222_axisB) { gather_d222_axisB_test<ov::bfloat16>(); }++template<typename T>+void gather_d22_axisY_test() {// Dictionary : 2x2x3x1// Indexes : 2x2x1x1// Axis : 2@@ -1102,16 +1235,16 @@ TEST(gather_gpu_fp16, d22_axisY) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 2, 2, 1, 3 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, tensor{ 2, 2, 1, 3 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexesint64_t axis = 2;set_values(input1, {- ov::float16(1.f), ov::float16(2.f), ov::float16(3.f),- ov::float16(4.f), ov::float16(5.f), ov::float16(6.f),+ T(1.f), T(2.f), T(3.f),+ T(4.f), T(5.f), T(6.f),- ov::float16(7.f), ov::float16(8.f), ov::float16(9.f),- ov::float16(10.f), ov::float16(11.f), ov::float16(12.f)+ T(7.f), T(8.f), T(9.f),+ T(10.f), T(11.f), T(12.f)});set_values(input2, {@@ -1133,18 +1266,22 @@ TEST(gather_gpu_fp16, d22_axisY) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 2.f, 3.f, 2.f, 4.f, 5.f, 6.f, 5.f, 7.f, 8.f, 9.f, 8.f, 10.f, 11.f, 12.f, 11.f};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather_gpu_fp16, d22_axisF) {+TEST(gather_gpu_fp16, d22_axisY) { gather_d22_axisY_test<ov::float16>(); }+TEST(gather_gpu_bf16, d22_axisY) { gather_d22_axisY_test<ov::bfloat16>(); }++template<typename T>+void gather_d22_axisF_test() {// Dictionary : 2x3x2x1// Indexes : 2x2x1x1// Axis : 2@@ -1163,16 +1300,16 @@ TEST(gather_gpu_fp16, d22_axisF) {auto& engine = get_test_engine();- auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 2, 3, 1, 2 } }); // Dictionary+ auto input1 = engine.allocate_memory({ gather_test_type_traits<T>::dt, format::bfyx, tensor{ 2, 3, 1, 2 } }); // Dictionaryauto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexesint64_t axis = 1;set_values(input1, {- ov::float16(1.f), ov::float16(2.f), ov::float16(3.f),- ov::float16(4.f), ov::float16(5.f), ov::float16(6.f),+ T(1.f), T(2.f), T(3.f),+ T(4.f), T(5.f), T(6.f),- ov::float16(7.f), ov::float16(8.f), ov::float16(9.f),- ov::float16(10.f), ov::float16(11.f), ov::float16(12.f)+ T(7.f), T(8.f), T(9.f),+ T(10.f), T(11.f), T(12.f)});set_values(input2, {@@ -1194,22 +1331,26 @@ TEST(gather_gpu_fp16, d22_axisF) {auto outputs = network.execute();auto output = outputs.at("gather").get_memory();- cldnn::mem_lock<uint16_t, mem_lock_type::read> output_ptr(output, get_test_stream());+ cldnn::mem_lock<T, mem_lock_type::read> output_ptr(output, get_test_stream());std::vector<float> expected_results = {1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 3.f, 4.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, 9.f, 10.f};for (size_t i = 0; i < expected_results.size(); ++i) {- ASSERT_EQ(expected_results[i], half_to_float(output_ptr[i]));+ ASSERT_EQ(expected_results[i], static_cast<float>(output_ptr[i]));}}-TEST(gather_gpu_fp16, prevent_reorder_to_indices_node) {+TEST(gather_gpu_fp16, d22_axisF) { gather_d22_axisF_test<ov::float16>(); }+TEST(gather_gpu_bf16, d22_axisF) { gather_d22_axisF_test<ov::bfloat16>(); }++template<typename T>+void gather_prevent_reorder_to_indices_node_test() {auto& engine = get_test_engine();- auto data_layout = layout{ ov::PartialShape{ 4, 1, 6, 2500, 2 }, data_types::f16, format::bfzyx };- auto output_layout = layout{ ov::PartialShape{ 4, 1, 6, 2500}, data_types::f16, format::bfyx };+ auto data_layout = layout{ ov::PartialShape{ 4, 1, 6, 2500, 2 }, gather_test_type_traits<T>::dt, format::bfzyx };+ auto output_layout = layout{ ov::PartialShape{ 4, 1, 6, 2500}, gather_test_type_traits<T>::dt, format::bfyx };auto indices_layout = layout{ ov::PartialShape{ 4, 1 }, data_types::i32, format::bfyx };int64_t input_rank = static_cast<int64_t>(data_layout.get_rank());@@ -1238,6 +1379,9 @@ TEST(gather_gpu_fp16, prevent_reorder_to_indices_node) {ASSERT_EQ(output_layout.get_partial_shape(), actual_shape);}+TEST(gather_gpu_fp16, prevent_reorder_to_indices_node) { gather_prevent_reorder_to_indices_node_test<ov::float16>(); }+TEST(gather_gpu_bf16, prevent_reorder_to_indices_node) { gather_prevent_reorder_to_indices_node_test<ov::bfloat16>(); }+TEST(gather_gpu_fp32, d14_axisB) {// Dictionary : 2x2x1x1// Indexes : 1x4x1x1@@ -2424,6 +2568,52 @@ public:ASSERT_FLOAT_EQ(expected_result[i], output_ptr[i]) << "i = " << i;}}++ void test_compressed_scale_bf16(bool is_caching_test) {+ auto& engine = get_test_engine();++ auto input_mem = engine.allocate_memory({ {2, 3}, data_types::i32, format::bfyx });+ auto weights_mem = engine.allocate_memory({ {2, 5}, data_types::u8, format::bfyx });+ auto scale_mem = engine.allocate_memory({ {2, 1}, data_types::bf16, format::bfyx });++ set_values(input_mem, { 0, 0, 4,+ 4, 0, 0 });+ set_values<uint8_t>(weights_mem, { 1, 2, 3, 4, 5,+ 6, 7, 8, 9, 10});+ set_values<ov::bfloat16>(scale_mem, { ov::bfloat16(2.0f), ov::bfloat16(4.0f) });++ topology topology(+ input_layout("input", input_mem->get_layout()),+ data("weights", weights_mem),+ data("scale", scale_mem),+ gather("gather_prim", input_info("weights"), input_info("input"), 1,+ input_info("scale"), input_info(""), data_types::bf16, 2, ov::Shape{2, 3}, 1)+ );++ auto config = get_test_default_config(engine);+ config.set_property(ov::intel_gpu::allow_new_shape_infer(true));++ network::ptr network = get_network(engine, topology, config, get_test_stream_ptr(), is_caching_test);+ network->set_input_data("input", input_mem);++ auto outputs = network->execute();+ ASSERT_EQ(outputs.size(), size_t(1));+ ASSERT_EQ(outputs.begin()->first, "gather_prim");++ auto output_mem = outputs.begin()->second.get_memory();++ cldnn::mem_lock<ov::bfloat16> output_ptr (output_mem, get_test_stream());++ ov::PartialShape expected_shape{2, 3};+ ASSERT_EQ(expected_shape, output_mem->get_layout().get_partial_shape());++ std::vector<ov::bfloat16> expected_result = {ov::bfloat16(2), ov::bfloat16(2), ov::bfloat16(10),+ ov::bfloat16(40), ov::bfloat16(24), ov::bfloat16(24)};++ for (size_t i = 0; i < expected_result.size(); i++) {+ ASSERT_FLOAT_EQ(expected_result[i], output_ptr[i]) << "i = " << i;+ }+ }};TEST_F(gather_gpu_tests, compressed_scale_zp) {@@ -2450,6 +2640,14 @@ TEST_F(gather_gpu_tests, compressed_scale_fp16_cached) {this->test_compressed_scale_fp16(true);}+TEST_F(gather_gpu_tests, compressed_scale_bf16) {+ this->test_compressed_scale_bf16(false);+}++TEST_F(gather_gpu_tests, compressed_scale_bf16_cached) {+ this->test_compressed_scale_bf16(true);+}+TEST(gather_gpu_fp32, dynamic_support_neg_ind) {auto& engine = get_test_engine();