GeezerVison is showing github.com — moss-image : view qkv slices instead of slice+reshape by pwilkin · Pull Request #2232 · leejet/stable-diffusion.cpp
Conversation
pwilkin
commented
Oct 27, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
The qkv projections were split with ggml_ext_slice followed by ggml_reshape_4d, which materialised a copy of each slice. A ggml_view_4d over the fused qkv tensor reads the same elements in place.
Together with the ggml submodule bump (rope changes, cpy changes) this takes 50-step 1024x1024 sampling from 379.49 s to 356.12 s (-6.16%) with byte-identical output.
Checklist
Summary by CodeRabbit
- Updates
- Refreshed the underlying components used by the app.
- Updated image-generation processing. These changes are internal and do not add or remove any user-facing features.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Green-Sky reacted with thumbs up emoji
The qkv projections were split with ggml_ext_slice followed by
ggml_reshape_4d, which materialised a copy of each slice. A ggml_view_4d
over the fused qkv tensor reads the same elements in place.
Together with the ggml submodule bump this takes 50-step 1024x1024 sampling
from 379.49 s to 356.12 s (-6.16%) with byte-identical output.
coderabbitai
Bot
commented
Oct 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Caution
Review failed
The pull request is closed.
No actionable comments were generated in the recent review.
Walkthrough
-
The ggml subproject reference changed. In TextBlock::forward, Q, K, and V are now strided 4D views into the combined QKV tensor instead of separate sliced and reshaped tensors.
Changes: MOSS QKV views
| Layer / File(s) |
Summary |
Update MOSS QKV views ggml, src/model/diffusion/moss_image.hpp |
The ggml subproject reference changed. TextBlock::forward now creates Q, K, and V as strided 4D views into qkv. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Refactor
Possibly related PRs
Suggested reviewers: leejet
Merge Risk: Minimal · previous review e349f
-
The change replaces QKV slice-and-reshape copies with strided views and bumps ggml for a reported speedup. On AMD WMMA-capable builds the ggml update may shift outputs slightly, but the repository does not promise bit-identical output across ggml bumps. No merge-blocking risk remains.
Pre-merge checks: 4 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi… |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
Passed checks: 4 passed
-
| Check name |
Status |
Explanation |
| Description check |
 |
The description clearly explains the QKV view change, the performance impact, output validation, and checklist status. The optional Related Issue / Discussion and Additional Information headings are n… |
| Title check |
 |
The title clearly and concisely describes the main change: using QKV views instead of slice and reshape operations. |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Description check
-
Explanation
The description clearly explains the QKV view change, the performance impact, output validation, and checklist status. The optional Related Issue / Discussion and Additional Information headings are not present, but the relevant verification details are included.
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. 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. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
- 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
-
CodeRabbit Verify
- Run CodeRabbit Verify to test the changes in this pull request.
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:
fbd3da62-e9ac-4475-bd9e-9c0509dd96c7
Commits
-
Reviewing files that changed from the base of the PR and between be48649 and e349f08.
Files selected for processing: 2
-
ggml
src/model/diffusion/moss_image.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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the ggml submodule update from this PR and submit the ggml changes separately, either:
- To upstream ggml-org/ggml. Once merged, I can sync them into leejet/ggml’s sd.cpp branch.
- Directly to the sd.cpp branch of leejet/ggml.
Please keep this PR focused on the MOSS-Image QKV view optimization and validate it against the existing ggml revision.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
pwilkin reacted with thumbs up emoji
Uh oh!
There was an error while loading. Please reload this page.
|
Thank you for your contribution.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
leejet
leejet requested changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|