GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@pwilkin pwilkin commented Oct 27, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

  • I have read and confirmed this PR follows the contribution guidelines.

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
All reactions
  • 👍 1 reaction
@pwilkin
moss-image : view qkv slices instead of slice+reshape
b15dd9b
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

coderabbitai Bot commented Oct 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Review in Change Stack →

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

  • leejet/stable-diffusion.cpp#2201: Includes related MOSS QKV projection views and ggml backend work.
  • leejet/stable-diffusion.cpp#2196: Uses strided QKV views and adjusts their axis-2 stride.
  • leejet/stable-diffusion.cpp#2209: Applies strided views to another MOSS QKV path.

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: 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. Documentation-only edits and deletions within survi… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed 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 Passed The title clearly and concisely describes the main change: using QKV views instead of slice and reshape operations.
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: 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pwilkin
Merge branch 'master' into moss-image-rope-copy
e349f08
leejet
leejet requested changes Oct 27, 2026
View reviewed changes

@leejet leejet left a comment

Copy link
Copy Markdown
Owner

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
All reactions
  • 👍 1 reaction
leejet added 2 commits November 3, 2026 23:44
@leejet
Merge branch 'master' into moss-image-rope-copy
067fd8d
@leejet
Merge branch 'master' into moss-image-rope-copy
a9f100f
@leejet
leejet merged commit 6225bf8 into leejet:master Nov 3, 2026
9 of 10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@leejet

leejet commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Thank you for your contribution.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@leehack leehack mentioned this pull request Nov 4, 2026
Qualify post-v0.2 upstream changes with context ABI and FP8 CPU safety checks leehack/stable-diffusion-native#20
Open
1 of 11 tasks
@wbruna wbruna mentioned this pull request Nov 11, 2026
perf: replace qkv materialized chunks with views #2335
Merged
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@leejet leejet leejet requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

2 participants

@pwilkin @leejet
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.