Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions ggml/include/ggml-backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,6 @@ extern "C" {
GGML_API int ggml_backend_sched_get_n_splits(ggml_backend_sched_t sched);
GGML_API int ggml_backend_sched_get_n_copies(ggml_backend_sched_t sched);

// Get the scheduler's current compute graph (the last one split/reserved).
// Its nodes are in execution order; each node's assigned backend is
// queryable via ggml_backend_sched_get_tensor_backend. Valid after
// ggml_backend_sched_reserve (which llama runs at context construction);
// before any graph is split the returned graph has n_nodes == 0. The
// scheduler owns the graph — do not free or mutate it. Never NULL for a
// valid sched. (titanium-chicken: memory/scheduler observability.)
GGML_API struct ggml_cgraph * ggml_backend_sched_get_graph(ggml_backend_sched_t sched);

GGML_API ggml_backend_buffer_type_t ggml_backend_sched_get_buffer_type(ggml_backend_sched_t sched, ggml_backend_t backend);
Expand Down
28 changes: 28 additions & 0 deletions ggml/include/ggml-metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,34 @@ GGML_BACKEND_API void ggml_backend_metal_capture_next_compute(ggml_backend_t bac

GGML_BACKEND_API ggml_backend_reg_t ggml_backend_metal_reg(void);

typedef struct ggml_metal_event * ggml_metal_event_t;

GGML_BACKEND_API ggml_metal_event_t ggml_backend_metal_event_init(ggml_backend_t backend);
GGML_BACKEND_API void ggml_backend_metal_event_free(ggml_backend_t backend, ggml_metal_event_t ev);

GGML_BACKEND_API void ggml_backend_metal_event_host_signal(ggml_metal_event_t ev, uint64_t value);
GGML_BACKEND_API bool ggml_backend_metal_event_host_wait (ggml_metal_event_t ev, uint64_t value, uint64_t timeout_ms);
GGML_BACKEND_API uint64_t ggml_backend_metal_event_host_value (ggml_metal_event_t ev);

GGML_BACKEND_API void ggml_backend_metal_set_boundary_schedule(
ggml_backend_t backend,
int n_cuts, struct ggml_tensor * const * cut_nodes, ggml_metal_event_t * sig_ev, const uint64_t * sig_val,
int n_waits, struct ggml_tensor * const * wait_nodes, ggml_metal_event_t * wait_ev, const uint64_t * wait_val);

// Restrict the boundary-scheduled (paged) compute path to the segments
// intersecting the inclusive node range [first_node, last_node], with an
// optional device-side blit of a boundary activation into the window before
// its first segment (in_src -> in_dst) and out of it after its last
// (out_src -> out_dst). Persistent and pointer-keyed like the boundary
// schedule; a graph containing neither endpoint encodes in full. Only
// meaningful while a boundary schedule is set.
GGML_BACKEND_API void ggml_backend_metal_set_encode_window(
ggml_backend_t backend,
struct ggml_tensor * first_node, struct ggml_tensor * last_node,
struct ggml_tensor * blit_in_src, struct ggml_tensor * blit_in_dst,
struct ggml_tensor * blit_out_src, struct ggml_tensor * blit_out_dst);
GGML_BACKEND_API void ggml_backend_metal_clear_encode_window(ggml_backend_t backend);

#ifdef __cplusplus
}
#endif
14 changes: 14 additions & 0 deletions ggml/src/ggml-metal/ggml-metal-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ void ggml_metal_event_wait (ggml_metal_t ctx, ggml_metal_event_t ev);

ggml_metal_event_t ggml_metal_get_ev_cpy(ggml_metal_t ctx);

ggml_metal_device_t ggml_metal_get_device(ggml_metal_t ctx);

void ggml_metal_set_boundary_schedule(
ggml_metal_t ctx,
int n_cuts, struct ggml_tensor * const * cut_nodes, ggml_metal_event_t * sig_ev, const uint64_t * sig_val,
int n_waits, struct ggml_tensor * const * wait_nodes, ggml_metal_event_t * wait_ev, const uint64_t * wait_val);

void ggml_metal_set_encode_window(
ggml_metal_t ctx,
struct ggml_tensor * first_node, struct ggml_tensor * last_node,
struct ggml_tensor * blit_in_src, struct ggml_tensor * blit_in_dst,
struct ggml_tensor * blit_out_src, struct ggml_tensor * blit_out_dst);
void ggml_metal_clear_encode_window(ggml_metal_t ctx);

void ggml_metal_set_n_cb (ggml_metal_t ctx, int n_cb);
void ggml_metal_set_abort_callback (ggml_metal_t ctx, ggml_abort_callback abort_callback, void * user_data);
bool ggml_metal_supports_family (ggml_metal_t ctx, int family);
Expand Down
Loading
Loading