From: rankaiyx Date: Mon, 27 Apr 2026 12:31:13 +0000 (+0800) Subject: Fix type casting for unaccounted memory calculation (#22424) X-Git-Tag: upstream/0.0.10438~1490 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=42401c72b8d239240ed0fb37694d29ac33b3bc4f;p=pkg%2Fggml%2Fsources%2Fllama.cpp Fix type casting for unaccounted memory calculation (#22424) --- diff --git a/common/fit.cpp b/common/fit.cpp index 4b9528890..aca3f4d40 100644 --- a/common/fit.cpp +++ b/common/fit.cpp @@ -856,7 +856,7 @@ void common_memory_breakdown_print(const struct llama_context * ctx) { ggml_backend_dev_memory(dev, &free, &total); const size_t self = mb.model + mb.context + mb.compute; - const size_t unaccounted = total - self - free; + const int64_t unaccounted = static_cast(total) - static_cast(free) - static_cast(self); table_data.push_back({ template_gpu, @@ -867,7 +867,7 @@ void common_memory_breakdown_print(const struct llama_context * ctx) { std::to_string(mb.model / MiB), std::to_string(mb.context / MiB), std::to_string(mb.compute / MiB), - std::to_string(unaccounted / MiB)}); + std::to_string(unaccounted / static_cast(MiB))}); } // print memory breakdown for host: