Skip to content

fix: chunk MiniMax-H3 MLP to respect backend buffer limits - #2257

Merged
leejet merged 1 commit into
masterfrom
fix/minimax-h3-mlp-buffer-limit
Nov 1, 2026
Merged

leejet merged 1 commit into
masterfrom
fix/minimax-h3-mlp-buffer-limit

Conversation

@leejet

@leejet leejet commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Split MiniMax-H3 MLP computation along the token axis to avoid oversized F32 activations triggering Vulkan CPU fallback.
  • Account for batch dimensions and buffer alignment, preserving the existing path for inputs that fit.

Related Issue / Discussion

Addresses #2242.

Additional Information

N/A

Checklist

Summary by CodeRabbit

  • Improvements
    • Large model inputs are now processed in smaller portions when needed to fit backend buffer limits, while inputs that fit continue to be processed in one pass. This helps the model handle constrained backend environments more reliably.

@coderabbitai

coderabbitai Bot commented Nov 1, 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: 3d5e0262-0b92-415e-b0e2-6c78448665e3
Commits

Reviewing files that changed from the base of the PR and between 45a63ac and 792cdfa.

Files selected for processing: 1
  • src/model/diffusion/minimax_h3.hpp

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

Walkthrough

The MLP stores its feed-forward hidden size and uses the backend maximum buffer size to determine token-axis chunking. Oversized inputs are processed in contiguous chunks and concatenated. Inputs within the limit, or inputs without a backend, retain single-pass processing.

Changes: MiniMax-H3 MLP backend-aware chunking

Layer / File(s) Summary
Backend-aware MLP forward pass
src/model/diffusion/minimax_h3.hpp
MLP stores ffn_hidden_size. When a backend is present, forward derives a chunk limit from the aligned maximum buffer size and activation widths. Oversized inputs are sliced along dimension 1, made contiguous when needed, processed, and concatenated. Other inputs use one pass.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • leejet/stable-diffusion.cpp#2240: This PR extends the MiniMax-H3 MLP implementation changed in PR #2240, adding token-axis chunking when backend buffer limits would be exceeded.
Merge Risk: Minimal · up to 792cd

No concrete merge-blocking issue was established for the chunked MLP.

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: chunking MiniMax-H3 MLP computation to respect backend buffer limits.
Description check Passed The description includes all required sections. It explains the change and rationale, references issue #2242, provides additional information, and confirms the contribution 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 1 functions across 1 files.

Resolution

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

Finishing Touches
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

@leejet
leejet merged commit 5356982 into master Nov 1, 2026
11 checks passed
@leejet
leejet deleted the fix/minimax-h3-mlp-buffer-limit 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