From: Raul Torres Date: Mon, 24 Nov 2025 02:02:52 +0000 (+0000) Subject: CANN: Define `cann_graph_update_required` before macro (llama/17434) X-Git-Tag: upstream/0.9.4.395~129 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=1faf24c005b06158ad201285f2ef84dfe8a94ae8;p=pkg%2Fggml%2Fsources%2Fggml CANN: Define `cann_graph_update_required` before macro (llama/17434) **Description of the problem** `cann_graph_update_required` is redundantly defined and initialized as `false` inside two mutually exclusive macro branches. **Proposed solution** Define it right before the macro so that it could serve both branches. --- diff --git a/src/ggml-cann/ggml-cann.cpp b/src/ggml-cann/ggml-cann.cpp index 5cbf5683..3c67c48f 100644 --- a/src/ggml-cann/ggml-cann.cpp +++ b/src/ggml-cann/ggml-cann.cpp @@ -2303,9 +2303,9 @@ static enum ggml_status ggml_backend_cann_graph_compute(ggml_backend_t backend, // calculate rope cache for fist layer in current device. cann_ctx->rope_cache.cached = false; + bool cann_graph_update_required = false; #ifdef USE_ACL_GRAPH bool use_cann_graph = true; - bool cann_graph_update_required = false; static bool prefill_use_graph = parse_bool(get_env("GGML_CANN_PREFILL_USE_GRAPH").value_or("")); if (!prefill_use_graph) { @@ -2336,7 +2336,6 @@ static enum ggml_status ggml_backend_cann_graph_compute(ggml_backend_t backend, } #else bool use_cann_graph = false; - bool cann_graph_update_required = false; #endif // USE_ACL_GRAPH evaluate_and_capture_cann_graph(cann_ctx, cgraph, use_cann_graph, cann_graph_update_required);