Skip to content

Commit a00ef86

Browse files
committed
address review comments
1 parent 9669388 commit a00ef86

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ggml/src/ggml-cuda/common.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,11 +1173,11 @@ struct ggml_cuda_graph {
11731173
std::vector<cudaGraphNode_t> nodes;
11741174
bool disable_due_to_gpu_arch = false;
11751175
bool warmup_complete = false;
1176-
struct node_property {
1176+
struct node_properties {
11771177
ggml_tensor node;
11781178
void * node_src_data_ptrs[GGML_MAX_SRC];
11791179
};
1180-
std::vector<node_property> nodes_props;
1180+
std::vector<node_properties> node_props;
11811181

11821182
bool is_enabled() const {
11831183
static const bool disable_cuda_graphs_due_to_env = (getenv("GGML_CUDA_DISABLE_GRAPHS") != nullptr);

ggml/src/ggml-cuda/ggml-cuda.cu

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,25 +2979,25 @@ static bool ggml_cuda_graph_update_required(ggml_backend_cuda_context * cuda_ctx
29792979
ggml_cuda_graph * graph = cuda_ctx->cuda_graph(graph_key);
29802980

29812981
// Check if the graph size has changed
2982-
if ((int)graph->nodes_props.size() != cgraph->n_nodes) {
2982+
if ((int)graph->node_props.size() != cgraph->n_nodes) {
29832983
res = true;
2984-
graph->nodes_props.resize(cgraph->n_nodes);
2984+
graph->node_props.resize(cgraph->n_nodes);
29852985
}
29862986

29872987
for (int i = 0; i < cgraph->n_nodes; i++) {
2988-
ggml_cuda_graph::node_property prop = {};
2988+
ggml_cuda_graph::node_properties prop = {};
29892989
memcpy(&prop.node, cgraph->nodes[i], sizeof(ggml_tensor));
29902990

2991-
// src->data being same is enough to guarantee that node->srcs are consistent. ref:
2991+
// if the backend scheduler is making copies of CPU tensors, the src pointers can be the same but with different data, see:
29922992
// https://github.com/ggml-org/llama.cpp/pull/21472#discussion_r3052235188
29932993
for (int j = 0; j < GGML_MAX_SRC; ++j) {
29942994
prop.node_src_data_ptrs[j] = cgraph->nodes[i]->src[j] ? cgraph->nodes[i]->src[j]->data : nullptr;
29952995
}
29962996

2997-
if (!res && memcmp(&graph->nodes_props[i], &prop, sizeof(prop)) != 0) {
2997+
if (!res && memcmp(&graph->node_props[i], &prop, sizeof(prop)) != 0) {
29982998
res = true;
29992999
}
3000-
graph->nodes_props[i] = prop;
3000+
graph->node_props[i] = prop;
30013001
}
30023002

30033003
return res;

0 commit comments

Comments
 (0)