diff --git a/src/core/ggml_graph_cut.cpp b/src/core/ggml_graph_cut.cpp index 79710058..a6e2d99e 100644 --- a/src/core/ggml_graph_cut.cpp +++ b/src/core/ggml_graph_cut.cpp @@ -482,6 +482,16 @@ namespace sd::ggml_graph_cut { return ggml_nbytes(cache_src); } + static bool can_ignore_op_params(ggml_op op) { + // Exempt only parameters that cannot affect graph layout or backend allocation size. + switch (op) { + case GGML_OP_SCALE: + return true; + default: + return false; + } + } + std::vector graph_layout(ggml_cgraph* graph, bool include_bindings) { std::vector tensors; std::unordered_map indices; @@ -530,8 +540,10 @@ namespace sd::ggml_graph_cut { for (auto source : tensor->src) { signature.push_back(source == nullptr ? 0 : indices.at(source)); } - for (int value : tensor->op_params) { - signature.push_back(static_cast(value)); + if (!can_ignore_op_params(tensor->op)) { + for (int value : tensor->op_params) { + signature.push_back(static_cast(value)); + } } } return signature;