Commit 162e2bb2e for llama.cpp

commit 162e2bb2e42a0bbf6f9c2d3d8a9eb3cc40b4a4ea
Author: EugeoSynthesisThirtyTwo <gabriel.dhimoila@gmail.com>
Date:   Wed Nov 4 09:10:22 2026 +0100

    ggml : fix bf16 (#31609)

    Co-authored-by: Your Name <you@example.com>

diff --git a/ggml/src/ggml.c b/ggml/src/ggml.c
index 8183525af..e81148106 100644
--- a/ggml/src/ggml.c
+++ b/ggml/src/ggml.c
@@ -485,27 +485,25 @@ void ggml_fp16_to_fp32_row(const ggml_fp16_t * x, float * y, int64_t n) {
 }

 void ggml_fp32_to_fp16_row(const float * x, ggml_fp16_t * y, int64_t n) {
-    int i = 0;
-    for (; i < n; ++i) {
+    for (int64_t i = 0; i < n; i++) {
         y[i] = GGML_FP32_TO_FP16(x[i]);
     }
 }

 void ggml_bf16_to_fp32_row(const ggml_bf16_t * x, float * y, int64_t n) {
-    int i = 0;
-    for (; i < n; ++i) {
+    for (int64_t i = 0; i < n; i++) {
         y[i] = GGML_BF16_TO_FP32(x[i]);
     }
 }

 void ggml_fp32_to_bf16_row_ref(const float * x, ggml_bf16_t * y, int64_t n) {
-    for (int i = 0; i < n; i++) {
+    for (int64_t i = 0; i < n; i++) {
         y[i] = ggml_compute_fp32_to_bf16(x[i]);
     }
 }

 void ggml_fp32_to_bf16_row(const float * x, ggml_bf16_t * y, int64_t n) {
-  int i = 0;
+    int64_t i = 0;
 #if defined(__AVX512BF16__)
   // subnormals are flushed to zero on this platform
   for (; i + 32 <= n; i += 32) {
diff --git a/tools/export-lora/export-lora.cpp b/tools/export-lora/export-lora.cpp
index cd7ac39d2..5ffd97814 100644
--- a/tools/export-lora/export-lora.cpp
+++ b/tools/export-lora/export-lora.cpp
@@ -182,6 +182,8 @@ struct lora_merge_ctx {
     ggml_type get_out_tensor_type(struct ggml_tensor * t) {
         if (t->type == GGML_TYPE_F32) {
             return GGML_TYPE_F32;
+        } else if (t->type == GGML_TYPE_BF16) {
+            return GGML_TYPE_BF16;
         } else {
             return GGML_TYPE_F16;
         }
@@ -409,8 +411,7 @@ struct lora_merge_ctx {

 static void print_usage(int, char ** argv) {
     printf("\nexample usage:\n");
-    printf("\n  %s -m base-model.gguf --lora lora-file.gguf -o merged-model-f16.gguf\n", argv[0]);
-    printf("\nNOTE: output model is F16\n");
+    printf("\n  %s -m base-model.gguf --lora lora-file.gguf -o merged-model.gguf\n", argv[0]);
     printf("\n");
 }