From: Piotr Wilkin (ilintar) Date: Thu, 20 Nov 2025 10:58:21 +0000 (+0100) Subject: ggml : Fix transposed SOLVE_TRI result (llama/17323) X-Git-Tag: upstream/0.9.4.395~140 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=48516fdb2325be95078fb7ec4582432cf327c0c0;p=pkg%2Fggml%2Fsources%2Fggml ggml : Fix transposed SOLVE_TRI result (llama/17323) * Did someone transpose the SOLVE_TRI result matrix? Perhaps... * Update ggml/src/ggml-cpu/ops.cpp Co-authored-by: Sigbjørn Skjæret * Update ggml/src/ggml-cpu/ops.cpp Co-authored-by: Sigbjørn Skjæret --------- Co-authored-by: Sigbjørn Skjæret --- diff --git a/src/ggml-cpu/ops.cpp b/src/ggml-cpu/ops.cpp index b6209588..41e89d83 100644 --- a/src/ggml-cpu/ops.cpp +++ b/src/ggml-cpu/ops.cpp @@ -9696,13 +9696,12 @@ static void ggml_compute_forward_solve_tri_f32(const struct ggml_compute_params for (int64_t i00 = 0; i00 < n; ++i00) { float sum = 0.0f; for (int64_t t = 0; t < i00; ++t) { - sum += A_batch[i00 * n + t] * X_batch[i01 * n + t]; + sum += A_batch[i00 * n + t] * X_batch[t * k + i01]; } const float diag = A_batch[i00 * n + i00]; GGML_ASSERT(diag != 0.0f && "Zero diagonal in triangular matrix"); - - X_batch[i01 * n + i00] = (B_batch[i00 * k + i01] - sum) / diag; + X_batch[i00 * k + i01] = (B_batch[i00 * k + i01] - sum) / diag; } } }