From: Piotr Wilkin (ilintar) Date: Thu, 20 Nov 2025 10:58:21 +0000 (+0100) Subject: ggml : Fix transposed SOLVE_TRI result (#17323) X-Git-Tag: upstream/0.0.7446~333 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=845f200b2895f7b3d88c6a2503879f7b12f1eb10;p=pkg%2Fggml%2Fsources%2Fllama.cpp ggml : Fix transposed SOLVE_TRI result (#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/ggml/src/ggml-cpu/ops.cpp b/ggml/src/ggml-cpu/ops.cpp index b6209588..41e89d83 100644 --- a/ggml/src/ggml-cpu/ops.cpp +++ b/ggml/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; } } }