File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1122,7 +1122,7 @@ struct ggml_tensor_extra_gpu {
11221122#endif
11231123
11241124struct ggml_cuda_graph_node_properties {
1125- void * node_address ;
1125+ void * node_data ;
11261126 ggml_op node_op;
11271127 int32_t flags;
11281128 int64_t ne[GGML_MAX_DIMS ];
@@ -1131,6 +1131,8 @@ struct ggml_cuda_graph_node_properties {
11311131 int32_t op_params[GGML_MAX_OP_PARAMS / sizeof (int32_t )];
11321132};
11331133
1134+ static_assert (std::is_trivial<ggml_cuda_graph_node_properties>::value, " ggml_cuda_graph_node_properties must be trivial" );
1135+
11341136struct ggml_cuda_graph {
11351137#ifdef USE_CUDA_GRAPH
11361138 ~ggml_cuda_graph () {
@@ -1149,6 +1151,11 @@ struct ggml_cuda_graph {
11491151 bool disable_due_to_too_many_updates = false ;
11501152 int number_consecutive_updates = 0 ;
11511153 std::vector<ggml_cuda_graph_node_properties> props;
1154+
1155+ // these are extra tensors (inputs) that participate in the ggml graph but are not nodes
1156+ // they properties also have to match in order to be able to safely reuse a CUDA graph
1157+ // ref: https://github.com/ggml-org/llama.cpp/pull/18583
1158+ // ref: https://github.com/ggml-org/llama.cpp/pull/19165
11521159 std::vector<ggml_cuda_graph_node_properties> extra;
11531160
11541161 void record_update (bool use_graph, bool update_required) {
Original file line number Diff line number Diff line change @@ -2918,7 +2918,7 @@ static bool ggml_cuda_graph_check_compability(ggml_cgraph * cgraph) {
29182918
29192919static void ggml_cuda_graph_node_set_properties (ggml_cuda_graph_node_properties * props, ggml_tensor * node) {
29202920 memset (props, 0 , sizeof (ggml_cuda_graph_node_properties));
2921- props->node_address = node->data ;
2921+ props->node_data = node->data ;
29222922 props->node_op = node->op ;
29232923 props->flags = node->flags ;
29242924 for (int i = 0 ; i < GGML_MAX_DIMS ; i++) {
@@ -2936,8 +2936,7 @@ static void ggml_cuda_graph_node_set_properties(ggml_cuda_graph_node_properties
29362936}
29372937
29382938static bool ggml_cuda_graph_node_properties_match (ggml_tensor * node, ggml_cuda_graph_node_properties * props) {
2939- if (node->data != props->node_address &&
2940- node->op != GGML_OP_VIEW ) {
2939+ if (node->data != props->node_data && node->op != GGML_OP_VIEW ) {
29412940 return false ;
29422941 }
29432942
You can’t perform that action at this time.
0 commit comments