@@ -1945,38 +1945,13 @@ struct ggml_backend_graph_copy ggml_backend_graph_copy(ggml_backend_t backend, s
19451945
19461946 // allocate nodes
19471947 ggml_backend_buffer_t buffer = ggml_backend_alloc_ctx_tensors (ctx_allocated, backend);
1948-
1949- // This is an absolute hack, but it is only to try to force the use of the
1950- // extra repack buffers to see if I can come up with a better way or get
1951- // some feeback from others how to go about doing this.
1952- ggml_backend_buffer_t extra_buffer = nullptr ;
1953- std::vector<ggml_backend_buffer_type_t > extra_buft_list;
1954- auto * dev = ggml_backend_get_device (backend);
1955- auto * reg = ggml_backend_dev_backend_reg (dev);
1956- auto get_extra_bufts_fn = (ggml_backend_dev_get_extra_bufts_t ) ggml_backend_reg_get_proc_address (reg, " ggml_backend_dev_get_extra_bufts" );
1957- if (get_extra_bufts_fn) {
1958- ggml_backend_buffer_type_t * extra_bufts = get_extra_bufts_fn (dev);
1959- while (extra_bufts && *extra_bufts) {
1960- extra_buft_list.push_back (*extra_bufts);
1961- ++extra_bufts;
1962- }
1963- }
1964- if (extra_buft_list.size () > 0 ) {
1965- // Setting size to 1 just to ensure that the underlying extra buffer
1966- // allocation is called. In the case of the repack buffer it does not
1967- // really use the buffer and the repacking is done directory on the
1968- // tensor data.
1969- extra_buffer = ggml_backend_buft_alloc_buffer (extra_buft_list[0 ], 1 );
1970- }
1971-
19721948 if (buffer == NULL ) {
19731949 GGML_LOG_ERROR (" %s: failed to allocate buffer for graph copy\n " , __func__);
19741950 ggml_hash_set_free (&hash_set);
19751951 free (node_copies);
19761952 free (node_init);
19771953 ggml_free (ctx_allocated);
19781954 ggml_free (ctx_unallocated);
1979- ggml_backend_buffer_free (extra_buffer);
19801955 return {
19811956 /* .buffer = */ NULL ,
19821957 /* .ctx_allocated = */ NULL ,
@@ -1990,16 +1965,6 @@ struct ggml_backend_graph_copy ggml_backend_graph_copy(ggml_backend_t backend, s
19901965 // copy data and init views
19911966 for (int i = 0 ; i < graph->n_nodes ; i++) {
19921967 struct ggml_tensor * node = graph->nodes [i];
1993-
1994- // Again just here to see if I can get the repacking to work.
1995- if (extra_buffer && !ggml_op_is_empty (node->op ) && node->src [0 ]) {
1996- size_t id = ggml_hash_find (&hash_set, node);
1997- ggml_status status = ggml_backend_buffer_init_tensor (extra_buffer, node_copies[id]);
1998- if (status != GGML_STATUS_SUCCESS) {
1999- GGML_LOG_ERROR (" %s: failed to initialize tensor in extra buffer for graph copy\n " , __func__);
2000- }
2001- }
2002-
20031968 graph_copy_init_tensor (&hash_set, node_copies, node_init, node);
20041969 }
20051970
@@ -2015,7 +1980,6 @@ struct ggml_backend_graph_copy ggml_backend_graph_copy(ggml_backend_t backend, s
20151980 ggml_hash_set_free (&hash_set);
20161981 free (node_copies);
20171982 free (node_init);
2018- ggml_backend_buffer_free (extra_buffer);
20191983
20201984 return {
20211985 /* .buffer = */ buffer,
0 commit comments