Skip to content

Commit 4be5ef5

Browse files
authored
metal : remove old API (#4919)
ggml-ci
1 parent 0ea069b commit 4be5ef5

File tree

7 files changed

+27
-427
lines changed

7 files changed

+27
-427
lines changed

Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ ifeq ($(UNAME_S),Darwin)
4343
endif
4444
endif
4545

46-
ifneq '' '$(or $(filter clean,$(MAKECMDGOALS)),$(LLAMA_METAL))'
47-
BUILD_TARGETS += metal
48-
endif
49-
5046
default: $(BUILD_TARGETS)
5147

5248
test: $(TEST_TARGETS)
@@ -671,11 +667,6 @@ lookup: examples/lookup/lookup.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
671667
passkey: examples/passkey/passkey.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
672668
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
673669

674-
ifdef LLAMA_METAL
675-
metal: examples/metal/metal.cpp ggml.o $(OBJS)
676-
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
677-
endif
678-
679670
ifeq ($(UNAME_S),Darwin)
680671
swift: examples/batched.swift
681672
(cd examples/batched.swift; make build)

examples/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ else()
3737
add_subdirectory(lookup)
3838
add_subdirectory(train-text-from-scratch)
3939
add_subdirectory(imatrix)
40-
if (LLAMA_METAL)
41-
add_subdirectory(metal)
42-
endif()
4340
if (LLAMA_BUILD_SERVER)
4441
add_subdirectory(server)
4542
endif()

examples/metal/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/metal/metal.cpp

Lines changed: 0 additions & 103 deletions
This file was deleted.

ggml-metal.h

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -36,64 +36,13 @@ struct ggml_cgraph;
3636
extern "C" {
3737
#endif
3838

39-
//
40-
// internal API
41-
// temporary exposed to user-code
42-
//
43-
44-
struct ggml_metal_context;
45-
46-
void ggml_metal_log_set_callback(ggml_log_callback log_callback, void * user_data);
47-
48-
// number of command buffers to use
49-
struct ggml_metal_context * ggml_metal_init(int n_cb);
50-
void ggml_metal_free(struct ggml_metal_context * ctx);
51-
52-
void * ggml_metal_host_malloc(size_t n);
53-
void ggml_metal_host_free (void * data);
54-
55-
// set the number of command buffers to use
56-
void ggml_metal_set_n_cb(struct ggml_metal_context * ctx, int n_cb);
57-
58-
// creates a mapping between a host memory buffer and a device memory buffer
59-
// - make sure to map all buffers used in the graph before calling ggml_metal_graph_compute
60-
// - the mapping is used during computation to determine the arguments of the compute kernels
61-
// - you don't need to keep the host memory buffer allocated as it is never accessed by Metal
62-
// - max_size specifies the maximum size of a tensor and is used to create shared views such
63-
// that it is guaranteed that the tensor will fit in at least one of the views
64-
//
65-
bool ggml_metal_add_buffer(
66-
struct ggml_metal_context * ctx,
67-
const char * name,
68-
void * data,
69-
size_t size,
70-
size_t max_size);
71-
72-
// set data from host memory into the device
73-
void ggml_metal_set_tensor(struct ggml_metal_context * ctx, struct ggml_tensor * t);
74-
75-
// get data from the device into host memory
76-
void ggml_metal_get_tensor(struct ggml_metal_context * ctx, struct ggml_tensor * t);
77-
78-
// try to find operations that can be run concurrently in the graph
79-
// you should run it again if the topology of your graph changes
80-
void ggml_metal_graph_find_concurrency(struct ggml_metal_context * ctx, struct ggml_cgraph * gf, bool check_mem);
81-
82-
// if the graph has been optimized for concurrently dispatch, return length of the concur_list if optimized
83-
int ggml_metal_if_optimized(struct ggml_metal_context * ctx);
84-
85-
// output the concur_list for ggml_alloc
86-
int * ggml_metal_get_concur_list(struct ggml_metal_context * ctx);
87-
88-
// same as ggml_graph_compute but uses Metal
89-
// creates gf->n_threads command buffers in parallel
90-
bool ggml_metal_graph_compute(struct ggml_metal_context * ctx, struct ggml_cgraph * gf);
91-
9239
//
9340
// backend API
9441
// user-code should use only these functions
9542
//
9643

44+
GGML_API void ggml_backend_metal_log_set_callback(ggml_log_callback log_callback, void * user_data);
45+
9746
GGML_API ggml_backend_t ggml_backend_metal_init(void);
9847

9948
GGML_API bool ggml_backend_is_metal(ggml_backend_t backend);

0 commit comments

Comments
 (0)