-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[CPU]Add Support For GatedDeltaNet #34447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhangYiIntel
wants to merge
26
commits into
openvinotoolkit:master
Choose a base branch
from
zhangYiIntel:yi3/support_gdn
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,660
−629
Open
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5382618
add op linear
zhangYiIntel 5025b41
Add GatedDeltaNet cpu impl
zhangYiIntel 418f33e
add shared test
zhangYiIntel ad86b8d
Add GDN Fusion
zhangYiIntel b8641b9
[CPU]use state layout of B, H, V, K
zhangYiIntel a3d1eff
[CPU]Update transformation for gdn
zhangYiIntel 9a550e8
fix test and op spec
zhangYiIntel 39ae68e
fix code style
zhangYiIntel 3a9d6b5
apply review comment
zhangYiIntel e2f5b76
apply comments for fusion
zhangYiIntel f4f09dc
apply review comments
zhangYiIntel a329bcd
apply comments for core
zhangYiIntel c5f1d80
apply comments
zhangYiIntel 92d8f2b
fix clang-tidy and test cases
zhangYiIntel 7ca7f6b
fix rank check and temp buffer
zhangYiIntel a24dd40
refine gdn kernel creation
zhangYiIntel 78711f1
fix cpu_parallel
zhangYiIntel 0aeef07
try use model_pass
zhangYiIntel 6827e05
match loop body with matcher
zhangYiIntel d7f9105
refine pattern name
zhangYiIntel a0e8bd0
apply review comments
zhangYiIntel fe9157d
remove debug
zhangYiIntel 2d55899
fix clang & apply review comments
zhangYiIntel 8fa64d1
Merge branch 'master' into yi3/support_gdn
zhangYiIntel 0f3d64d
remove tranpose in gdn loop pattern
zhangYiIntel cae6427
fix typo in l2norm fusion
zhangYiIntel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...mon/transformations/include/transformations/common_optimizations/fuse_gated_delta_net.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // 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 { | ||
| namespace pass { | ||
|
|
||
| class TRANSFORMATIONS_API GatedDeltaNetFusion; | ||
|
|
||
| } // namespace pass | ||
| } // namespace ov | ||
|
|
||
| /// 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)│ └────┬────┘ └────┬────┘ │ └─────┬─────┘ └────┬────┘ | ||
| /// └─────┬──────┘ │ │ │ │ │ | ||
| /// │ │ │ │ │ │ | ||
| /// ┌─────┴─────────────┴───────────┴──────────┴───────────────┴─────────────┴─────┐ | ||
zhangYiIntel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// │ Loop (recurrent body) │ | ||
| /// └───────────────────────────────┬─────────────────────────────────────────────────┘ | ||
| /// │ | ||
| /// ┌──────────────┴──────────────┐ | ||
| /// │ Concat / Slice / Reshape(s) │ | ||
| /// └──────────────┬──────────────┘ | ||
| /// │ | ||
| /// ┌───────────┴───────────┐ | ||
| /// │ CoreAttn, StateOut │ | ||
| /// └───────────────────────┘ | ||
| /// | ||
| /// After: | ||
| /// ┌───────┐ ┌───────┐ ┌───────┐ ┌──────────────┐ ┌───────┐ ┌────────┐ | ||
| /// │ Q │ │ K │ │ V │ │Initial State │ │ G │ │ Beta │ | ||
| /// └───┬───┘ └───┬───┘ └───┬───┘ └──────┬───────┘ └───┬───┘ └───┬────┘ | ||
| /// │ │ │ │ │ │ | ||
| /// │ │ │ │ │ │ | ||
| /// ┌───┴───────────┴───────────┴──────────────┴───────────────┴───────────┴──────┐ | ||
| /// │ GatedDeltaNet │ | ||
| /// └───────────────────────────────────┬────────────────────────────────────────────┘ | ||
| /// │ | ||
| /// ┌──────────┴──────────┐ | ||
| /// │ CoreAttn, StateOut │ | ||
| /// └─────────────────────┘ | ||
| /** | ||
| * @ingroup ov_transformation_common_api | ||
| * @brief Fuses a loop-based gated delta net sub-graph into an internal GatedDeltaNet operation. | ||
| */ | ||
| class ov::pass::GatedDeltaNetFusion : public ov::pass::MatcherPass { | ||
| public: | ||
| OPENVINO_MATCHER_PASS_RTTI("GatedDeltaNetFusion"); | ||
| GatedDeltaNetFusion(); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.