From 1d067933f0d83e7ab8c4208f3c71aab3917c66e9 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 14 Mar 2026 12:27:26 +0800 Subject: [PATCH] claude fixes for ace step, idk man who am i to argue with an agi --- otherarch/acestep/vae.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/otherarch/acestep/vae.h b/otherarch/acestep/vae.h index 51ce0b9ad..9c3d624b3 100644 --- a/otherarch/acestep/vae.h +++ b/otherarch/acestep/vae.h @@ -436,6 +436,11 @@ static int vae_ggml_decode_tiled( fprintf(stderr, "[VAE] Tiled decode: %d tiles (chunk=%d, overlap=%d, stride=%d)\n", num_steps, chunk_size, overlap, stride); + // FIX (Bug 2): Zero the ch1 staging zone before the loop so stale data from a + // previous generation (e.g. after a lowvram reload, or a shorter re-run into the + // same buffer) cannot bleed into gaps between tile writes and corrupt the memmove. + memset(audio_out + max_T_audio, 0, max_T_audio * sizeof(float)); + float upsample_factor = 0.0f; int audio_write_pos = 0; @@ -483,13 +488,17 @@ static int vae_ggml_decode_tiled( // Read trimmed ch0 and ch1 directly from backend tensor into final audio_out // Layout: [ch0: tile_T floats, ch1: tile_T floats] + // FIX (Bug 1): Capture tile_T into a local before the two reads so both + // ch0 and ch1 use the same tile's stride. (Guards against any future refactor + // that might clobber tile_T between the two ggml_backend_tensor_get calls.) + int this_tile_T = tile_T; ggml_backend_tensor_get(m->graph_output, audio_out + audio_write_pos, trim_start * sizeof(float), core_len * sizeof(float)); ggml_backend_tensor_get(m->graph_output, audio_out + max_T_audio + audio_write_pos, - (tile_T + trim_start) * sizeof(float), + (this_tile_T + trim_start) * sizeof(float), core_len * sizeof(float)); audio_write_pos += core_len; }