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] Fix Kokoro TTS FP16 silent / NaN audio output (#36064)
Andrew Kwangwoong Park1e4690cd7527
diff --git a/src/plugins/intel_gpu/include/intel_gpu/op/atan2.hpp b/src/plugins/intel_gpu/include/intel_gpu/op/atan2.hppnew file mode 100644index 00000000000..1bedb3a7b3b--- /dev/null+++ b/src/plugins/intel_gpu/include/intel_gpu/op/atan2.hpp@@ -0,0 +1,25 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "openvino/op/op.hpp"++namespace ov::intel_gpu::op {++// Two-input atan2(y, x). input0 = y, input1 = x. Inserted by FuseAtan2Decomposed+// in place of the frontend's atan2 decomposition; lowered to cldnn::eltwise with+// eltwise_mode::atan2 by ops/atan2.cpp.+class Atan2 : public ov::op::Op {+public:+ OPENVINO_OP("Atan2", "ie_internal_opset");++ Atan2() = default;+ Atan2(const ov::Output<Node>& y, const ov::Output<Node>& x);++ void validate_and_infer_types() override;+ std::shared_ptr<Node> clone_with_new_inputs(const ov::OutputVector& new_args) const override;+};++} // namespace ov::intel_gpu::opdiff --git a/src/plugins/intel_gpu/include/intel_gpu/plugin/primitives_list.hpp b/src/plugins/intel_gpu/include/intel_gpu/plugin/primitives_list.hppindex f4add868b65..208e4c7af7d 100644--- a/src/plugins/intel_gpu/include/intel_gpu/plugin/primitives_list.hpp+++ b/src/plugins/intel_gpu/include/intel_gpu/plugin/primitives_list.hpp@@ -324,3 +324,4 @@ REGISTER_FACTORY(internal, MOECompressed);REGISTER_FACTORY(internal, GatedDeltaNet);REGISTER_FACTORY(internal, PagedCausalConv1D);REGISTER_FACTORY(internal, GatherMatmulCompressed);+REGISTER_FACTORY(internal, Atan2);diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/eltwise.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/eltwise.hppindex bb527198c2c..0347bbca890 100644--- a/src/plugins/intel_gpu/include/intel_gpu/primitives/eltwise.hpp+++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/eltwise.hpp@@ -63,7 +63,9 @@ enum class eltwise_mode : int32_t {/// @brief Eltwise bitwise or.bitwise_or,/// @brief Eltwise bitwise xor.- bitwise_xor+ bitwise_xor,+ /// @brief Eltwise atan2(y, x). Two-input. fp16/fp32 only.+ atan2};/// @brief Performs elementwise operations (sum, subtract, max or product) on two input primitivesdiff --git a/src/plugins/intel_gpu/src/graph/eltwise.cpp b/src/plugins/intel_gpu/src/graph/eltwise.cppindex 14c730fabdf..f49c4e3027c 100644--- a/src/plugins/intel_gpu/src/graph/eltwise.cpp+++ b/src/plugins/intel_gpu/src/graph/eltwise.cpp@@ -332,6 +332,9 @@ std::string eltwise_inst::to_string(eltwise_node const& node) {case eltwise_mode::bitwise_xor:str_mode = "bitwise_xor";break;+ case eltwise_mode::atan2:+ str_mode = "atan2";+ break;default:str_mode = "not supported mode";break;@@ -453,6 +456,7 @@ void eltwise_inst::check_inputs_count(eltwise_node const& node) {case eltwise_mode::bitwise_and:case eltwise_mode::bitwise_or:case eltwise_mode::bitwise_xor:+ case eltwise_mode::atan2:OPENVINO_ASSERT(inputs_number == 2,"Node id: ", node.id(), ". Invalid eltwise inputs number (should be equal to 2). Actual: ", inputs_number);break;diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.h b/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.hindex c72afd411c4..b7c5883fc1c 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.h+++ b/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.h@@ -213,6 +213,8 @@ inline kernel_selector::eltwise_mode convert_to_eltwise_mode(eltwise_mode mode)return kernel_selector::eltwise_mode::BITWISE_OR;case eltwise_mode::bitwise_xor:return kernel_selector::eltwise_mode::BITWISE_XOR;+ case eltwise_mode::atan2:+ return kernel_selector::eltwise_mode::ATAN2;default:OPENVINO_ASSERT(false, "Unsupported eltwise mode!");return kernel_selector::eltwise_mode::ADD;diff --git a/src/plugins/intel_gpu/src/kernel_selector/common_types.h b/src/plugins/intel_gpu/src/kernel_selector/common_types.hindex 2b5051fedd3..0f0c11712f3 100644--- a/src/plugins/intel_gpu/src/kernel_selector/common_types.h+++ b/src/plugins/intel_gpu/src/kernel_selector/common_types.h@@ -321,7 +321,8 @@ enum class EltwiseMode {LEFT_SHIFT,BITWISE_AND,BITWISE_OR,- BITWISE_XOR+ BITWISE_XOR,+ ATAN2};////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cppindex a4879063db3..4d5d9e8a000 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_common.cpp@@ -209,6 +209,7 @@ std::string toString(EltwiseMode b_mode) {case EltwiseMode::SQRT: return "SQRT";case EltwiseMode::RSQRT: return "RSQRT";case EltwiseMode::ASSIGN: return "ASSIGN";+ case EltwiseMode::ATAN2: return "ATAN2";default: return "";}}diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_base.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_base.cppindex 9db1f21942b..e526c60ba6d 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_base.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_base.cpp@@ -54,6 +54,7 @@ uint32_t GetNumberOfInputs(EltwiseMode m) {case EltwiseMode::BITWISE_AND:case EltwiseMode::BITWISE_OR:case EltwiseMode::BITWISE_XOR:+ case EltwiseMode::ATAN2:return 2;case EltwiseMode::SQRT:case EltwiseMode::RSQRT:@@ -271,6 +272,10 @@ JitConstants EltwiseKernelBase::GetOperationsJitConstants(const eltwise_params&case EltwiseMode::POW:op += cast_type + "pow(" + input0_str + ", " + input1_str + ")";break;+ case EltwiseMode::ATAN2:+ // input0 = y (lhs of atan2), input1 = x (rhs).+ op += cast_type + "atan2(" + input0_str + ", " + input1_str + ")";+ break;case EltwiseMode::SQRT:op += cast_type + "sqrt(" + input0_str + ")";break;diff --git a/src/plugins/intel_gpu/src/plugin/ops/atan2.cpp b/src/plugins/intel_gpu/src/plugin/ops/atan2.cppnew file mode 100644index 00000000000..2039c445515--- /dev/null+++ b/src/plugins/intel_gpu/src/plugin/ops/atan2.cpp@@ -0,0 +1,28 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "intel_gpu/op/atan2.hpp"+#include "intel_gpu/plugin/program_builder.hpp"+#include "intel_gpu/plugin/common_utils.hpp"+#include "intel_gpu/primitives/eltwise.hpp"++namespace ov::op::internal {+using Atan2 = ov::intel_gpu::op::Atan2;+}++namespace ov::intel_gpu {++static void CreateAtan2Op(ProgramBuilder& p, const std::shared_ptr<ov::op::internal::Atan2>& op) {+ validate_inputs_count(op, {2});+ auto inputs = p.GetInputInfo(op);+ std::string primitive_name = layer_type_name_ID(op);++ auto prim = cldnn::eltwise(primitive_name, inputs, cldnn::eltwise_mode::atan2);+ prim.output_data_types = get_output_data_types(op);+ p.add_primitive(*op, prim);+}++REGISTER_FACTORY_IMPL(internal, Atan2);++} // namespace ov::intel_gpudiff --git a/src/plugins/intel_gpu/src/plugin/transformations/disable_fp16_comp_cumsum_sin_gen.cpp b/src/plugins/intel_gpu/src/plugin/transformations/disable_fp16_comp_cumsum_sin_gen.cppnew file mode 100644index 00000000000..49487b01ad8--- /dev/null+++ b/src/plugins/intel_gpu/src/plugin/transformations/disable_fp16_comp_cumsum_sin_gen.cpp@@ -0,0 +1,55 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "disable_fp16_comp_cumsum_sin_gen.hpp"++#include "openvino/op/cum_sum.hpp"+#include "openvino/op/interpolate.hpp"+#include "openvino/op/multiply.hpp"+#include "openvino/op/sin.hpp"+#include "openvino/op/transpose.hpp"+#include "openvino/pass/pattern/op/wrap_type.hpp"+#include "transformations/rt_info/disable_fp16_compression.hpp"+#include "transformations/utils/utils.hpp"++namespace ov::intel_gpu {++// See header for the F0 oscillator pattern and motivation.+DisableFP16CompCumSumSinGen::DisableFP16CompCumSumSinGen() {+ using namespace ov::pass::pattern;++ auto cumsum_m = wrap_type<ov::op::v0::CumSum>({any_input(), any_input()});+ auto mul1_m = wrap_type<ov::op::v1::Multiply>({cumsum_m, any_input()});+ auto transpose2_m = wrap_type<ov::op::v1::Transpose>({mul1_m, any_input()});+ auto mul2_m = wrap_type<ov::op::v1::Multiply>({transpose2_m, any_input()});+ auto interpolate_m =+ wrap_type<ov::op::v4::Interpolate, ov::op::v11::Interpolate>({mul2_m, any_input(), any_input()});+ auto transpose3_m = wrap_type<ov::op::v1::Transpose>({interpolate_m, any_input()});+ auto sin_m = wrap_type<ov::op::v0::Sin>({transpose3_m});++ ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](Matcher& m) {+ const auto& pattern_map = m.get_pattern_value_map();++ auto sin_node = pattern_map.at(sin_m).get_node_shared_ptr();+ if (transformation_callback(sin_node))+ return false;++ auto cumsum_node = pattern_map.at(cumsum_m).get_node_shared_ptr();++ // Also tag the producer feeding CumSum's first input.+ auto cumsum_input = cumsum_node->input_value(0).get_node_shared_ptr();+ if (cumsum_input)+ ov::disable_fp16_compression(cumsum_input);++ for (const auto& key : {cumsum_m, mul1_m, transpose2_m, mul2_m, interpolate_m, transpose3_m, sin_m}) {+ ov::disable_fp16_compression(pattern_map.at(key).get_node_shared_ptr());+ }+ return true;+ };++ auto m = std::make_shared<Matcher>(sin_m, "DisableFP16CompCumSumSinGen");+ this->register_matcher(m, callback);+}++} // namespace ov::intel_gpudiff --git a/src/plugins/intel_gpu/src/plugin/transformations/disable_fp16_comp_cumsum_sin_gen.hpp b/src/plugins/intel_gpu/src/plugin/transformations/disable_fp16_comp_cumsum_sin_gen.hppnew file mode 100644index 00000000000..d1e9e6561a1--- /dev/null+++ b/src/plugins/intel_gpu/src/plugin/transformations/disable_fp16_comp_cumsum_sin_gen.hpp@@ -0,0 +1,54 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "openvino/pass/graph_rewrite.hpp"++namespace ov::intel_gpu {++/**+ * @brief Keeps the F0 oscillator chain (StyleTTS2 / iSTFTNet's `l_sin_gen`)+ * in fp32 by tagging it with `disable_fp16_compression`. The chain+ * cumulatively integrates phase via CumSum and applies sin() at the+ * predicted F0 (voice pitch); fp16 loses precision on the accumulated+ * phase and produces audible noise in the F0 / first-formant band.+ *+ * Before After+ * ------ -----+ * any (FP16) ──┐ any (FP32) ──┐ ◄─ also tagged+ * ▼ ▼+ * CumSum (FP16) CumSum (FP32)+ * │ │+ * ▼ ▼+ * Multiply (FP16) Multiply (FP32)+ * │ │+ * ▼ ▼+ * Transpose (FP16) Transpose (FP32)+ * │ │+ * ▼ ▼+ * Multiply (FP16) Multiply (FP32)+ * │ │+ * ▼ ▼+ * Interpolate(FP16) Interpolate(FP32)+ * │ │+ * ▼ ▼+ * Transpose (FP16) Transpose (FP32)+ * │ │+ * ▼ ▼+ * Sin (FP16) ── audible noise Sin (FP32) ── clean+ * │ │+ * ▼ ▼+ * downstream downstream+ *+ * Note: only `disable_fp16_compression` rt_info is added; no graph topology+ * change. The downstream `ConvertPrecision` pass uses the rt_info to keep+ * the marked nodes in fp32 while the rest of the model is lowered to fp16.+ */+class DisableFP16CompCumSumSinGen : public ov::pass::MatcherPass {+public:+ OPENVINO_MATCHER_PASS_RTTI("DisableFP16CompCumSumSinGen");+ DisableFP16CompCumSumSinGen();+};+} // namespace ov::intel_gpudiff --git a/src/plugins/intel_gpu/src/plugin/transformations/fuse_atan2_decomposed.cpp b/src/plugins/intel_gpu/src/plugin/transformations/fuse_atan2_decomposed.cppnew file mode 100644index 00000000000..728f4855d86--- /dev/null+++ b/src/plugins/intel_gpu/src/plugin/transformations/fuse_atan2_decomposed.cpp@@ -0,0 +1,99 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "fuse_atan2_decomposed.hpp"++#include "intel_gpu/op/atan2.hpp"+#include "openvino/core/graph_util.hpp"+#include "openvino/core/rt_info.hpp"+#include "openvino/op/atan.hpp"+#include "openvino/op/constant.hpp"+#include "openvino/op/divide.hpp"+#include "openvino/op/multiply.hpp"+#include "openvino/op/power.hpp"+#include "openvino/op/select.hpp"+#include "openvino/pass/pattern/op/or.hpp"+#include "openvino/pass/pattern/op/wrap_type.hpp"+#include "transformations/utils/utils.hpp"++namespace ov::intel_gpu {++FuseAtan2Decomposed::FuseAtan2Decomposed() {+ using namespace ov::pass::pattern;++ // Atan(div) where div is Divide(lhs, rhs) (frontend form) or+ // Multiply(lhs, Power(rhs, -1)) (post-ConvertDivide form, Multiply is+ // commutative so cover both input orderings).+ auto exp_neg1_m = wrap_type<ov::op::v0::Constant>(+ ov::op::util::constant_predicate<float>([](const std::vector<float>& v) {+ return v.size() == 1 && v[0] == -1.0f;+ }));+ auto power_m = wrap_type<ov::op::v1::Power>({any_input(), exp_neg1_m});+ auto divide_m = wrap_type<ov::op::v1::Divide>({any_input(), any_input()});+ auto mul_m = std::make_shared<ov::pass::pattern::op::Or>(ov::OutputVector{+ wrap_type<ov::op::v1::Multiply>({any_input(), power_m}),+ wrap_type<ov::op::v1::Multiply>({power_m, any_input()}),+ });+ auto div_m = std::make_shared<ov::pass::pattern::op::Or>(ov::OutputVector{divide_m, mul_m});+ auto atan_m = wrap_type<ov::op::v0::Atan>({div_m});++ // Sel3 (root) → Sel2(any, atan, Sel1(any, branch_p, branch_m))+ // Both Sel1 branches must consume the same Atan; verified in the callback.+ auto sel1_m = wrap_type<ov::op::v1::Select>({any_input(), any_input(), any_input()});+ auto sel2_m = wrap_type<ov::op::v1::Select>({any_input(), atan_m, sel1_m});+ auto sel3_m = wrap_type<ov::op::v1::Select>({any_input(), any_input(), sel2_m});++ ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](Matcher& m) {+ const auto& pattern_map = m.get_pattern_value_map();+ auto sel3 = pattern_map.at(sel3_m).get_node_shared_ptr();+ auto sel2 = pattern_map.at(sel2_m).get_node_shared_ptr();+ auto sel1 = pattern_map.at(sel1_m).get_node_shared_ptr();+ auto atan = pattern_map.at(atan_m).get_node_shared_ptr();++ if (transformation_callback(sel3))+ return false;++ // Both branches of Sel1 must consume the Atan (the only structural+ // fingerprint robust to constant folding of the special-case chain).+ auto branch_uses_atan = [&](const std::shared_ptr<ov::Node>& branch) {+ for (size_t i = 0; i < branch->get_input_size(); ++i) {+ if (branch->get_input_node_shared_ptr(i) == atan)+ return true;+ }+ return false;+ };+ if (!branch_uses_atan(sel1->get_input_node_shared_ptr(1)) ||+ !branch_uses_atan(sel1->get_input_node_shared_ptr(2)))+ return false;++ // Pattern guarantees atan->input(0) is either Divide or Multiply(_, Power(_, -1)).+ ov::Output<ov::Node> lhs, rhs;+ auto div_node = atan->get_input_node_shared_ptr(0);+ if (auto div = ov::as_type_ptr<ov::op::v1::Divide>(div_node)) {+ lhs = div->input_value(0);+ rhs = div->input_value(1);+ } else {+ auto mul = ov::as_type_ptr<ov::op::v1::Multiply>(div_node);+ const size_t pow_idx = ov::is_type<ov::op::v1::Power>(mul->get_input_node_shared_ptr(0)) ? 0 : 1;+ auto pow = ov::as_type_ptr<ov::op::v1::Power>(mul->get_input_node_shared_ptr(pow_idx));+ lhs = mul->input_value(1 - pow_idx);+ rhs = pow->input_value(0);+ }++ const auto& y_et = lhs.get_element_type();+ if (!y_et.is_real() || rhs.get_element_type() != y_et)+ return false;++ auto atan2 = std::make_shared<ov::intel_gpu::op::Atan2>(lhs, rhs);+ atan2->set_friendly_name(sel3->get_friendly_name());+ ov::copy_runtime_info({sel3, sel2, sel1, atan}, atan2);+ ov::replace_node(sel3, atan2);+ return true;+ };++ auto m = std::make_shared<Matcher>(sel3_m, "FuseAtan2Decomposed");+ this->register_matcher(m, callback);+}++} // namespace ov::intel_gpudiff --git a/src/plugins/intel_gpu/src/plugin/transformations/fuse_atan2_decomposed.hpp b/src/plugins/intel_gpu/src/plugin/transformations/fuse_atan2_decomposed.hppnew file mode 100644index 00000000000..db877a10eb9--- /dev/null+++ b/src/plugins/intel_gpu/src/plugin/transformations/fuse_atan2_decomposed.hpp@@ -0,0 +1,44 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#pragma once++#include "openvino/pass/graph_rewrite.hpp"++namespace ov::intel_gpu {++/**+ * @brief Fuses the frontend's atan2 decomposition (~10 ops) into a single+ * ov::intel_gpu::op::Atan2, which lowers to one cldnn::eltwise call.+ *+ * The frontend (translate_atan2_util) lowers torch.atan2 / aten::angle into+ * Atan(div) plus a 3-level Select chain that handles ±π / ±π/2 quadrant+ * adjustments. This pass collapses the chain back into a single Atan2.+ *+ * Before After+ * ------ -----+ * lhs (y) rhs (x) lhs (y) rhs (x)+ * │ │ │ │+ * └─►Divide / Multiply(_,Pow(_,-1)) └────┬────┘+ * │ ▼+ * Atan Atan2 (eltwise)+ * │ │+ * Select_1 ── (rhs<0, lhs>=0): atan±π ▼+ * │ downstream+ * Select_2 ── (rhs>0): atan+ * │+ * Select_3 (root) ── (rhs==0): ±π/2+ * │+ * ▼+ * downstream+ *+ * Targets: BiLSTM/STFT-style atan2 in TTS decoders (Kokoro).+ */+class FuseAtan2Decomposed : public ov::pass::MatcherPass {+public:+ OPENVINO_MATCHER_PASS_RTTI("FuseAtan2Decomposed");+ FuseAtan2Decomposed();+};++} // namespace ov::intel_gpudiff --git a/src/plugins/intel_gpu/src/plugin/transformations/op/atan2.cpp b/src/plugins/intel_gpu/src/plugin/transformations/op/atan2.cppnew file mode 100644index 00000000000..5abfab8b57b--- /dev/null+++ b/src/plugins/intel_gpu/src/plugin/transformations/op/atan2.cpp@@ -0,0 +1,32 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include "intel_gpu/op/atan2.hpp"+#include "openvino/op/util/broadcast_base.hpp"++namespace ov::intel_gpu::op {++Atan2::Atan2(const ov::Output<Node>& y, const ov::Output<Node>& x) : Op({y, x}) {+ validate_and_infer_types();+}++void Atan2::validate_and_infer_types() {+ const auto& y_shape = get_input_partial_shape(0);+ const auto& x_shape = get_input_partial_shape(1);+ OPENVINO_ASSERT(get_input_element_type(0) == get_input_element_type(1),+ "Atan2 requires both inputs to have the same element type");++ ov::PartialShape out_shape = y_shape;+ OPENVINO_ASSERT(ov::PartialShape::broadcast_merge_into(out_shape, x_shape, ov::op::AutoBroadcastType::NUMPY),+ "Atan2 inputs are not broadcast-compatible");++ set_output_type(0, get_input_element_type(0), out_shape);+}++std::shared_ptr<ov::Node> Atan2::clone_with_new_inputs(const ov::OutputVector& new_args) const {+ check_new_args_count(this, new_args);+ return std::make_shared<Atan2>(new_args.at(0), new_args.at(1));+}++} // namespace ov::intel_gpu::opdiff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cppindex 6508e222e57..3a87658dfed 100644--- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp+++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp@@ -93,6 +93,7 @@#include "plugin/transformations/fc_horizontal_fusion.hpp"#include "plugin/transformations/fuse_gated_mlp.hpp"#include "plugin/transformations/fuse_moe_3gemm_compressed.hpp"+#include "plugin/transformations/fuse_atan2_decomposed.hpp"#include "plugin/transformations/increase_position_ids_precision.hpp"#include "plugin/transformations/indirect_kv_cache.hpp"#include "plugin/transformations/keep_moe_3gemm_const_precision.hpp"@@ -111,6 +112,7 @@#include "plugin/transformations/unsqueeze_broadcast_reshape_sdpa_fusion.hpp"#include "plugin/transformations/disable_fp16_comp_rms.hpp"#include "plugin/transformations/swiglu_fusion_with_clamp.hpp"+#include "plugin/transformations/disable_fp16_comp_cumsum_sin_gen.hpp"#include "plugin/transformations/disable_fp16_comp_sin_gen.hpp"#include "plugin/transformations/increase_rms_input_precision.hpp"#include "transformations/common_optimizations/activations_scaling.hpp"@@ -199,6 +201,7 @@#include "transformations/paged_attention/convert_pagedattn_inputs.hpp"#include "transformations/resolve_names_collisions.hpp"#include "transformations/rt_info/dequantization_node.hpp"+#include "transformations/rt_info/disable_fp16_compression.hpp"#include "transformations/rt_info/keep_const_precision.hpp"#include "transformations/smart_reshape/matmul_sr.hpp"#include "openvino/op/broadcast.hpp"@@ -662,6 +665,11 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {manager.register_pass<ov::pass::RMSFusion>(false, true, true);manager.register_pass<DisableFP16CompForGemma3RMSPattern>();manager.register_pass<DisableFP16ComForGPTOSSROPEPattern>();+ manager.register_pass<DisableFP16CompCumSumSinGen>();+ // HiFiGAN matches a strict suffix of the CumSumSinGen chain — skip+ // when the same Sin was already marked above.+ pass_config->set_callback<DisableFP16ComSinGenPatternForHiFiGAN>(+ [](const_node_ptr& node) -> bool { return ov::fp16_compression_is_disabled(node); });manager.register_pass<DisableFP16ComSinGenPatternForHiFiGAN>();const bool keep_precision_sensitive_in_fp32_1 = true;const bool convert_input_output_precision = false;@@ -1442,6 +1450,7 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {pass_config->disable<ov::pass::RoPEShareCosSin>();manager.register_pass<ov::intel_gpu::IncreasePositionIdsPrecision>();+ manager.register_pass<ov::intel_gpu::FuseAtan2Decomposed>();if (device_info.supports_immad && config.get_use_onednn() && !disable_gated_mlp_fusion) {manager.register_pass<ov::intel_gpu::FuseGatedMLP>();}diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cppindex 5521115a807..cf28f9aa93c 100644--- a/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/test_cases/eltwise_gpu_test.cpp@@ -2252,6 +2252,48 @@ TEST(eltwise_gpu_f32, pow_in2x2x2x2_broadcast_all) {}}+TEST(eltwise_gpu_f32, atan2_basic_in1x1x1x8) {+ auto& engine = get_test_engine();++ auto input_y = engine.allocate_memory({ data_types::f32, format::bfyx, { 1, 1, 1, 8 } });+ auto input_x = engine.allocate_memory({ data_types::f32, format::bfyx, { 1, 1, 1, 8 } });++ topology topology;+ topology.add(input_layout("input_y", input_y->get_layout()));+ topology.add(input_layout("input_x", input_x->get_layout()));+ topology.add(eltwise("eltwise", { input_info("input_y"), input_info("input_x") }, eltwise_mode::atan2));++ // (y, x) pairs covering all four quadrants and axis cases.+ std::vector<std::pair<float, float>> ys_xs = {+ { 1.f, 1.f}, // Q1 → π/4+ { 1.f, -1.f}, // Q2 → 3π/4+ {-1.f, -1.f}, // Q3 → -3π/4+ {-1.f, 1.f}, // Q4 → -π/4+ { 1.f, 0.f}, // +y axis → π/2+ {-1.f, 0.f}, // -y axis → -π/2+ { 0.f, 1.f}, // +x axis → 0+ { 0.f, -1.f}, // -x axis → π+ };++ std::vector<float> ys, xs;+ for (auto& p : ys_xs) { ys.push_back(p.first); xs.push_back(p.second); }+ set_values(input_y, ys);+ set_values(input_x, xs);++ network network(engine, topology, get_test_default_config(engine));+ network.set_input_data("input_y", input_y);+ network.set_input_data("input_x", input_x);+ auto outputs = network.execute();++ auto output = outputs.at("eltwise").get_memory();+ cldnn::mem_lock<float> out_ptr(output, get_test_stream());++ for (size_t i = 0; i < ys_xs.size(); ++i) {+ float expected = std::atan2(ys_xs[i].first, ys_xs[i].second);+ ASSERT_NEAR(out_ptr[i], expected, 1e-5f) << "i=" << i;+ }+}+TEST(eltwise_gpu_f32, add_basic_in2x2x2x2_broadcast_2_inputs_same_dim) {auto& engine = get_test_engine();diff --git a/src/plugins/intel_gpu/tests/unit/transformations/disable_fp16_compression_cumsum_sin_gen_test.cpp b/src/plugins/intel_gpu/tests/unit/transformations/disable_fp16_compression_cumsum_sin_gen_test.cppnew file mode 100644index 00000000000..95559ea95f2--- /dev/null+++ b/src/plugins/intel_gpu/tests/unit/transformations/disable_fp16_compression_cumsum_sin_gen_test.cpp@@ -0,0 +1,198 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include <gtest/gtest.h>++#include <memory>+#include <string>+#include <unordered_map>++#include <openvino/core/model.hpp>+#include <openvino/pass/manager.hpp>+#include <transformations/convert_precision.hpp>+#include <transformations/utils/utils.hpp>++#include "openvino/op/constant.hpp"+#include "openvino/op/cum_sum.hpp"+#include "openvino/op/interpolate.hpp"+#include "openvino/op/multiply.hpp"+#include "openvino/op/parameter.hpp"+#include "openvino/op/sin.hpp"+#include "openvino/op/transpose.hpp"+#include "plugin/transformations/disable_fp16_comp_cumsum_sin_gen.hpp"++using namespace testing;+using namespace ov::intel_gpu;++// Friendly names used to look up the matched nodes after the pass has run.+namespace {+const std::string name_cumsum_input = "cumsum_input";+const std::string name_cumsum = "cumsum";+const std::string name_mul1 = "mul1";+const std::string name_transpose2 = "transpose2";+const std::string name_mul2 = "mul2";+const std::string name_interpolate = "interpolate";+const std::string name_transpose3 = "transpose3";+const std::string name_sin = "sin";++// Build the full chain matched by DisableFP16CompCumSumSinGen:+// producer -> CumSum -> Multiply -> Transpose -> Multiply -> Interpolate -> Transpose -> Sin+std::shared_ptr<ov::Model> create_model_to_match() {+ auto input = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::PartialShape{1, 32});++ // Extra Multiply so the test can verify the CumSum producer gets marked.+ auto producer_const = ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1, 32}, {1.0f});+ auto cumsum_input = std::make_shared<ov::op::v1::Multiply>(input, producer_const);+ cumsum_input->set_friendly_name(name_cumsum_input);++ auto axis = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{}, {1});+ auto cumsum = std::make_shared<ov::op::v0::CumSum>(cumsum_input, axis);+ cumsum->set_friendly_name(name_cumsum);++ auto mul1_const = ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1, 32}, {6.2832f});+ auto mul1 = std::make_shared<ov::op::v1::Multiply>(cumsum, mul1_const);+ mul1->set_friendly_name(name_mul1);++ auto order2 = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{2}, {1, 0});+ auto transpose2 = std::make_shared<ov::op::v1::Transpose>(mul1, order2);+ transpose2->set_friendly_name(name_transpose2);++ auto mul2_const = ov::op::v0::Constant::create(ov::element::f32, ov::Shape{32, 1}, {1.0f});+ auto mul2 = std::make_shared<ov::op::v1::Multiply>(transpose2, mul2_const);+ mul2->set_friendly_name(name_mul2);++ ov::op::v4::Interpolate::InterpolateAttrs attrs;+ attrs.mode = ov::op::v4::Interpolate::InterpolateMode::NEAREST;+ attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::SCALES;+ attrs.nearest_mode = ov::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR;+ auto target_shape = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{2}, {64, 1});+ auto scales = ov::op::v0::Constant::create(ov::element::f32, ov::Shape{2}, {2.0f, 1.0f});+ auto interpolate = std::make_shared<ov::op::v4::Interpolate>(mul2, target_shape, scales, attrs);+ interpolate->set_friendly_name(name_interpolate);++ auto order3 = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{2}, {1, 0});+ auto transpose3 = std::make_shared<ov::op::v1::Transpose>(interpolate, order3);+ transpose3->set_friendly_name(name_transpose3);++ auto sin = std::make_shared<ov::op::v0::Sin>(transpose3);+ sin->set_friendly_name(name_sin);++ return std::make_shared<ov::Model>(ov::OutputVector{sin}, ov::ParameterVector{input});+}++// A bare Sin (no upstream CumSum) — must not be matched.+std::shared_ptr<ov::Model> create_model_not_to_match() {+ auto input = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::PartialShape{1, 32});++ auto mul_const = ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1, 32}, {1.0f});+ auto mul = std::make_shared<ov::op::v1::Multiply>(input, mul_const);+ mul->set_friendly_name(name_mul1);++ auto sin = std::make_shared<ov::op::v0::Sin>(mul);+ sin->set_friendly_name(name_sin);++ return std::make_shared<ov::Model>(ov::OutputVector{sin}, ov::ParameterVector{input});+}++// Same chain but without the second Multiply between Transpose_2 and+// Interpolate — must not match.+std::shared_ptr<ov::Model> create_model_missing_mul2() {+ auto input = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::PartialShape{1, 32});++ auto axis = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{}, {1});+ auto cumsum = std::make_shared<ov::op::v0::CumSum>(input, axis);+ cumsum->set_friendly_name(name_cumsum);++ auto mul1_const = ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1, 32}, {6.2832f});+ auto mul1 = std::make_shared<ov::op::v1::Multiply>(cumsum, mul1_const);+ mul1->set_friendly_name(name_mul1);++ auto order2 = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{2}, {1, 0});+ auto transpose2 = std::make_shared<ov::op::v1::Transpose>(mul1, order2);+ transpose2->set_friendly_name(name_transpose2);++ // NOTE: no second Multiply here.++ ov::op::v4::Interpolate::InterpolateAttrs attrs;+ attrs.mode = ov::op::v4::Interpolate::InterpolateMode::NEAREST;+ attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::SCALES;+ attrs.nearest_mode = ov::op::v4::Interpolate::NearestMode::ROUND_PREFER_FLOOR;+ auto target_shape = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{2}, {64, 1});+ auto scales = ov::op::v0::Constant::create(ov::element::f32, ov::Shape{2}, {2.0f, 1.0f});+ auto interpolate = std::make_shared<ov::op::v4::Interpolate>(transpose2, target_shape, scales, attrs);+ interpolate->set_friendly_name(name_interpolate);++ auto order3 = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{2}, {1, 0});+ auto transpose3 = std::make_shared<ov::op::v1::Transpose>(interpolate, order3);+ transpose3->set_friendly_name(name_transpose3);++ auto sin = std::make_shared<ov::op::v0::Sin>(transpose3);+ sin->set_friendly_name(name_sin);++ return std::make_shared<ov::Model>(ov::OutputVector{sin}, ov::ParameterVector{input});+}++void run_test(const std::shared_ptr<ov::Model>& model,+ const std::unordered_map<std::string, bool>& expected_fp16_disabled_status) {+ ov::pass::Manager manager;+ manager.register_pass<DisableFP16CompCumSumSinGen>();++ precisions_map fp_convert_precision_map = {{ov::element::f32, ov::element::f16}};+ manager.register_pass<ov::pass::ConvertPrecision>(fp_convert_precision_map);++ manager.run_passes(model);++ for (const auto& op : model->get_ops()) {+ auto it = expected_fp16_disabled_status.find(op->get_friendly_name());+ if (it == expected_fp16_disabled_status.end())+ continue;+ if (it->second) {+ ASSERT_TRUE(ov::fp16_compression_is_disabled(op))+ << "FP16 compression is not disabled for node: " << op->get_friendly_name();+ } else {+ ASSERT_FALSE(ov::fp16_compression_is_disabled(op))+ << "FP16 compression is unexpectedly disabled for node: " << op->get_friendly_name();+ }+ }+}+} // namespace++TEST(TransformationTests, DisableFP16CompCumSumSinGen_Positive) {+ auto model = create_model_to_match();+ // The pass marks the full 7-node chain plus the producer feeding CumSum.+ std::unordered_map<std::string, bool> expected_status = {+ {name_cumsum_input, true},+ {name_cumsum, true},+ {name_mul1, true},+ {name_transpose2, true},+ {name_mul2, true},+ {name_interpolate, true},+ {name_transpose3, true},+ {name_sin, true},+ };+ run_test(model, expected_status);+}++TEST(TransformationTests, DisableFP16CompCumSumSinGen_NoCumSumUpstream_NoOp) {+ auto model = create_model_not_to_match();+ std::unordered_map<std::string, bool> expected_status = {+ {name_mul1, false},+ {name_sin, false},+ };+ run_test(model, expected_status);+}++TEST(TransformationTests, DisableFP16CompCumSumSinGen_MissingSecondMultiply_NoOp) {+ auto model = create_model_missing_mul2();+ // No second Multiply — pattern must not match.+ std::unordered_map<std::string, bool> expected_status = {+ {name_cumsum, false},+ {name_mul1, false},+ {name_transpose2, false},+ {name_interpolate, false},+ {name_transpose3, false},+ {name_sin, false},+ };+ run_test(model, expected_status);+}diff --git a/src/plugins/intel_gpu/tests/unit/transformations/fuse_atan2_decomposed_test.cpp b/src/plugins/intel_gpu/tests/unit/transformations/fuse_atan2_decomposed_test.cppnew file mode 100644index 00000000000..23d4706874f--- /dev/null+++ b/src/plugins/intel_gpu/tests/unit/transformations/fuse_atan2_decomposed_test.cpp@@ -0,0 +1,146 @@+// Copyright (C) 2018-2026 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include <gtest/gtest.h>++#include <memory>+#include <vector>++#include <openvino/core/model.hpp>+#include <openvino/pass/manager.hpp>+#include "openvino/op/add.hpp"+#include "openvino/op/atan.hpp"+#include "openvino/op/constant.hpp"+#include "openvino/op/divide.hpp"+#include "openvino/op/equal.hpp"+#include "openvino/op/greater.hpp"+#include "openvino/op/greater_eq.hpp"+#include "openvino/op/less.hpp"+#include "openvino/op/logical_and.hpp"+#include "openvino/op/logical_or.hpp"+#include "openvino/op/multiply.hpp"+#include "openvino/op/parameter.hpp"+#include "openvino/op/power.hpp"+#include "openvino/op/result.hpp"+#include "openvino/op/select.hpp"++#include <intel_gpu/op/atan2.hpp>+#include <plugin/transformations/fuse_atan2_decomposed.hpp>++#include "common_test_utils/ov_test_utils.hpp"++using namespace testing;+using namespace ov::intel_gpu;++namespace {++// Constructs the post-ConvertDivide form of the frontend atan2 decomposition,+// matching what FuseAtan2Decomposed sees in the GPU pipeline.+struct Atan2DecomposedModel {+ std::shared_ptr<ov::op::v0::Parameter> y; // lhs (imag)+ std::shared_ptr<ov::op::v0::Parameter> x; // rhs (real)+ std::shared_ptr<ov::op::v1::Select> root; // Sel3+ std::shared_ptr<ov::Model> model;+};++Atan2DecomposedModel build_decomposed_atan2(ov::element::Type et, bool use_divide) {+ Atan2DecomposedModel m;+ m.y = std::make_shared<ov::op::v0::Parameter>(et, ov::PartialShape{-1, -1});+ m.x = std::make_shared<ov::op::v0::Parameter>(et, ov::PartialShape{-1, -1});++ std::shared_ptr<ov::Node> div_out;+ if (use_divide) {+ div_out = std::make_shared<ov::op::v1::Divide>(m.y, m.x);+ } else {+ auto neg_one = std::make_shared<ov::op::v0::Constant>(et, ov::Shape{}, std::vector<float>{-1.0f});+ auto pow = std::make_shared<ov::op::v1::Power>(m.x, neg_one);+ div_out = std::make_shared<ov::op::v1::Multiply>(m.y, pow);+ }+ auto atan = std::make_shared<ov::op::v0::Atan>(div_out);++ auto pi = std::make_shared<ov::op::v0::Constant>(et, ov::Shape{}, std::vector<float>{3.14159265f});+ auto neg_pi = std::make_shared<ov::op::v0::Constant>(et, ov::Shape{}, std::vector<float>{-3.14159265f});+ auto half_pi = std::make_shared<ov::op::v0::Constant>(et, ov::Shape{}, std::vector<float>{1.57079633f});+ auto neg_half_pi = std::make_shared<ov::op::v0::Constant>(et, ov::Shape{}, std::vector<float>{-1.57079633f});+ auto zero = std::make_shared<ov::op::v0::Constant>(et, ov::Shape{}, std::vector<float>{0.0f});++ auto atan_plus_pi = std::make_shared<ov::op::v1::Add>(atan, pi);+ auto atan_minus_pi = std::make_shared<ov::op::v1::Add>(atan, neg_pi);++ auto x_lt = std::make_shared<ov::op::v1::Less>(m.x, zero);+ auto y_ge = std::make_shared<ov::op::v1::GreaterEqual>(m.y, zero);+ auto add_pi_cond = std::make_shared<ov::op::v1::LogicalAnd>(x_lt, y_ge);+ auto sel1 = std::make_shared<ov::op::v1::Select>(add_pi_cond, atan_plus_pi, atan_minus_pi);++ auto x_gt = std::make_shared<ov::op::v1::Greater>(m.x, zero);+ auto sel2 = std::make_shared<ov::op::v1::Select>(x_gt, atan, sel1);++ auto x_eq = std::make_shared<ov::op::v1::Equal>(m.x, zero);+ auto y_gt = std::make_shared<ov::op::v1::Greater>(m.y, zero);+ auto y_lt = std::make_shared<ov::op::v1::Less>(m.y, zero);+ auto half_pi_cond = std::make_shared<ov::op::v1::LogicalAnd>(x_eq, y_gt);+ auto neg_half_pi_cond = std::make_shared<ov::op::v1::LogicalAnd>(x_eq, y_lt);+ auto special_cond = std::make_shared<ov::op::v1::LogicalOr>(half_pi_cond, neg_half_pi_cond);+ auto special_select = std::make_shared<ov::op::v1::Select>(half_pi_cond, half_pi, neg_half_pi);++ m.root = std::make_shared<ov::op::v1::Select>(special_cond, special_select, sel2);+ m.model = std::make_shared<ov::Model>(ov::OutputVector{m.root}, ov::ParameterVector{m.y, m.x});+ return m;+}++bool model_contains_atan2(const std::shared_ptr<ov::Model>& m) {+ for (const auto& node : m->get_ordered_ops()) {+ if (ov::as_type_ptr<ov::intel_gpu::op::Atan2>(node))+ return true;+ }+ return false;+}++} // namespace++TEST(FuseAtan2DecomposedTest, FusesPostConvertDivideForm) {+ auto m = build_decomposed_atan2(ov::element::f16, /*use_divide=*/false);++ ov::pass::Manager manager;+ manager.register_pass<FuseAtan2Decomposed>();+ manager.run_passes(m.model);++ ASSERT_TRUE(model_contains_atan2(m.model)) << "Atan2 op should be inserted";++ // Result should now consume the Atan2 directly.+ ASSERT_EQ(m.model->get_results().size(), 1u);+ auto result_input = m.model->get_results()[0]->get_input_node_shared_ptr(0);+ auto atan2 = ov::as_type_ptr<ov::intel_gpu::op::Atan2>(result_input);+ ASSERT_TRUE(atan2 != nullptr) << "Result must be fed by Atan2";++ // input0 = y, input1 = x.+ EXPECT_EQ(atan2->get_input_node_shared_ptr(0).get(), m.y.get());+ EXPECT_EQ(atan2->get_input_node_shared_ptr(1).get(), m.x.get());+}++TEST(FuseAtan2DecomposedTest, FusesDivideForm) {+ auto m = build_decomposed_atan2(ov::element::f32, /*use_divide=*/true);++ ov::pass::Manager manager;+ manager.register_pass<FuseAtan2Decomposed>();+ manager.run_passes(m.model);++ ASSERT_TRUE(model_contains_atan2(m.model));+}++TEST(FuseAtan2DecomposedTest, DoesNotFuseUnrelatedSelect) {+ // A bare Select(cond, x, y) without the surrounding atan structure must+ // not be touched.+ auto cond = std::make_shared<ov::op::v0::Parameter>(ov::element::boolean, ov::PartialShape{-1});+ auto a = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::PartialShape{-1});+ auto b = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::PartialShape{-1});+ auto sel = std::make_shared<ov::op::v1::Select>(cond, a, b);+ auto model = std::make_shared<ov::Model>(ov::OutputVector{sel}, ov::ParameterVector{cond, a, b});++ ov::pass::Manager manager;+ manager.register_pass<FuseAtan2Decomposed>();+ manager.run_passes(model);++ EXPECT_FALSE(model_contains_atan2(model));+}