Description
After bisecting a performance regression on Mage-Flow-Edit-Turbo (img-edit workflow) on ROCm/HIP, I found it's caused by commit 5ebce93 ("fix: reuse graph plans when scale parameters change", #1963). Sampling time for 16 steps at 1024×1024 goes from ~162s to ~266s (~1.64×) — output is pixel-identical (same seed), so this is purely a performance regression, not a correctness issue.
Notably ROCm-specific: The same test on the Vulkan backend shows no regression at all (154–156s before and after this commit).
Environment
- OS: Debian 13, AMD Ryzen AI Max+ 395 (Strix Halo), gfx1151, ROCm 7.2.4
- Build:
-DSD_HIPBLAS=ON -DAMDGPU_TARGETS=gfx1151 -DCMAKE_BUILD_TYPE=Release
Bisect result
5ebce93342718ff7c0afa69b9b51d3fc0a1fd991 is the first bad commit
commit 5ebce93342718ff7c0afa69b9b51d3fc0a1fd991
fix: reuse graph plans when scale parameters change (#1963)
src/core/ggml_graph_cut.cpp | 16 ++++++++++++++--
Parent commit and everything before it: ~150–165s (matches the known-good baseline at 97d2990, three commits before the regression). 5ebce93 itself and everything after (tested up to current master c678dfe): ~230–266s.
Steps to reproduce
Weights: Mage-Flow-Edit-Turbo (Comfy-Org/Mage-Flow, bf16), Qwen3VL-4B-Instruct (llm + llm_vision), own VAE.
sd-cli \
--diffusion-model mage_flow_edit_turbo_bf16.safetensors \
--llm Qwen3VL-4B-Instruct-Q8_0.gguf \
--llm_vision mmproj-Qwen3VL-4B-Instruct-F16.gguf \
--vae mage_flow_vae_bf16.safetensors \
--sampling-method euler --steps 16 --cfg-scale 1.0 -W 1024 -H 1024 --diffusion-fa \
--ref-image <any image> \
-p "change the background to a beach at sunset" \
-o out.png
Hypothesis
The commit stops including op_params for GGML_OP_SCALE nodes in the graph-layout cache signature (intended to allow reusing a cached plan when only a scale value changes). For Mage-Flow-Edit-Turbo's graph, this may cause structurally different graphs to collide on the same cache key, forcing extra reconciliation work — apparently only costly on the HIP/ROCm backend path, not Vulkan. I haven't dug further into ggml_graph_cut.cpp internals to confirm the exact mechanism.
Additional notes
Related to (but distinct from) #2009 (SIGFPE in Wan video path) — same bisect investigation surfaced this as a second issue. Happy to test a patch.
Description
After bisecting a performance regression on Mage-Flow-Edit-Turbo (img-edit workflow) on ROCm/HIP, I found it's caused by commit 5ebce93 ("fix: reuse graph plans when scale parameters change", #1963). Sampling time for 16 steps at 1024×1024 goes from ~162s to ~266s (~1.64×) — output is pixel-identical (same seed), so this is purely a performance regression, not a correctness issue.
Notably ROCm-specific: The same test on the Vulkan backend shows no regression at all (154–156s before and after this commit).
Environment
-DSD_HIPBLAS=ON -DAMDGPU_TARGETS=gfx1151 -DCMAKE_BUILD_TYPE=ReleaseBisect result
Parent commit and everything before it: ~150–165s (matches the known-good baseline at
97d2990, three commits before the regression).5ebce93itself and everything after (tested up to current masterc678dfe): ~230–266s.Steps to reproduce
Weights: Mage-Flow-Edit-Turbo (Comfy-Org/Mage-Flow, bf16), Qwen3VL-4B-Instruct (llm + llm_vision), own VAE.
Hypothesis
The commit stops including
op_paramsforGGML_OP_SCALEnodes in the graph-layout cache signature (intended to allow reusing a cached plan when only a scale value changes). For Mage-Flow-Edit-Turbo's graph, this may cause structurally different graphs to collide on the same cache key, forcing extra reconciliation work — apparently only costly on the HIP/ROCm backend path, not Vulkan. I haven't dug further intoggml_graph_cut.cppinternals to confirm the exact mechanism.Additional notes
Related to (but distinct from) #2009 (SIGFPE in Wan video path) — same bisect investigation surfaced this as a second issue. Happy to test a patch.