Skip to content

Commit cad341d

Browse files
authored
metal : reduce command encoding overhead (#9698)
* metal : reduce command encoding overhead ggml-ci * metal : add comments
1 parent a90484c commit cad341d

File tree

5 files changed

+1899
-1811
lines changed

5 files changed

+1899
-1811
lines changed

examples/cvector-generator/pca.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,6 @@ static ggml_status compute_piter(
204204
ggml_backend_cpu_set_n_threads(model.backend, params.n_threads);
205205
}
206206

207-
// TODO: enable GPU support when support for GGML_OP_SQRT is added
208-
//#ifdef GGML_USE_METAL
209-
// if (ggml_backend_is_metal(model.backend)) {
210-
// ggml_backend_metal_set_n_cb(model.backend, params.n_threads);
211-
// }
212-
//#endif
213-
214207
ggml_status res = ggml_backend_graph_compute(model.backend, gf);
215208
if (res == GGML_STATUS_SUCCESS) {
216209
auto extract_i = [](std::string prefix, std::string str) -> int {

examples/llava/clip.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,12 +2444,6 @@ bool clip_image_batch_encode(clip_ctx * ctx, const int n_threads, const clip_ima
24442444
ggml_backend_cpu_set_n_threads(ctx->backend, n_threads);
24452445
}
24462446

2447-
#ifdef GGML_USE_METAL
2448-
if (ggml_backend_is_metal(ctx->backend)) {
2449-
ggml_backend_metal_set_n_cb(ctx->backend, n_threads);
2450-
}
2451-
#endif
2452-
24532447
ggml_backend_graph_compute(ctx->backend, gf);
24542448

24552449
// the last node is the embedding tensor

ggml/include/ggml-metal.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
#include <stddef.h>
2626
#include <stdbool.h>
2727

28-
// max memory buffers that can be mapped to the device
29-
#define GGML_METAL_MAX_BUFFERS 64
30-
3128
struct ggml_tensor;
3229
struct ggml_cgraph;
3330

@@ -48,8 +45,6 @@ GGML_API bool ggml_backend_is_metal(ggml_backend_t backend);
4845

4946
GGML_API GGML_CALL ggml_backend_buffer_t ggml_backend_metal_buffer_from_ptr(void * data, size_t size, size_t max_size);
5047

51-
GGML_API void ggml_backend_metal_set_n_cb(ggml_backend_t backend, int n_cb);
52-
5348
GGML_API void ggml_backend_metal_set_abort_callback(ggml_backend_t backend, ggml_abort_callback abort_callback, void * user_data);
5449

5550
GGML_API GGML_CALL ggml_backend_buffer_type_t ggml_backend_metal_buffer_type(void);

0 commit comments

Comments
 (0)