Repository navigation
Resync with upstream master-1050 and port the ggml patches - #52
Draft
danielhanchen wants to merge 72 commits into
Draft
danielhanchen wants to merge 72 commits into
danielhanchen wants to merge 72 commits into
Conversation
Co-authored-by: leejet <leejet714@gmail.com>
…2273) Co-authored-by: mirek190 <mirek190@gmail.com>
Conflicts resolved keeping both sides: - build.yml: ours (the mirror's customised upstream CI). - compute_workspace: upstream now always allocates through the scheduler (gallocr path and needs_scheduler removed); the CPU BLAS backend, its thread count, residency accounting and scratch release are carried on top of that. - ggml_extend_backend.cpp: upstream moved sd_backend_dev_buffer_from_host_ptr to ggml_compat.cpp; the CPU weight repack helpers and sd_backend_blas_init stay. - ggml_runner.cpp: upstream's scheduler-only execute_segment (eval callback always set, pre-compute hook) plus the BLAS thread count; runner_end also drops the BLAS scratch. - minimax_h3.hpp: upstream's project_qkv/attend/project_output, INT8-aware MLP scales and chunked native-GLU MLP, with the mirror's head-major fused attention, folded MLP and fused segment block as fast paths in front; the old segment helpers upstream deleted are dropped. - minimax_h3_vae.hpp: upstream's native GLU (leejet#2250) for the decoder feed-forward. - model_manager.cpp: both includes. - diffusion_engine.cpp: P-H3-Image squeeze plus the temporal tiling retry bookkeeping. - cmake/ggml.cmake: upstream now resolves the ggml private include dir only for SD_USE_UPSTREAM_GGML, which left the fused-op probe reading a non-existent ggml.h and silently building MiniMax-H3 unfused; the probe now finds ggml.h from the ggml target.
…submodule) Upstream master-1050 moves the ggml submodule from dc99877 to 135ce1e (57 commits), which moves ROPE_APPLY, SAGE_ATTN, SOL_ATTN and QUANTIZE_I8_CONVROT out of ggml into stable-diffusion.cpp backend extensions. 0002-0004, 0006 and 0007 no longer applied and were ported by cherry-picking each patch onto the new submodule commit: - 0002: upstream 0d84d52a added its own 128x128 wide tile for head size 128 (config row, instance file, shared-memory helper); the port reuses it, keeps only the head size 64 instance, and gives the helper an nstages override for the long-sequence variant. - 0003: context only. - 0004: the fused ops now follow GLU directly in the op enum (GGML_OP_COUNT 104). - 0006: the SAGE_ATTN half (sage-attn.cu hook, GGML_CUDA_CUDNN_SAGE) is dropped with the op; cuDNN now serves FLASH_ATTN_EXT only. - 0007: the rope_apply PDL race fix is dropped with the op; the extension kernel that replaces it launches without PDL. 0010 (Metal ROPE_APPLY kernel) is dropped: GGML_OP_ROPE_APPLY no longer exists in ggml and ggml's extension registry has no Metal hook, so Metal runs the unfused rope graph again. 0001, 0005, 0008, 0009 and 0011-0013 apply unchanged.
Upstream's CUDA build includes cmake/cutlass.cmake, which stops at configure time when thirdparty/cutlass is empty. The source stamp only fetched ggml, so every CUDA leg would fail. Fetch the submodule shallowly and keep only include/ and the license in the tarball.
danielhanchen
temporarily deployed
to
release-signing
November 6, 2026 05:29 — with
GitHub Actions
Inactive
danielhanchen
temporarily deployed
to
release-signing
November 6, 2026 05:29 — with
GitHub Actions
Inactive
danielhanchen
temporarily deployed
to
release-signing
November 6, 2026 05:29 — with
GitHub Actions
Inactive
GitHub retired the macos-14 image, so the Darwin-macOS-arm64 leg is cancelled before it starts
("The configuration 'macos-14-arm64-us-default' is not supported"). macos-15 is Apple Silicon too,
and CMAKE_OSX_DEPLOYMENT_TARGET=14.0 keeps the binaries running on macOS 14.
danielhanchen
requested a deployment
to
release-signing
November 6, 2026 11:14 — with
GitHub Actions
Queued
danielhanchen
requested a deployment
to
release-signing
November 6, 2026 11:14 — with
GitHub Actions
Queued
danielhanchen
requested a deployment
to
release-signing
November 6, 2026 11:14 — with
GitHub Actions
Queued
danielhanchen
requested a deployment
to
release-signing
November 6, 2026 11:14 — with
GitHub Actions
Queued
This branch is being deployed
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.
Summary
This merges upstream
master-1050-58bb3c1into the fork and ports the carried ggml patches onto the new ggml submodule commit (135ce1e0). The current Studio pin,master-982-0518b34-uaba3a1c, is 68 upstream commits behind. Among them are leejet#2183 (the model manager reads free memory again before it gives up, also vendored on its own in #50) and leejet#2273 (faster MOSS normalization and staging).Why now
MOSS-Image-SFT Q8_0 with Qwen3.5-9B Q8_0 through
sd-server, 1024x1024, 25 steps. One Colab L4 job, both arms on the same card, with VRAM held down to 7.5 GiB free at load. Each cell ran twice, and repeats agree within 1.7 s.master-982-0518b34-uaba3a1c)7c062d2, patches applied)So this branch is about 1.3x faster on the normal path and about 1.7x faster under memory pressure. Both renders are correct images.
In a separate job, a plain upstream build of the same base (
58bb3c1, no fork patches) next to this branch took 89.5 s vs 101.7 s with nothing taken, and 89.9 s vs 89.5 s at 2 GiB. Sampling took 76.1 s vs 68.2 s and 75.3 s vs 74.7 s, so the ported patches cost MOSS nothing. At 1.5 GiB free, the pin, plain upstream and this branch all fail the same way (the text encoder segment needs 1543 MB, 1534 MB is free). That case is a real shortfall, not something an engine update fixes. unslothai/unsloth#16815 makes Studio report it as out of memory.Changes
64fb9d4: merge ofmaster-1050-58bb3c1. Conflicts were resolved keeping both sides (fork-only server and workflow pieces plus upstream's new code).d4ed8d3: upstream moves ROPE_APPLY, SAGE_ATTN, SOL_ATTN and QUANTIZE_I8_CONVROT out of ggml and into stable-diffusion.cpp backend extensions, so several patches inscripts/unsloth/ggml-patchesno longer applied:7c062d2: the prebuilt workflow now also fetchesthirdparty/cutlass. Upstream's CUDA build includescmake/cutlass.cmake, which stops at configure time without the CUTLASS headers. The source stamp only fetched ggml, so every CUDA leg would have failed. The step keeps onlyinclude/and the license, which keeps the source tarball small.6f12cd9: the macOS arm64 leg moves frommacos-14tomacos-15. GitHub retired the macos-14 image, so that leg was cancelled before it started (The configuration 'macos-14-arm64-us-default' is not supported). master has the same runner label.CMAKE_OSX_DEPLOYMENT_TARGET=14.0stays, so the binaries still run on macOS 14.Testing
135ce1e0. The CPU and CUDA builds of ggml (withtest-backend-ops) and ofsd-serversucceed with the patches applied.sd-clirender of MOSS-Image-SFT Q8_0 renders with the patches applied (18.2 s) and without them (66.8 s), image saved both times.Not verified yet
7c062d2(https://github.com/unslothai/stable-diffusion.cpp/actions/runs/42157974628): every leg built except macOS arm64. That covers Linux CPU, Vulkan, aarch64, CUDA 12 and CUDA 13; Windows CPU, Vulkan, CUDA 12 and CUDA 13; and macOS x86_64. The CUDA legs were cold builds (new ggml commit plus the CUTLASS kernels, no ccache hits) and took 1 h 18 min to about 2 h 50 min, inside the job limits. macOS arm64 was cancelled because its runner image is retired; https://github.com/unslothai/stable-diffusion.cpp/actions/runs/42178497743 rebuilds it with6f12cd9.Please do not merge before the prebuilt run is green. Once it is merged and the nightly publishes, Studio's
DEFAULT_TAGcan move to the new tag, and #50 becomes redundant.