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] Add BF16 support for permute operations (#37484)
Prithviraj-R6df62c88ef02
diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cppindex 4c1ac4c2e3f..8ead07c43db 100644--- a/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cpp+++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/fuse_primitives_with_layout.cpp@@ -16,8 +16,8 @@ void fuse_primitives_with_layout::run(program& p) {auto eltwise_supports_fusings = [&](eltwise_node& node) -> bool {auto out_layout = node.get_output_layout();// This condition refers to optimizied kernel EltwiseKernel_fs_b_yx_fsv32- return out_layout.data_type != data_types::f16 || out_layout.batch() <= 1 ||- ((p.get_layout_optimizer().get_optimization_attributes().fs_b_yx_fsv32_network == 0) && out_layout.format != format::fs_b_yx_fsv32);+ return (out_layout.data_type != data_types::f16 && out_layout.data_type != data_types::bf16) || out_layout.batch() <= 1 ||+ ((p.get_layout_optimizer().get_optimization_attributes().fs_b_yx_fsv32_network == 0) && out_layout.format != format::fs_b_yx_fsv32);};bool need_recalc_processing_order = false;diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cppindex 588da77b209..4886979f6fe 100644--- a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp+++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp@@ -695,10 +695,10 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {auto out_layout = node.get_output_layout();// Do not fuse if the estimated format is fs_b_yx_fsv32 because the optimized kernel does not support fusion- return out_layout.data_type != data_types::f16 || !out_layout.is_static() || out_layout.batch() <= 1 ||- (((lo.get_optimization_attributes().fs_b_yx_fsv32_network == 0) ||- lo.has_all_enabled_onednn_impls_optimization_attribute() || has_reorder_behind_mvn()) &&- out_layout.format != format::fs_b_yx_fsv32);+ return (out_layout.data_type != data_types::f16 && out_layout.data_type != data_types::bf16) || !out_layout.is_static() || out_layout.batch() <= 1 ||+ (((lo.get_optimization_attributes().fs_b_yx_fsv32_network == 0) ||+ lo.has_all_enabled_onednn_impls_optimization_attribute() || has_reorder_behind_mvn()) &&+ out_layout.format != format::fs_b_yx_fsv32);};auto get_users_from_fusing_history = [&](const primitive_id& id) {diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_quantization.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_quantization.cppindex a86b2c89ee0..1e42a7d6f1e 100644--- a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_quantization.cpp+++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_quantization.cpp@@ -20,6 +20,7 @@#include <array>#include <string>#include <memory>+#include <tuple>#include <vector>using namespace cldnn;@@ -102,6 +103,10 @@ void prepare_quantization::prepare_scale_shift_opt(program &p, quantize_node& qustd::function<float(size_t)>& get_data) {using float_mem_lock = mem_lock<float, mem_lock_type::write>;using float16_mem_lock = mem_lock<ov::float16, mem_lock_type::write>;+ using bfloat16_mem_lock = mem_lock<ov::bfloat16, mem_lock_type::write>;+ using locked_memory = std::tuple<std::shared_ptr<float_mem_lock>,+ std::shared_ptr<float16_mem_lock>,+ std::shared_ptr<bfloat16_mem_lock>>;switch (memory->get_layout().data_type) {case data_types::f32: {std::shared_ptr<float_mem_lock> data_lock_ptr = std::make_shared<float_mem_lock>(memory, stream);@@ -112,7 +117,7 @@ void prepare_quantization::prepare_scale_shift_opt(program &p, quantize_node& quget_data = [data] (size_t idx) {return data[idx];};- return std::pair<std::shared_ptr<float_mem_lock>, std::shared_ptr<float16_mem_lock>>(data_lock_ptr, nullptr);+ return locked_memory(data_lock_ptr, nullptr, nullptr);}case data_types::f16: {std::shared_ptr<float16_mem_lock> data_lock_ptr = std::make_shared<float16_mem_lock>(memory, stream);@@ -123,7 +128,18 @@ void prepare_quantization::prepare_scale_shift_opt(program &p, quantize_node& quget_data = [data] (size_t idx) {return static_cast<float>(data[idx]);};- return std::pair<std::shared_ptr<float_mem_lock>, std::shared_ptr<float16_mem_lock>>(nullptr, data_lock_ptr);+ return locked_memory(nullptr, data_lock_ptr, nullptr);+ }+ case data_types::bf16: {+ std::shared_ptr<bfloat16_mem_lock> data_lock_ptr = std::make_shared<bfloat16_mem_lock>(memory, stream);+ ov::bfloat16* data = data_lock_ptr->data();+ set_data = [data] (size_t idx, float value) {+ data[idx] = ov::bfloat16(value);+ };+ get_data = [data] (size_t idx) {+ return static_cast<float>(data[idx]);+ };+ return locked_memory(nullptr, nullptr, data_lock_ptr);}default:throw std::runtime_error("prepare_quantization: Unsupported precision of quantize output values");@@ -419,10 +435,11 @@ void prepare_quantization::remove_fake_reorders(program& p, reorder_node& reordeconst auto& usr = reorder_node.get_users().front();auto &dep = reorder_node.get_dependency(0);+ const bool is_reorder_node_non_fp = !one_of(reorder_node.get_output_layout().data_type, {data_types::f32, data_types::f16, data_types::bf16});if (!usr->is_type<convolution>() || usr->get_input_layout(1).data_type != data_types::i8 ||!dep.is_input() ||dep.get_output_layout().data_type != data_types::u8 ||- (reorder_node.get_output_layout().data_type != data_types::f32 && reorder_node.get_output_layout().data_type != data_types::f16) ||+ is_reorder_node_non_fp ||dep.get_output_layout().format != reorder_node.get_output_layout().format ||dep.get_output_layout().get_tensor() != reorder_node.get_output_layout().get_tensor())return;diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/permute.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/permute.cppindex 349e6876ee8..ef5c0363620 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl/permute.cpp+++ b/src/plugins/intel_gpu/src/graph/impls/ocl/permute.cpp@@ -89,6 +89,7 @@ attach_permute_impl::attach_permute_impl() {auto dyn_types = {data_types::f32,data_types::f16,+ data_types::bf16,data_types::i8,data_types::u8,data_types::i32diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_bfzyx_to_bfyxz.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_bfzyx_to_bfyxz.clindex 29d0b363ef0..db078cc1158 100644--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_bfzyx_to_bfyxz.cl+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_bfzyx_to_bfyxz.cl@@ -40,7 +40,7 @@ KERNEL (permute_bfzyx_to_bfyxz)(FUSED_OPS;transpose_buf[dst][lh] = FUSED_OPS_RESULT;#else- transpose_buf[dst][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[dst][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -63,7 +63,7 @@ KERNEL (permute_bfzyx_to_bfyxz)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -90,7 +90,7 @@ KERNEL (permute_bfzyx_to_bfyxz)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -116,7 +116,7 @@ KERNEL (permute_bfzyx_to_bfyxz)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_f_y_axes.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_f_y_axes.clindex 466837c240c..19f13c63211 100644--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_f_y_axes.cl+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_f_y_axes.cl@@ -40,10 +40,10 @@ KERNEL (permute_f_y_axes)(OUT_VEC_TYPE result;IN_VEC_TYPE res = READ_VEC(0, &input[INPUT0_GET_INDEX(b_idx, f_idx, y_idx, x_idx)]);FUSED_OPS_VEC;- result = TO_OUT_VEC_TYPE(FUSED_OPS_RESULT_VEC);+ result = FUSED_OPS_RESULT_VEC;#elseIN_VEC_TYPE res = READ_VEC(0, &input[INPUT0_GET_INDEX(b_idx, f_idx, y_idx, x_idx)]);- OUT_VEC_TYPE result = TO_OUT_VEC_TYPE(ACTIVATION(res, ACTIVATION_PARAMS));+ OUT_VEC_TYPE result = TO_OUTPUT_VECTOR_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_VECTOR_TYPE(res, VEC_SIZE), ACTIVATION_PARAMS), VEC_SIZE);#endifconst int output_idx = OUTPUT_GET_INDEX(b_idx, f_out_idx, y_out_idx, x_idx);WRITE_VEC(result, 0, &output[output_idx]);@@ -90,7 +90,7 @@ KERNEL (permute_f_y_axes)(FUSED_OPS;transpose_buf[bf_local][j][i] = FUSED_OPS_RESULT;#else- transpose_buf[bf_local][j][i] = ACTIVATION(res, ACTIVATION_PARAMS);+ transpose_buf[bf_local][j][i] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(res), ACTIVATION_PARAMS));#endif}}@@ -146,7 +146,7 @@ KERNEL (permute_f_y_axes)(IN_VEC_TYPE res = READ_VEC(0, &input[INPUT0_GET_INDEX(b_idx, f_idx, y_idx, x_idx)]);__attribute__((opencl_unroll_hint(VEC_SIZE)))for (int k = 0; k < VEC_SIZE; ++k) {- transpose_buf[j_vec + k][bf_local] = ACTIVATION(res[k], ACTIVATION_PARAMS);+ transpose_buf[j_vec + k][bf_local] = TO_ACCUMULATOR_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(res[k]), ACTIVATION_PARAMS));}#endif}@@ -169,7 +169,7 @@ KERNEL (permute_f_y_axes)(const int f = (f_begin + j_vec) % INPUT0_FEATURE_NUM;;const int y_idx = y_begin + bf_local;const int output_idx = OUTPUT_GET_INDEX(b_idx, y_idx, f, x_idx);- WRITE_VEC(TO_OUT_VEC_TYPE(READ_VEC(0, &transpose_buf[bf_local][j_vec])), 0, &output[output_idx]);+ WRITE_VEC(TO_OUTPUT_VECTOR_TYPE(DECODE_INPUT0_COMPUTE_VECTOR_TYPE(READ_VEC(0, &transpose_buf[bf_local][j_vec]),VEC_SIZE), VEC_SIZE), 0, &output[output_idx]);}#endif@@ -185,7 +185,7 @@ KERNEL (permute_f_y_axes)(FUSED_OPS;transpose_buf[bf_local][j] = FUSED_OPS_RESULT;#else- transpose_buf[bf_local][j] = ACTIVATION(res, ACTIVATION_PARAMS);+ transpose_buf[bf_local][j] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(res), ACTIVATION_PARAMS));#endif}__attribute__((opencl_unroll_hint(TILE_SIZE)))diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_ref.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_ref.clindex 52513ba690b..4363ac57981 100644--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_ref.cl+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_ref.cl@@ -77,6 +77,6 @@ KERNEL (permute_ref)(FUSED_OPS;output[OUT_IDX] = FUSED_OPS_RESULT;#else- output[OUT_IDX] = ACTIVATION(input[IN_IDX], ACTIVATION_PARAMS);+ output[OUT_IDX] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(input[IN_IDX]), ACTIVATION_PARAMS));#endif}diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4.clindex 109c9017790..2bd0f26a317 100644--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4.cl+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4.cl@@ -89,7 +89,7 @@ KERNEL (permute_tile_8x8_4x4)(FUSED_OPS;transpose_buf[dst][lh] = FUSED_OPS_RESULT;#else- transpose_buf[dst][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[dst][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -112,7 +112,7 @@ KERNEL (permute_tile_8x8_4x4)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -138,7 +138,7 @@ KERNEL (permute_tile_8x8_4x4)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -168,7 +168,7 @@ KERNEL (permute_tile_8x8_4x4)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -195,7 +195,7 @@ KERNEL (permute_tile_8x8_4x4)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -224,7 +224,7 @@ KERNEL (permute_tile_8x8_4x4)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}@@ -254,7 +254,7 @@ KERNEL (permute_tile_8x8_4x4)(FUSED_OPS;transpose_buf[local_buf_offset + i][lh] = FUSED_OPS_RESULT;#else- transpose_buf[local_buf_offset + i][lh] = ACTIVATION(read_data[i], ACTIVATION_PARAMS);+ transpose_buf[local_buf_offset + i][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[i]), ACTIVATION_PARAMS));#endif}}diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4_fsv.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4_fsv.clindex 0a06f767790..b3a67a0caaf 100644--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4_fsv.cl+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_tile_8x8_4x4_fsv.cl@@ -71,7 +71,7 @@ KERNEL (permute_tile_8x8_4x4_fsv)(VSTORE(out_data, 0, output + output_idx);#elseconst uint output_idx = OUTPUT_GET_TILED_INDEX(REORDERED_OUTPUT_TILED_ORDER);- VSTORE(ACTIVATION(TO_OUTPUTVTYPE(read_data), ACTIVATION_PARAMS), 0, output + output_idx);+ VSTORE(TO_OUTPUT_VECTOR_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_VECTOR_TYPE(read_data, TILE_SIZE), ACTIVATION_PARAMS), TILE_SIZE), 0, output + output_idx);#endif}}@@ -93,7 +93,7 @@ KERNEL (permute_tile_8x8_4x4_fsv)(FUSED_OPS;output[output_idx + lw] = FUSED_OPS_RESULT;#else- output[output_idx + lw] = TO_OUTPUT_TYPE(read_data[lw]);+ output[output_idx + lw] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[lw]), ACTIVATION_PARAMS));#endif}}@@ -117,7 +117,7 @@ KERNEL (permute_tile_8x8_4x4_fsv)(FUSED_OPS;transpose_buf[dst][lh] = FUSED_OPS_RESULT;#else- transpose_buf[dst][lh] = ACTIVATION(read_data[lw], ACTIVATION_PARAMS);+ transpose_buf[dst][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[lw]), ACTIVATION_PARAMS));#endif}}@@ -171,7 +171,7 @@ KERNEL (permute_tile_8x8_4x4_fsv)(FUSED_OPS;transpose_buf[dst][lh] = FUSED_OPS_RESULT;#else- transpose_buf[dst][lh] = ACTIVATION(read_data[lw], ACTIVATION_PARAMS);+ transpose_buf[dst][lh] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(read_data[lw]), ACTIVATION_PARAMS));#endif}}diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_xy_swap.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_xy_swap.clindex bf6960d5689..802c09f1d98 100644--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_xy_swap.cl+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/permute_xy_swap.cl@@ -94,7 +94,7 @@ KERNEL(permute_xy_swap)(FUSED_OPS;output[OUTPUT_GET_INDEX(b, f, out_y, out_x)] = FUSED_OPS_RESULT;#else- output[OUTPUT_GET_INDEX(b, f, out_y, out_x)] = ACTIVATION(val, ACTIVATION_PARAMS);+ output[OUTPUT_GET_INDEX(b, f, out_y, out_x)] = TO_OUTPUT_TYPE(ACTIVATION(DECODE_INPUT0_COMPUTE_TYPE(val), ACTIVATION_PARAMS));#endif}}diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cppindex 78d01c69a52..25e56abd54f 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cpp@@ -18,12 +18,14 @@ namespace kernel_selector {ParamsKey PermuteKernel_bfzyx_to_bfyxz::GetSupportedKey() const {ParamsKey k;k.EnableInputDataType(Datatype::F16);+ k.EnableInputDataType(Datatype::BF16);k.EnableInputDataType(Datatype::F32);k.EnableInputDataType(Datatype::INT8);k.EnableInputDataType(Datatype::UINT8);k.EnableInputDataType(Datatype::INT32);k.EnableInputDataType(Datatype::INT64);k.EnableOutputDataType(Datatype::F16);+ k.EnableOutputDataType(Datatype::BF16);k.EnableOutputDataType(Datatype::F32);k.EnableOutputDataType(Datatype::INT8);k.EnableOutputDataType(Datatype::UINT8);diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_f_y_axes.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_f_y_axes.cppindex 4309261ca9a..080a8cf3b79 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_f_y_axes.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_f_y_axes.cpp@@ -71,7 +71,7 @@ size_t GetTileWidth(const permute_params& params) {if (std::any_of(supported.begin(), supported.end(), [halved](size_t s) { return s == halved; }) || supported.empty())min_divisor = halved;}- if (input_type == Datatype::F16) {+ if (input_type == Datatype::F16 || input_type == Datatype::BF16) {min_divisor = min_divisor * 2;}if (input_type == Datatype::INT8 || input_type == Datatype::UINT8) {@@ -93,12 +93,14 @@ size_t GetTileSize(const permute_params& params) {ParamsKey PermuteKernel_f_y_axes::GetSupportedKey() const {ParamsKey k;k.EnableInputDataType(Datatype::F16);+ k.EnableInputDataType(Datatype::BF16);k.EnableInputDataType(Datatype::F32);k.EnableInputDataType(Datatype::INT8);k.EnableInputDataType(Datatype::UINT8);k.EnableInputDataType(Datatype::INT32);k.EnableInputDataType(Datatype::INT64);k.EnableOutputDataType(Datatype::F16);+ k.EnableOutputDataType(Datatype::BF16);k.EnableOutputDataType(Datatype::F32);k.EnableOutputDataType(Datatype::INT8);k.EnableOutputDataType(Datatype::UINT8);diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_ref.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_ref.cppindex 63a2f35b82c..9572cf392d4 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_ref.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_ref.cpp@@ -107,6 +107,7 @@ ParamsKey PermuteKernelRef::GetSupportedKey() const {k.EnableInputDataType(Datatype::INT32);k.EnableInputDataType(Datatype::INT64);k.EnableOutputDataType(Datatype::F16);+ k.EnableOutputDataType(Datatype::BF16);k.EnableOutputDataType(Datatype::F32);k.EnableOutputDataType(Datatype::INT8);k.EnableOutputDataType(Datatype::UINT8);diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4.cppindex e2ec1b27058..4be24c45d82 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4.cpp@@ -18,12 +18,14 @@ namespace kernel_selector {ParamsKey PermuteKernel_tile_8x8_4x4::GetSupportedKey() const {ParamsKey k;k.EnableInputDataType(Datatype::F16);+ k.EnableInputDataType(Datatype::BF16);k.EnableInputDataType(Datatype::F32);k.EnableInputDataType(Datatype::INT8);k.EnableInputDataType(Datatype::UINT8);k.EnableInputDataType(Datatype::INT32);k.EnableInputDataType(Datatype::INT64);k.EnableOutputDataType(Datatype::F16);+ k.EnableOutputDataType(Datatype::BF16);k.EnableOutputDataType(Datatype::F32);k.EnableOutputDataType(Datatype::INT8);k.EnableOutputDataType(Datatype::UINT8);diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4_fsv.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4_fsv.cppindex 2a6825d57f0..f08cdb53515 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4_fsv.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_tile_8x8_4x4_fsv.cpp@@ -18,12 +18,14 @@ namespace kernel_selector {ParamsKey PermuteKernel_tile_8x8_4x4_fsv::GetSupportedKey() const {ParamsKey k;k.EnableInputDataType(Datatype::F16);+ k.EnableInputDataType(Datatype::BF16);k.EnableInputDataType(Datatype::F32);k.EnableInputDataType(Datatype::INT8);k.EnableInputDataType(Datatype::UINT8);k.EnableInputDataType(Datatype::INT32);k.EnableInputDataType(Datatype::INT64);k.EnableOutputDataType(Datatype::F16);+ k.EnableOutputDataType(Datatype::BF16);k.EnableOutputDataType(Datatype::F32);k.EnableOutputDataType(Datatype::INT8);k.EnableOutputDataType(Datatype::UINT8);diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_xy_swap.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_xy_swap.cppindex 2ed18f42f00..7f16a522e01 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_xy_swap.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_xy_swap.cpp@@ -72,11 +72,13 @@ bool IsXYSwapOrder(const std::vector<uint16_t>& order) {ParamsKey PermuteKernel_xy_swap::GetSupportedKey() const {ParamsKey k;k.EnableInputDataType(Datatype::F16);+ k.EnableInputDataType(Datatype::BF16);k.EnableInputDataType(Datatype::F32);k.EnableInputDataType(Datatype::INT8);k.EnableInputDataType(Datatype::UINT8);k.EnableInputDataType(Datatype::INT32);k.EnableOutputDataType(Datatype::F16);+ k.EnableOutputDataType(Datatype::BF16);k.EnableOutputDataType(Datatype::F32);k.EnableOutputDataType(Datatype::INT8);k.EnableOutputDataType(Datatype::UINT8);diff --git a/src/plugins/intel_gpu/tests/unit/fusions/permute_fusion_test.cpp b/src/plugins/intel_gpu/tests/unit/fusions/permute_fusion_test.cppindex 18940f0af1c..a483401a0a6 100644--- a/src/plugins/intel_gpu/tests/unit/fusions/permute_fusion_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/fusions/permute_fusion_test.cpp@@ -121,6 +121,14 @@ public:#define CASE_PERMUTE_F16_5 { 1, 15, 1, 2 }, { 15, 2, 1, 1 }, { 1, 2, 0, 3 }, tensor{ 0 }, data_types::f16, format::bfyx, data_types::f32, format::bfyx#define CASE_PERMUTE_F16_6 { 1, 15, 4, 4 }, { 4, 4, 1, 15 }, { 3, 2, 1, 0 }, tensor{ 0 }, data_types::f16, format::bfyx, data_types::f32, format::bfyx+#define CASE_PERMUTE_BF16_0 { 1, 16, 4, 5 }, { 1, 16, 4, 5 }, { 0, 1, 2, 3 }, tensor{ 0 }, data_types::bf16, format::b_fs_yx_fsv16, data_types::f32, format::bfyx+#define CASE_PERMUTE_BF16_1 { 2, 16, 4, 5 }, { 16, 4, 5, 2 }, { 1, 3, 0, 2 }, tensor{ 0 }, data_types::bf16, format::b_fs_yx_fsv16, data_types::f32, format::bfyx+#define CASE_PERMUTE_BF16_2 { 1, 32, 2, 3 }, { 2, 3, 32, 1 }, { 3, 2, 0, 1 }, tensor{ 0 }, data_types::bf16, format::b_fs_yx_fsv16, data_types::f32, format::bfyx+#define CASE_PERMUTE_BF16_3 { 3, 16, 1, 1 }, { 1, 1, 16, 3 }, { 2, 3, 0, 1 }, tensor{ 0 }, data_types::bf16, format::b_fs_yx_fsv16, data_types::f32, format::bfyx+#define CASE_PERMUTE_BF16_4 { 2, 15, 4, 5 }, { 4, 2, 5, 15 }, { 3, 0, 1, 2 }, tensor{ 0 }, data_types::bf16, format::bfyx, data_types::f32, format::bfyx+#define CASE_PERMUTE_BF16_5 { 1, 15, 1, 2 }, { 15, 2, 1, 1 }, { 1, 2, 0, 3 }, tensor{ 0 }, data_types::bf16, format::bfyx, data_types::f32, format::bfyx+#define CASE_PERMUTE_BF16_6 { 1, 15, 4, 4 }, { 4, 4, 1, 15 }, { 3, 2, 1, 0 }, tensor{ 0 }, data_types::bf16, format::bfyx, data_types::f32, format::bfyx+#define CASE_PERMUTE_S8_0 { 1, 15, 4, 5 }, { 1, 15, 4, 5 }, { 0, 1, 2, 3 }, tensor{ 0 }, data_types::i8, format::bfyx, data_types::f32, format::bfyx#define CASE_PERMUTE_S8_1 { 1, 15, 4, 5 }, { 5, 4, 15, 1 }, { 2, 3, 0, 1 }, tensor{ 0 }, data_types::i8, format::bfyx, data_types::f32, format::bfyx#define CASE_PERMUTE_S8_2 { 1, 16, 1, 2 }, { 1, 1, 16, 2 }, { 3, 0, 2, 1 }, tensor{ 0 }, data_types::i8, format::b_fs_yx_fsv16, data_types::f32, format::bfyx@@ -143,6 +151,12 @@ public:#define CASE_PERMUTE_F16_3D_3 { 1, 32, 4, 2, 1 }, { 2, 32, 4, 1, 1 }, { 3, 1, 0, 2, 4 }, tensor{ 0 }, data_types::f16, format::bfzyx, data_types::f32, format::bfzyx#define CASE_PERMUTE_F16_3D_4 { 16, 16, 1, 1, 1 },{ 1, 16, 1, 1, 16 },{ 2, 0, 1, 4, 3 }, tensor{ 0 }, data_types::f16, format::bfzyx, data_types::f32, format::bfzyx+#define CASE_PERMUTE_BF16_3D_0 { 1, 15, 4, 4, 5 }, { 1, 15, 4, 4, 5 }, { 0, 1, 2, 3, 4 }, tensor{ 0 }, data_types::bf16, format::bfzyx, data_types::f32, format::bfzyx+#define CASE_PERMUTE_BF16_3D_1 { 2, 15, 4, 3, 4 }, { 4, 4, 2, 15, 3 }, { 4, 2, 3, 1, 0 }, tensor{ 0 }, data_types::bf16, format::bfzyx, data_types::f32, format::bfzyx+#define CASE_PERMUTE_BF16_3D_2 { 2, 16, 4, 4, 3 }, { 2, 4, 3, 16, 4 }, { 0, 3, 4, 1, 2 }, tensor{ 0 }, data_types::bf16, format::bfzyx, data_types::f32, format::bfzyx+#define CASE_PERMUTE_BF16_3D_3 { 1, 32, 4, 2, 1 }, { 2, 32, 4, 1, 1 }, { 3, 1, 0, 2, 4 }, tensor{ 0 }, data_types::bf16, format::bfzyx, data_types::f32, format::bfzyx+#define CASE_PERMUTE_BF16_3D_4 { 16, 16, 1, 1, 1 },{ 1, 16, 1, 1, 16 },{ 2, 0, 1, 4, 3 }, tensor{ 0 }, data_types::bf16, format::bfzyx, data_types::f32, format::bfzyx+#define CASE_PERMUTE_S8_3D_0 { 1, 15, 4, 4, 5 }, { 1, 15, 4, 4, 5 }, { 0, 1, 2, 3, 4 }, tensor{ 0 }, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx#define CASE_PERMUTE_S8_3D_1 { 2, 15, 4, 3, 4 }, { 4, 4, 15, 2, 3 }, { 2, 4, 3, 0, 1 }, tensor{ 0 }, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx#define CASE_PERMUTE_S8_3D_2 { 2, 16, 4, 4, 3 }, { 2, 4, 3, 16, 4 }, { 0, 3, 4, 1, 2 }, tensor{ 0 }, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx@@ -200,6 +214,8 @@ public:#define CASE_PERMUTE_XY_SWAP_F32_2 { 2, 4, 32, 16 }, { 2, 4, 16, 32 }, { 0, 1, 3, 2 }, tensor{ 0 }, data_types::f32, format::bfyx, data_types::f32, format::bfyx#define CASE_PERMUTE_XY_SWAP_F16_0 { 1, 8, 16, 16 }, { 1, 8, 16, 16 }, { 0, 1, 3, 2 }, tensor{ 0 }, data_types::f16, format::bfyx, data_types::f32, format::bfyx#define CASE_PERMUTE_XY_SWAP_F16_1 { 1, 4, 32, 32 }, { 1, 4, 32, 32 }, { 0, 1, 3, 2 }, tensor{ 0 }, data_types::f16, format::bfyx, data_types::f32, format::bfyx+#define CASE_PERMUTE_XY_SWAP_BF16_0 { 1, 8, 16, 16 }, { 1, 8, 16, 16 }, { 0, 1, 3, 2 }, tensor{ 0 }, data_types::bf16, format::bfyx, data_types::f32, format::bfyx+#define CASE_PERMUTE_XY_SWAP_BF16_1 { 1, 4, 32, 32 }, { 1, 4, 32, 32 }, { 0, 1, 3, 2 }, tensor{ 0 }, data_types::bf16, format::bfyx, data_types::f32, format::bfyx#define CASE_PERMUTE_XY_SWAP_S8_0 { 1, 8, 16, 16 }, { 1, 8, 16, 16 }, { 0, 1, 3, 2 }, tensor{ 0 }, data_types::i8, format::bfyx, data_types::f32, format::bfyx#define CASE_PERMUTE_XY_SWAP_U8_0 { 1, 8, 16, 16 }, { 1, 8, 16, 16 }, { 0, 1, 3, 2 }, tensor{ 0 }, data_types::u8, format::bfyx, data_types::f32, format::bfyx@@ -240,6 +256,14 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_activation_scale_eltwise, ::testinpermute_params{ CASE_PERMUTE_F16_5, 2, 5 },permute_params{ CASE_PERMUTE_F16_6, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_0, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_1, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_2, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_3, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_4, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_5, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_6, 2, 5 },+permute_params{ CASE_PERMUTE_S8_0, 2, 5 },permute_params{ CASE_PERMUTE_S8_1, 2, 5 },permute_params{ CASE_PERMUTE_S8_2, 2, 5 },@@ -262,6 +286,12 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_activation_scale_eltwise, ::testinpermute_params{ CASE_PERMUTE_F16_3D_3, 2, 5 },permute_params{ CASE_PERMUTE_F16_3D_4, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_3D_0, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_3D_1, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_3D_2, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_3D_3, 2, 5 },+ permute_params{ CASE_PERMUTE_BF16_3D_4, 2, 5 },+permute_params{ CASE_PERMUTE_S8_3D_0, 2, 5 },permute_params{ CASE_PERMUTE_S8_3D_1, 2, 5 },permute_params{ CASE_PERMUTE_S8_3D_2, 2, 5 },@@ -315,6 +345,8 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_activation_scale_eltwise, ::testinpermute_params{ CASE_PERMUTE_XY_SWAP_F32_2, 2, 5 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_0, 2, 5 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_1, 2, 5 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_0, 2, 5 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_1, 2, 5 },permute_params{ CASE_PERMUTE_XY_SWAP_S8_0, 2, 5 },permute_params{ CASE_PERMUTE_XY_SWAP_U8_0, 2, 5 }}));@@ -345,6 +377,8 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_quant_u8, ::testing::ValuesIn(std:permute_params{ CASE_PERMUTE_F16_0, 2, 3 },permute_params{ CASE_PERMUTE_F16_1, 2, 3 },permute_params{ CASE_PERMUTE_F32_8, 2, 3 },+ permute_params{ CASE_PERMUTE_BF16_0, 2, 3 },+ permute_params{ CASE_PERMUTE_BF16_1, 2, 3 },// Fusing tests for permute_xy_swap.// Note: this suite quantizes the permute output directly to u8; there is no@@ -355,6 +389,8 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_quant_u8, ::testing::ValuesIn(std:permute_params{ CASE_PERMUTE_XY_SWAP_F32_2, 2, 3 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_0, 2, 3 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_1, 2, 3 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_0, 2, 3 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_1, 2, 3 },}));class permute_scale_actv_eltw_scale_actv_quant_i8: public PermuteFusingTest {};@@ -402,6 +438,14 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_actv_eltw_scale_actv_quant_ipermute_params{ CASE_PERMUTE_F16_5, 2, 8 },permute_params{ CASE_PERMUTE_F16_6, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_0, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_1, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_2, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_3, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_4, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_5, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_6, 2, 8 },+permute_params{ CASE_PERMUTE_S8_0, 2, 8 },permute_params{ CASE_PERMUTE_S8_1, 2, 8 },permute_params{ CASE_PERMUTE_S8_2, 2, 8 },@@ -424,6 +468,12 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_actv_eltw_scale_actv_quant_ipermute_params{ CASE_PERMUTE_F16_3D_3, 2, 8 },permute_params{ CASE_PERMUTE_F16_3D_4, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_3D_0, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_3D_1, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_3D_2, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_3D_3, 2, 8 },+ permute_params{ CASE_PERMUTE_BF16_3D_4, 2, 8 },+permute_params{ CASE_PERMUTE_S8_3D_0, 2, 8 },permute_params{ CASE_PERMUTE_S8_3D_1, 2, 8 },permute_params{ CASE_PERMUTE_S8_3D_2, 2, 8 },@@ -440,6 +490,8 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_actv_eltw_scale_actv_quant_ipermute_params{ CASE_PERMUTE_XY_SWAP_F32_2, 2, 8 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_0, 2, 8 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_1, 2, 8 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_0, 2, 8 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_1, 2, 8 },permute_params{ CASE_PERMUTE_XY_SWAP_S8_0, 2, 8 },permute_params{ CASE_PERMUTE_XY_SWAP_U8_0, 2, 8 },}));@@ -484,6 +536,14 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_eltwise_actv_scale_actv, ::tpermute_params{ CASE_PERMUTE_F16_5, 2, 7 },permute_params{ CASE_PERMUTE_F16_6, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_0, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_1, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_2, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_3, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_4, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_5, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_6, 2, 7 },+permute_params{ CASE_PERMUTE_S8_0, 2, 7 },permute_params{ CASE_PERMUTE_S8_1, 2, 7 },permute_params{ CASE_PERMUTE_S8_2, 2, 7 },@@ -506,6 +566,12 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_eltwise_actv_scale_actv, ::tpermute_params{ CASE_PERMUTE_F16_3D_3, 2, 7 },permute_params{ CASE_PERMUTE_F16_3D_4, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_3D_0, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_3D_1, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_3D_2, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_3D_3, 2, 7 },+ permute_params{ CASE_PERMUTE_BF16_3D_4, 2, 7 },+permute_params{ CASE_PERMUTE_S8_3D_0, 2, 7 },permute_params{ CASE_PERMUTE_S8_3D_1, 2, 7 },permute_params{ CASE_PERMUTE_S8_3D_2, 2, 7 },@@ -552,6 +618,8 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_eltwise_actv_scale_actv, ::tpermute_params{ CASE_PERMUTE_XY_SWAP_F32_2, 2, 7 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_0, 2, 7 },permute_params{ CASE_PERMUTE_XY_SWAP_F16_1, 2, 7 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_0, 2, 7 },+ permute_params{ CASE_PERMUTE_XY_SWAP_BF16_1, 2, 7 },permute_params{ CASE_PERMUTE_XY_SWAP_S8_0, 2, 7 },permute_params{ CASE_PERMUTE_XY_SWAP_U8_0, 2, 7 },}));@@ -568,12 +636,18 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_eltwise_actv_scale_actv, ::t#define CASE_PERMUTE_REORDER_F16_1 { 1, 16, 4, 5, 16 }, { 0, 2, 1, 3, 4 }, { 0, 1, 2, 3, 4 }, data_types::f16, data_types::f16, format::b_fs_zyx_fsv16, format::bfzyx#define CASE_PERMUTE_REORDER_F16_2 { 1, 5, 1, 2, 14 }, { 0, 3, 2, 1, 4 }, { 0, 3, 2, 1, 4 }, data_types::f16, data_types::f16, format::b_fs_zyx_fsv16, format::bfzyx#define CASE_PERMUTE_REORDER_F16_3 { 1, 16, 2, 4 }, { 0, 2, 1, 3 }, { 0, 2, 1, 3 }, data_types::f16, data_types::f16, format::bfyx, format::b_fs_yx_fsv16+#define CASE_PERMUTE_REORDER_BF16_0 { 1, 16, 2, 4 }, { 0, 2, 1, 3 }, { 0, 2, 1, 3 }, data_types::bf16, data_types::bf16, format::b_fs_yx_fsv16, format::bfyx+#define CASE_PERMUTE_REORDER_BF16_1 { 1, 16, 4, 5, 16 }, { 0, 2, 1, 3, 4 }, { 0, 1, 2, 3, 4 }, data_types::bf16, data_types::bf16, format::b_fs_zyx_fsv16, format::bfzyx+#define CASE_PERMUTE_REORDER_BF16_2 { 1, 5, 1, 2, 14 }, { 0, 3, 2, 1, 4 }, { 0, 3, 2, 1, 4 }, data_types::bf16, data_types::bf16, format::b_fs_zyx_fsv16, format::bfzyx+#define CASE_PERMUTE_REORDER_BF16_3 { 1, 16, 2, 4 }, { 0, 2, 1, 3 }, { 0, 2, 1, 3 }, data_types::bf16, data_types::bf16, format::bfyx, format::b_fs_yx_fsv16// type change#define CASE_PERMUTE_REORDER_S8_TO_F32_0 { 1, 15, 4, 5 }, { 0, 2, 1, 3 }, { 0, 2, 1, 3 }, data_types::i8, data_types::f32, format::b_fs_yx_fsv4, format::bfyx#define CASE_PERMUTE_REORDER_S8_TO_F32_1 { 1, 2, 15, 4, 5 }, { 0, 3, 2, 1, 4 }, { 0, 3, 2, 1, 4 }, data_types::i8, data_types::f32, format::b_fs_zyx_fsv16, format::bfzyx#define CASE_PERMUTE_REORDER_F32_TO_F16_0 { 1, 5, 1, 2, 14 }, { 0, 2, 1, 3, 4 }, { 0, 1, 2, 3, 4 }, data_types::f32, data_types::f16, format::b_fs_zyx_fsv16, format::bfzyx#define CASE_PERMUTE_REORDER_U8_TO_F16_0 { 1, 17, 1, 2, 7 }, { 0, 2, 1, 3, 4 }, { 0, 1, 2, 3, 4 }, data_types::u8, data_types::f16, format::b_fs_zyx_fsv16, format::bfzyx+#define CASE_PERMUTE_REORDER_F32_TO_BF16_0 { 1, 5, 1, 2, 14 }, { 0, 2, 1, 3, 4 }, { 0, 1, 2, 3, 4 }, data_types::f32, data_types::bf16, format::b_fs_zyx_fsv16, format::bfzyx+#define CASE_PERMUTE_REORDER_U8_TO_BF16_0 { 1, 17, 1, 2, 7 }, { 0, 2, 1, 3, 4 }, { 0, 1, 2, 3, 4 }, data_types::u8, data_types::bf16, format::b_fs_zyx_fsv16, format::bfzyx// dim change#define CASE_PERMUTE_REORDER_4D_TO_5D_F32_0 { 1, 16, 8, 16 }, { 1, 3, 2, 0 }, { 0, 3, 4, 2, 1 }, data_types::f32, data_types::f32, format::bfyx, format::bfzyx@@ -607,6 +681,16 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_scale_eltwise_actv_scale_actv, ::t#define CASE_PERMUTE_REORDER_TILED_F16_11 { 1, 32, 3, 253 }, { 0, 2, 3, 1 }, { 0, 5, 1, 4, 2, 3 }, data_types::f16, data_types::f32, format::bfyx, format::bfwzyx#define CASE_PERMUTE_REORDER_TILED_F16_12 { 1, 768, 32, 32 }, { 0, 2, 3, 1 }, { 0, 4, 1, 3, 2}, data_types::f16, data_types::f32, format::bfyx, format::bfzyx+// bf16 variants of permute opt reorder cases+#define CASE_PERMUTE_REORDER_TILED_BF16_5 { 1, 48, 3, 256 }, { 0, 2, 3, 1 }, { 0, 4, 1, 3, 2 }, data_types::bf16, data_types::f32, format::b_fs_yx_fsv16, format::bfzyx+#define CASE_PERMUTE_REORDER_TILED_BF16_6 { 1, 48, 2, 3, 256 }, { 0, 2, 3, 4, 1 }, { 0, 5, 1, 4, 3, 2 }, data_types::bf16, data_types::f32, format::b_fs_zyx_fsv16, format::bfwzyx+#define CASE_PERMUTE_REORDER_TILED_BF16_7 { 1, 48, 2, 3, 256 }, { 0, 2, 3, 4, 1 }, { 0, 3, 1, 2 }, data_types::bf16, data_types::f32, format::bfzyx, format::bfyx+#define CASE_PERMUTE_REORDER_TILED_BF16_8 { 1, 28, 2, 2, 3, 256 }, { 0, 2, 3, 4, 5, 1 }, { 0, 3, 1, 2 }, data_types::bf16, data_types::f32, format::bfwzyx, format::bfyx+#define CASE_PERMUTE_REORDER_TILED_BF16_9 { 1, 24, 2, 3, 256 }, { 0, 2, 3, 4, 1 }, { 0, 3, 1, 2 }, data_types::bf16, data_types::f32, format::bfzyx, format::bfyx+#define CASE_PERMUTE_REORDER_TILED_BF16_10 { 1, 35, 3, 253 }, { 0, 2, 3, 1 }, { 0, 4, 1, 3, 2 }, data_types::bf16, data_types::f32, format::bfyx, format::bfzyx+#define CASE_PERMUTE_REORDER_TILED_BF16_11 { 1, 32, 3, 253 }, { 0, 2, 3, 1 }, { 0, 5, 1, 4, 2, 3 }, data_types::bf16, data_types::f32, format::bfyx, format::bfwzyx+#define CASE_PERMUTE_REORDER_TILED_BF16_12 { 1, 768, 32, 32 }, { 0, 2, 3, 1 }, { 0, 4, 1, 3, 2}, data_types::bf16, data_types::f32, format::bfyx, format::bfzyx+class permute_redundant_reorder : public PermuteReorderFusingTest {};TEST_P(permute_redundant_reorder, basic) {auto p = GetParam();@@ -628,10 +712,15 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_redundant_reorder, ::testing::Valupermute_reorder_params{ CASE_PERMUTE_REORDER_F16_0, 4, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_F16_1, 4, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_F16_2, 4, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_BF16_0, 4, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_BF16_1, 4, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_BF16_2, 4, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_S8_TO_F32_0, 4, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_S8_TO_F32_1, 4, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_F32_TO_F16_0, 4, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_U8_TO_F16_0, 4, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_F32_TO_BF16_0, 4, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_U8_TO_BF16_0, 4, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_4D_TO_5D_F32_0, 3, 3 },permute_reorder_params{ CASE_PERMUTE_REORDER_4D_TO_6D_F32_1, 3, 3 },permute_reorder_params{ CASE_PERMUTE_REORDER_5D_TO_4D_F32_0, 4, 4 },@@ -652,6 +741,13 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_redundant_reorder, ::testing::Valupermute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_9, 3, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_10, 3, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_11, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_5, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_6, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_7, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_8, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_9, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_10, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_11, 3, 4 },}));class permute_redundant_reorder_dynamic : public PermuteReorderFusingTest {};@@ -674,6 +770,7 @@ TEST_P(permute_redundant_reorder_dynamic, basic) {INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_redundant_reorder_dynamic, ::testing::ValuesIn(std::vector<permute_reorder_params>{permute_reorder_params{ CASE_PERMUTE_REORDER_F32_3, 3, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_F16_3, 3, 4 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_BF16_3, 3, 4 },}));class permute_act_reorder : public PermuteReorderFusingTest {};@@ -699,6 +796,9 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_act_reorder, ::testing::ValuesIn(spermute_reorder_params{ CASE_PERMUTE_REORDER_F16_0, 4, 5 },permute_reorder_params{ CASE_PERMUTE_REORDER_F16_1, 4, 5 },permute_reorder_params{ CASE_PERMUTE_REORDER_F16_2, 4, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_BF16_0, 4, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_BF16_1, 4, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_BF16_2, 4, 5 },permute_reorder_params{ CASE_PERMUTE_REORDER_4D_TO_5D_F32_0, 3, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_4D_TO_6D_F32_1, 3, 4 },permute_reorder_params{ CASE_PERMUTE_REORDER_5D_TO_4D_F32_0, 4, 5 },@@ -717,6 +817,13 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_act_reorder, ::testing::ValuesIn(spermute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_9, 3, 5 },permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_10, 3, 5 },permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_11, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_5, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_6, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_7, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_8, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_9, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_10, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_11, 3, 5 },}));class permute_eltwise_reorder : public PermuteReorderFusingTest {};@@ -744,4 +851,10 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, permute_eltwise_reorder, ::testing::Valuespermute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_10, 3, 5 },permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_11, 3, 5 },permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_F16_12, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_7, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_8, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_9, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_10, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_11, 3, 5 },+ permute_reorder_params{ CASE_PERMUTE_REORDER_TILED_BF16_12, 3, 5 },}));diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/permute_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/permute_gpu_test.cppindex 58e0fcf305f..17ca4be84e4 100644--- a/src/plugins/intel_gpu/tests/unit/test_cases/permute_gpu_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/test_cases/permute_gpu_test.cpp@@ -1895,6 +1895,12 @@ void TiledPermuteTest::compare_value(ov::float16 a, ov::float16 b) const {ASSERT_FLOAT_EQ(static_cast<float>(a), static_cast<float>(b));}+// bf16 format+template<>+void TiledPermuteTest::compare_value(ov::bfloat16 a, ov::bfloat16 b) const {+ ASSERT_FLOAT_EQ(static_cast<float>(a), static_cast<float>(b));+}+template<>void TiledPermuteTest::set_random_values<int8_t>(const cldnn::memory::ptr mem) const {// tests::set_random_values<int8_t>() is not supported@@ -1906,6 +1912,17 @@ void TiledPermuteTest::set_random_values<int8_t>(const cldnn::memory::ptr mem) c}}+template<>+void TiledPermuteTest::set_random_values<ov::bfloat16>(const cldnn::memory::ptr mem) const {+ // tests::set_random_values<ov::bfloat16>() is not supported+ std::mt19937 gen;+ static std::uniform_real_distribution<float> urd(std::numeric_limits<ov::bfloat16>::lowest(), std::numeric_limits<ov::bfloat16>::max());+ cldnn::mem_lock<ov::bfloat16> ptr(mem, get_test_stream());+ for (auto it = ptr.begin(); it != ptr.end(); ++it) {+ *it = static_cast<ov::bfloat16>(urd(gen));+ }+}+template<data_types Data_Type>void TiledPermuteTest::run_test(const std::vector<ov::Dimension::value_type>& sizes, cldnn::format format_fsv,const std::string & permute_opt, std::vector<uint16_t> permute_order, bool is_caching_test)@@ -2025,6 +2042,11 @@ TEST_P(permute_tile_fsv_4d, f16) {run_test<cldnn::data_types::f16>(p.sizes, p.format_fsv);}+TEST_P(permute_tile_fsv_4d, bf16) {+ auto p = GetParam();+ run_test<cldnn::data_types::bf16>(p.sizes, p.format_fsv);+}+TEST_P(permute_tile_fsv_4d, f32) {auto p = GetParam();run_test<cldnn::data_types::f32>(p.sizes, p.format_fsv);@@ -2085,6 +2107,11 @@ TEST_P(permute_tile_fsv_5d, f16) {run_test<cldnn::data_types::f16>(p.sizes, p.format_fsv);}+TEST_P(permute_tile_fsv_5d, bf16) {+ auto p = GetParam();+ run_test<cldnn::data_types::bf16>(p.sizes, p.format_fsv);+}+TEST_P(permute_tile_fsv_5d, f32) {auto p = GetParam();run_test<cldnn::data_types::f32>(p.sizes, p.format_fsv);@@ -2277,6 +2304,11 @@ TEST_P(permute_tile_fsv_4d, f16_cached) {run_test<cldnn::data_types::f16>(p.sizes, p.format_fsv, "permute_tile_8x8_4x4_fsv", {}, true);}+TEST_P(permute_tile_fsv_4d, bf16_cached) {+ auto p = GetParam();+ run_test<cldnn::data_types::bf16>(p.sizes, p.format_fsv, "permute_tile_8x8_4x4_fsv", {}, true);+}+TEST_P(permute_tile_fsv_4d, f32_cached) {auto p = GetParam();run_test<cldnn::data_types::f32>(p.sizes, p.format_fsv, "permute_tile_8x8_4x4_fsv", {}, true);@@ -2302,6 +2334,11 @@ TEST_P(permute_tile_fsv_5d, f16_cached) {run_test<cldnn::data_types::f16>(p.sizes, p.format_fsv, "permute_tile_8x8_4x4_fsv", {}, true);}+TEST_P(permute_tile_fsv_5d, bf16_cached) {+ auto p = GetParam();+ run_test<cldnn::data_types::bf16>(p.sizes, p.format_fsv, "permute_tile_8x8_4x4_fsv", {}, true);+}+TEST_P(permute_tile_fsv_5d, f32_cached) {auto p = GetParam();run_test<cldnn::data_types::f32>(p.sizes, p.format_fsv, "permute_tile_8x8_4x4_fsv", {}, true);@@ -2368,6 +2405,7 @@ TEST_P(permute_f_y_axes_tile, combined) {auto p = GetParam();run_test<cldnn::data_types::f32>(p.sizes, p.format_fsv, "permute_f_y_axes", {0, 2, 1, 3});run_test<cldnn::data_types::f16>(p.sizes, p.format_fsv, "permute_f_y_axes", {0, 2, 1, 3});+ run_test<cldnn::data_types::bf16>(p.sizes, p.format_fsv, "permute_f_y_axes", {0, 2, 1, 3});run_test<cldnn::data_types::u8>(p.sizes, p.format_fsv, "permute_f_y_axes", {0, 2, 1, 3});run_test<cldnn::data_types::i8>(p.sizes, p.format_fsv, "permute_f_y_axes", {0, 2, 1, 3});run_test<cldnn::data_types::i32>(p.sizes, p.format_fsv, "permute_f_y_axes", {0, 2, 1, 3});@@ -2415,6 +2453,7 @@ TEST_P(permute_xy_swap, combined) {auto p = GetParam();run_test<cldnn::data_types::f32>(p.sizes, p.format_fsv, "permute_xy_swap", {0, 1, 3, 2});run_test<cldnn::data_types::f16>(p.sizes, p.format_fsv, "permute_xy_swap", {0, 1, 3, 2});+ run_test<cldnn::data_types::bf16>(p.sizes, p.format_fsv, "permute_xy_swap", {0, 1, 3, 2});run_test<cldnn::data_types::u8>(p.sizes, p.format_fsv, "permute_xy_swap", {0, 1, 3, 2});run_test<cldnn::data_types::i8>(p.sizes, p.format_fsv, "permute_xy_swap", {0, 1, 3, 2});run_test<cldnn::data_types::i32>(p.sizes, p.format_fsv, "permute_xy_swap", {0, 1, 3, 2});