Conversation
…m2col Agent-Logs-Url: https://github.com/cmdr2/stable-diffusion.cpp/sessions/62470eb3-1f58-421f-94a6-4787bcfe092a Co-authored-by: cmdr2 <844287+cmdr2@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cmdr2/stable-diffusion.cpp/sessions/62470eb3-1f58-421f-94a6-4787bcfe092a Co-authored-by: cmdr2 <844287+cmdr2@users.noreply.github.com>
…timing output Agent-Logs-Url: https://github.com/cmdr2/stable-diffusion.cpp/sessions/62470eb3-1f58-421f-94a6-4787bcfe092a Co-authored-by: cmdr2 <844287+cmdr2@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
cmdr2
March 31, 2026 16:23
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
UNet inference optimized from ~2463ms to ~1332ms per step (~1.85x speedup) on CPU with FP16 weights.
Enable LLAMAFILE optimized SGEMM by default
GGML_LLAMAFILE_DEFAULTwasOFF, leaving llamafile's tinyBLAS (cache-blocked AVX2+F16C matrix multiply) unused. Set itONbeforeadd_subdirectory(ggml). This alone accounts for ~1.7x of the speedup since MUL_MAT dominates (~172 GFLOPS across 282 ops in the graph).Fuse SpatialTransformer 1x1 Conv2d with permutes
For SD1's
!use_linearpath,proj_in/proj_outare 1x1 Conv2d ops. The original flow:Now both paths (linear and conv-1x1) share a unified flow — permute once, reshape, apply weight as a linear op via
ggml_mul_maton the reshaped 2D weight, then permute back once:This eliminates 2× im2col + 2× permute+cont per SpatialTransformer (16 in SD1.5 UNet = 32 fewer data copies).
Minor: add
get_params()accessor toGGMLBlockNeeded to access Conv2d weight tensors directly for the reshaped mul_mat path.