Commit 0678d04 for stable-diffusion.cpp
commit 0678d04ae72bc13a0b8fb1392fb8f161bbcb6488
Author: leejet <leejet714@gmail.com>
Date: Tue Nov 10 23:56:14 2026 +0800
fix(vae): order Sol attention and FFN writes to reduce VRAM
diff --git a/src/model/vae/minimax_h3_sol_attention.hpp b/src/model/vae/minimax_h3_sol_attention.hpp
index 66d5b5c..7015250 100644
--- a/src/model/vae/minimax_h3_sol_attention.hpp
+++ b/src/model/vae/minimax_h3_sol_attention.hpp
@@ -172,6 +172,7 @@ namespace MiniMaxH3VAE {
heads, nullptr, false, runner_ctx->flash_attn_enabled);
auto indices = ggml_reshape_1d(ctx, batch.output_rows, ggml_nelements(batch.output_rows));
output = ggml_set_rows(ctx, output, ggml_reshape_2d(ctx, attended, dim, indices->ne[0]), indices);
+ runner_ctx->expand_graph(output);
}
// Later windows can only read this block and its immediate successor.
previous = current;
diff --git a/src/model/vae/minimax_h3_vae.hpp b/src/model/vae/minimax_h3_vae.hpp
index e59eed9..d4e1c32 100644
--- a/src/model/vae/minimax_h3_vae.hpp
+++ b/src/model/vae/minimax_h3_vae.hpp
@@ -430,6 +430,7 @@ namespace MiniMaxH3VAE {
auto input = ggml_ext_slice(ctx, x, 1, row, std::min(row + rows_per_chunk, x->ne[1]), false);
auto indices = ggml_ext_slice(ctx, sol->row_ids, 0, row, std::min(row + rows_per_chunk, x->ne[1]), false);
output = ggml_set_rows(ctx->ggml_ctx, output, finish(input), indices);
+ ctx->expand_graph(output);
}
return output;
}