Skip to content

Fuse expert SilU heads (MoE) into batched GEMM via fuse_horizontal#5087

Open
TedThemistokleous wants to merge 1 commit into
hoist_and_horizontal_dotfrom
expert_fusion_rebase
Open

Fuse expert SilU heads (MoE) into batched GEMM via fuse_horizontal#5087
TedThemistokleous wants to merge 1 commit into
hoist_and_horizontal_dotfrom
expert_fusion_rebase

Conversation

@TedThemistokleous

Copy link
Copy Markdown
Collaborator

Motivation

Batch SilU heads that come from Mixture of experts (MoE)

Adds the match_expert_head fusion pass to fuse this pattern into a single batched GEMM

Running with this setup gave me boost across all the batches 1-11%

Technical Details

  • Leverages the existing hoist_and_horizontal_dot fusion work + prelude to capture and fuse SilU which follows an MoE type pattern.

Adds a single fusion pass that should happen before dot_horizontal_fusion

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

Follow the LLVM AI Tool Use Policy for contributions using AI.

Comment thread src/fuse_horizontal.cpp
if(pw->module_inputs().empty())
return false;

bool found = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[format.py] reported by reviewdog 🐶

Suggested change
bool found = false;
bool found = false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant