Commit 4fffab623 for llama.cpp

commit 4fffab623eb37ca13a220489970b8915d5a5233c
Author: Joel Fernandes <joelagnelf@nvidia.com>
Date:   Thu Nov 12 02:42:45 2026 -0500

    llama : avoid touching unused graph metadata pages (#32043)

    Each graph result reserves metadata for max_nodes, but many graphs use
    only a fraction of that capacity.  The vector resize initializes the
    whole reserve and makes otherwise unused pages resident.  Allocate the
    reserve with new uint8_t[] instead.

diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp
index 1174909bc..cc7779164 100644
--- a/src/llama-graph.cpp
+++ b/src/llama-graph.cpp
@@ -1440,11 +1440,16 @@ void llm_graph_result::reset() {
     fused_nodes.clear();
     hdmd_inputs.clear();

-    buf_compute_meta.resize(ggml_tensor_overhead()*max_nodes + ggml_graph_overhead_custom(max_nodes, false));
+    const size_t meta_size = ggml_tensor_overhead()*max_nodes + ggml_graph_overhead_custom(max_nodes, false);
+    if (meta_size != buf_compute_meta_size) {
+        // not make_unique: it would zero the whole reserve and make its pages resident
+        buf_compute_meta.reset(new uint8_t[meta_size]);
+        buf_compute_meta_size = meta_size;
+    }

     ggml_init_params params = {
-        /*.mem_size   =*/ buf_compute_meta.size(),
-        /*.mem_buffer =*/ buf_compute_meta.data(),
+        /*.mem_size   =*/ buf_compute_meta_size,
+        /*.mem_buffer =*/ buf_compute_meta.get(),
         /*.no_alloc   =*/ true,
     };

diff --git a/src/llama-graph.h b/src/llama-graph.h
index 89370a97e..7eb6bf3d2 100644
--- a/src/llama-graph.h
+++ b/src/llama-graph.h
@@ -994,7 +994,8 @@ public:
     ggml_context_ptr ctx_compute;

     // memory buffers used to evaluate the model
-    std::vector<uint8_t> buf_compute_meta;
+    std::unique_ptr<uint8_t[]> buf_compute_meta;
+    size_t buf_compute_meta_size = 0;

     ggml_cgraph * gf;