Skip to content

refactor: replace manual gated activations with native ggml GLU - #2250

Merged
leejet merged 1 commit into
masterfrom
refactor/native-ggml-glu
Oct 29, 2026
Merged

leejet merged 1 commit into
masterfrom
refactor/native-ggml-glu

Conversation

@leejet

@leejet leejet commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Replace manual SiLU/GELU gating with native ggml SwiGLU/GEGLU operators across shared blocks, text encoders, diffusion models, and VAEs.
  • Preserve gate ordering and handle incompatible input layouts in ggml_ext_silu_act.
  • Keep Wan audio unchanged because it uses broadcasting and reuses the activated weights.

Related Issue / Discussion

N/A

Additional Information

N/A

Checklist

Summary by CodeRabbit

  • Improvements
    • Updated feed-forward processing across supported image, video, language, and audio models. These changes standardize how gated activations are computed and account for inputs with different layouts, while preserving the existing model outputs and downstream processing. This update covers a range of model families, including diffusion, text, and VAE models.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5aeb6694-113d-47c0-9aad-32b940daa544
Commits

Reviewing files that changed from the base of the PR and between 37bc88b and 5dc18c7.

Files selected for processing: 13
  • src/core/ggml_extend.cpp
  • src/model/diffusion/ernie_image.hpp
  • src/model/diffusion/flux.hpp
  • src/model/diffusion/ideogram4.hpp
  • src/model/diffusion/krea2.hpp
  • src/model/diffusion/lens.hpp
  • src/model/diffusion/lingbot_video.hpp
  • src/model/diffusion/minit2i.hpp
  • src/model/diffusion/pid.hpp
  • src/model/te/llm.hpp
  • src/model/te/t5.hpp
  • src/model/vae/minimax_h3_audio_vae.hpp
  • src/model/vae/minimax_h3_vae.hpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

Model forward methods now use GGML SwiGLU and GeGLU operations instead of explicit activation-and-multiplication sequences. The core SiLU helper also delegates to SwiGLU operations after checking the input dimension and contiguity.

Changes: Gated activation operator adoption

Layer / File(s) Summary
Core SiLU helper
src/core/ggml_extend.cpp
ggml_ext_silu_act checks that dimension 0 is even, makes the input contiguous along dimension 0 when needed, and selects a SwiGLU operation based on gate_first.
Diffusion model forward methods
src/model/diffusion/*
Diffusion MLPs and the sparse MoE block replace explicit gate activation and multiplication with split SwiGLU or GeGLU operations.
Text encoder model forward methods
src/model/te/llm.hpp, src/model/te/t5.hpp
MLPs use split SwiGLU or GeGLU operations. Qwen35DeltaNet uses split SwiGLU to combine its normalized delta output with z.
VAE forward methods
src/model/vae/minimax_h3_audio_vae.hpp, src/model/vae/minimax_h3_vae.hpp
The audio VAE uses split GeGLU, and the VAE decoder uses SwiGLU.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related PRs

Merge Risk: Minimal · up to 5dc18

No merge-blocking issue was identified in the gated activation changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: replacing manual gated activations with native ggml GLU operators.
Description check Passed The description includes all required sections, explains the refactor and its rationale, records related issues as N/A, provides additional context, and completes the checklist.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 13 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@leejet
leejet merged commit e239e4b into master Oct 29, 2026
11 checks passed
@leejet
leejet deleted the refactor/native-ggml-glu branch November 2, 2026 16:49
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