From 0678d04ae72bc13a0b8fb1392fb8f161bbcb6488 Mon Sep 17 00:00:00 2001 From: leejet Date: Tue, 10 Nov 2026 23:56:14 +0800 Subject: [PATCH] fix(vae): order Sol attention and FFN writes to reduce VRAM --- src/model/vae/minimax_h3_sol_attention.hpp | 1 + src/model/vae/minimax_h3_vae.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/model/vae/minimax_h3_sol_attention.hpp b/src/model/vae/minimax_h3_sol_attention.hpp index 66d5b5c4..70152509 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 e59eed94..d4e1c324 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; }