From 923f53ae8f7a40f212bb994a9f58d3cc28500f81 Mon Sep 17 00:00:00 2001 From: MirariImmensitatemAstrorum Date: Fri, 18 Sep 2026 22:47:48 -0500 Subject: [PATCH] fix: update arena trim for current llama-context APIs Fix two compile regressions in the scratch-arena trim port introduced by 433ae2c1e88e11d3396c9e2311cb0a5f0f2e8805. Current upstream no longer has the historical src_ctx member used by the old ROCmFPX safety gate, so remove that stale check. The remaining target-context gate through cparams.ctx_type / cparams.ctx_other still prevents applying the optimization to the MTP/secondary context. Also cast llm_graph_result::get_max_nodes() to size_t before std::max(). Current upstream returns int64_t there, while ggml_backend_sched_new() expects a size_t graph size; GCC correctly rejects template deduction across the two different integer types. These are compile-only adaptations. They do not change when arena trimming is enabled, its 32 MiB threshold, scheduler replacement behavior, or the historical Qwen35/single-GPU/max2/ubatch512 safety envelope. --- src/llama-context.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/llama-context.cpp b/src/llama-context.cpp index af8d4ca7f08f..2f66f1c7a78d 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -1372,7 +1372,6 @@ llm_graph_result * llama_context::process_ubatch(const llama_ubatch & ubatch, ll cparams.n_rs_seq != 2 || cparams.n_seq_max != 1 || cparams.pipeline_parallel || - src_ctx || cparams.ctx_other || !audited_context || cparams.n_ubatch != 512) { @@ -1444,9 +1443,9 @@ llm_graph_result * llama_context::process_ubatch(const llama_ubatch & ubatch, ll size_t max_nodes = 0; for (const auto & graph_res : gf_res_prev) { - max_nodes = std::max(max_nodes, graph_res->get_max_nodes()); + max_nodes = std::max(max_nodes, static_cast(graph_res->get_max_nodes())); } - max_nodes = std::max(max_nodes, gf_res_reserve->get_max_nodes()); + max_nodes = std::max(max_nodes, static_cast(gf_res_reserve->get_max_nodes())); ggml_backend_sched_ptr replacement(ggml_backend_sched_new( backend_ptrs.data(),