Skip to content
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5382618
add op linear
zhangYiIntel Jan 4, 2026
5025b41
Add GatedDeltaNet cpu impl
zhangYiIntel Mar 2, 2026
418f33e
add shared test
zhangYiIntel Mar 2, 2026
ad86b8d
Add GDN Fusion
zhangYiIntel Mar 3, 2026
b8641b9
[CPU]use state layout of B, H, V, K
zhangYiIntel Mar 4, 2026
a3d1eff
[CPU]Update transformation for gdn
zhangYiIntel Mar 5, 2026
9a550e8
fix test and op spec
zhangYiIntel Mar 6, 2026
39ae68e
fix code style
zhangYiIntel Mar 6, 2026
3a9d6b5
apply review comment
zhangYiIntel Mar 6, 2026
e2f5b76
apply comments for fusion
zhangYiIntel Mar 7, 2026
f4f09dc
apply review comments
zhangYiIntel Mar 8, 2026
a329bcd
apply comments for core
zhangYiIntel Mar 8, 2026
c5f1d80
apply comments
zhangYiIntel Mar 9, 2026
92d8f2b
fix clang-tidy and test cases
zhangYiIntel Mar 9, 2026
7ca7f6b
fix rank check and temp buffer
zhangYiIntel Mar 9, 2026
a24dd40
refine gdn kernel creation
zhangYiIntel Mar 9, 2026
78711f1
fix cpu_parallel
zhangYiIntel Mar 9, 2026
0aeef07
try use model_pass
zhangYiIntel Mar 10, 2026
6827e05
match loop body with matcher
zhangYiIntel Mar 10, 2026
d7f9105
refine pattern name
zhangYiIntel Mar 10, 2026
a0e8bd0
apply review comments
zhangYiIntel Mar 11, 2026
fe9157d
remove debug
zhangYiIntel Mar 11, 2026
2d55899
fix clang & apply review comments
zhangYiIntel Mar 11, 2026
8fa64d1
Merge branch 'master' into yi3/support_gdn
zhangYiIntel Mar 12, 2026
0f3d64d
remove tranpose in gdn loop pattern
zhangYiIntel Mar 13, 2026
cae6427
fix typo in l2norm fusion
zhangYiIntel Mar 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once

#include "openvino/pass/graph_rewrite.hpp"
#include "transformations_visibility.hpp"

namespace ov::pass {

/**
* @ingroup ov_transformation_common_api
* @brief Remove Concat of Loop
*/

class TRANSFORMATIONS_API RemoveConcatSliceAfterLoop : public ov::pass::MatcherPass {
public:
OPENVINO_MATCHER_PASS_RTTI("RemoveConcatSliceAfterLoop");
RemoveConcatSliceAfterLoop();
};

/**
* @ingroup ov_transformation_common_api
* @brief Fuses a loop-based gated delta net sub-graph into an internal GatedDeltaNet operation.
*
* Expected Loop body semantics per step:
* 1) Decay recurrent state: `h_decay = h * exp(g)`
* 2) Compute projection and delta: `delta = v - reduce_sum(h_decay * k, axis=-2)`
* 3) Apply beta and update state: `h_new = h_decay + k * unsqueeze(delta * beta, axis=-2)`
* 4) Compute per-step output: `o = reduce_sum(h_new * q, axis=-2, keep_dims=true)` and scatter to time index
*
* The matcher validates this body shape/operation pattern before replacing the Loop with `GatedDeltaNet`.
*/

class TRANSFORMATIONS_API FuseGDNLoop : public ov::pass::MatcherPass {
public:
OPENVINO_MATCHER_PASS_RTTI("FuseGDNLoop");
FuseGDNLoop();
};

/**
* @ingroup ov_transformation_common_api
* @brief Fuse l2_norm into GatedDeltaNet
*/

class TRANSFORMATIONS_API FuseL2NormIntoGDN : public ov::pass::MatcherPass {
public:
OPENVINO_MATCHER_PASS_RTTI("FuseL2NormIntoGDN");
FuseL2NormIntoGDN();
};

/// This pass transforms a loop-based Gated Delta Net sub-graph to a single internal `GatedDeltaNet` operation.
///
/// Before:
/// ┌───────┐ ┌───────┐ ┌───────┐ ┌──────────────┐ ┌───────┐ ┌────────┐
/// │ Q │ │ K │ │ V │ │Initial State │ │ G │ │ Beta │
/// └───┬───┘ └───┬───┘ └───┬───┘ └──────┬───────┘ └───┬───┘ └───┬────┘
/// │ │ │ │ │ │
/// │ │ │ │ │ │
/// ┌───┴───────┐ ┌─┴───────┐ ┌─┴───────┐ │ ┌─────┴─────┐ ┌───┴─────┐
/// │L2Norm(Q)+ │ │L2Norm(K)│ │Transpose│ │ │ Transpose │ │Transpose│
/// │QScale(1/√d)│ └────┬────┘ └────┬────┘ │ └─────┬─────┘ └────┬────┘
/// └─────┬──────┘ │ │ │ │ │
/// │ │ │ │ │ │
/// ┌─────┴─────────────┴───────────┴──────────┴───────────────┴─────────────┴─────┐
/// │ Loop (recurrent body) │
/// └───────────────────────────────┬─────────────────────────────────────────────────┘
/// │
/// ┌──────────────┴──────────────┐
/// │ Concat / Slice / Reshape(s) │
/// └──────────────┬──────────────┘
/// │
/// ┌───────────┴───────────┐
/// │ CoreAttn, StateOut │
/// └───────────────────────┘
///
/// After:
/// ┌───────┐ ┌───────┐ ┌───────┐ ┌──────────────┐ ┌───────┐ ┌────────┐
/// │ Q │ │ K │ │ V │ │Initial State │ │ G │ │ Beta │
/// └───┬───┘ └───┬───┘ └───┬───┘ └──────┬───────┘ └───┬───┘ └───┬────┘
/// │ │ │ │ │ │
/// │ │ │ │ │ │
/// ┌───┴───────────┴───────────┴──────────────┴───────────────┴───────────┴──────┐
/// │ GatedDeltaNet │
/// └───────────────────────────────────┬────────────────────────────────────────────┘
/// │
/// ┌──────────┴──────────┐
/// │ CoreAttn, StateOut │
/// └─────────────────────┘

class TRANSFORMATIONS_API GatedDeltaNetFusion : public ov::pass::ModelPass {
public:
OPENVINO_MODEL_PASS_RTTI("GatedDeltaNetFusion");
GatedDeltaNetFusion() = default;
bool run_on_model(const std::shared_ptr<ov::Model>& model) override;
};

} // namespace ov::pass
Loading
Loading