Repository navigation
Studio: reserve MiniMax-H3's pinned weights from sd.cpp's budget on integrated AMD GPUs - #13786
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
Reached Codex review convergence at oobabooga#374. |
The model manager's "cannot make enough memory available" warning is printed before recoveries too: renders that complete log it. Read as a capacity failure, it made output_shows_accelerator_failure ignore a build-level failure that followed it and explained unrelated crashes as memory. Keep the fail_segment phrases, and add the allocated capacity check that sd.cpp reports the same way.
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Follow-up to #13531.
MiniMax-H3 GGUF on an integrated AMD GPU (Strix Halo, Strix Point, Phoenix) loads and passes Studio's GTT fit, then fails every default-size render on the Vulkan build when GTT is the half-of-RAM default:
The UI reports "The renderer stopped unexpectedly".
Cause
--max-vram -1, which sd.cpp resolves at startup (resolve_auto_max_vram_bytes) from ggml's free memory, before it pins anything. For an integrated GPU, ggml-vulkan's free memory includes the GTT that the pinned denoiser and VAEs (15.5 GiB at Q4) are about to take. With 22.5 GiB free, sd.cpp budgets 21.8 GiB, plans one segment, stages the whole denoiser, and has 1.4 GB left for a 5.2 GB compute buffer._ACCELERATOR_CAPACITY_FAILURE_MARKERS, so the failure gets no memory advice.Fix
sd_cpp_vulkan_device_is_umareads ggml-vulkan'suma: 1from the cached--list-devicesoutput.--max-vram -1with--max-vram -<pinned + 1 GiB>, so sd.cpp's budget excludes the weights it pins. An explicit memory mode keeps its placement and only gets the corrected budget.h3_native_live_fittakes the render's estimated compute buffer. On a UMA device, the part the carve-out cannot hold counts against GTT beside the pinned weights. The render, the sd-server start (pre_spawn) and the load (smallest clip) all pass a size.Unchanged: discrete cards (
uma: 0), CUDA, ROCm, Windows (no amdgpu sysfs, so no GTT reading), devices whose listing has noumafield, resident renders, andUNSLOTH_H3_NATIVE_FIT_CHECK=0.Verification
AMD DevLab Linux runner (gfx1151, RADV, 0.5 GiB carve-out, 62.5 GiB GTT), Studio's pinned Vulkan prebuilt, Q4_K denoiser and Q4_K_M encoder, Studio's Auto flags, 124 frames, 2 steps. A Vulkan allocation held the rest of GTT so that a fixed amount stayed free. The "this PR" column ran this PR's
h3_native_live_fiton the runner's live sysfs readings and passed sd-cli exactly the flags it returned.--max-vram -1)-17.05, renders in 387 s-17.05, renders in 2268 sRuns: main, main, full and 22.5 GiB, this PR.
The fit charges only the compute buffer, not sd.cpp's per-segment working set on top of it (0.3 GiB at 864x480, 1.2 GiB at 1344x768), so it refused no size that rendered. A render inside that margin fails in sd.cpp's capacity check and now gets the memory advice.
test_h3_native_memory_fit.py,test_video_backend.pyandtest_sd_cpp_backend.py: 740 passed.Not tested:
_h3_launch_flags, but only sd-cli was run.Independent verification on the real target
Each tree's own Studio code (load fit, Auto resident choice, the sd-cli launch fit, the engine and the failure classifier) ran on gfx1151 Linux (RADV, 0.5 GiB carve-out, 62.47 GiB GTT), merge base 97ed941 vs head 33599d4, in the same job. Q4_K denoiser, Q4_K_M encoder, 124 frames, 2 steps, Studio's real Auto flags.
GTT held to 22.5 GiB free:
--max-vram -1, budget 21.80 GiB, fails after 9.7 s in the workspace capacity check--max-vram -17.05, budget 5.75 GiB, renders in 386.6 s (864x480, 124 frames, audio)--max-vram -1--max-vram -17.05Nothing held (healthy host), 3 renders each:
--max-vram -1--max-vram -34.02The 3.0 s difference is inside the 18.9 s run-to-run spread. On Windows 11 gfx1151 (Vulkan prebuilt) the launch flags and the load fit are byte-identical to base. Across 4,800 enumerated fit cells, only the 40 Vulkan cells with a GTT reading and a UMA device move, and only in their
--max-vramvalue.Follow-up: capacity markers
The model manager's "cannot make enough memory available" warning is printed by renders that complete too (twice in the head render above), so matching it could relabel an unrelated crash as out of memory and skip recording a build failure. Commit d107ffe matches only sd.cpp's failing-segment lines (
failed during workspace capacity check,failed during workspace allocation,failed during allocated capacity check). The real capacity failure above still gets the memory advice. New test:test_a_recovered_capacity_warning_is_not_a_capacity_failure.Also not covered: Strix Point and Phoenix, Windows renders under GTT pressure, and the ROCm sd.cpp build under the same pressure.