mirror of
https://github.com/ollama/ollama.git
synced 2026-12-04 00:21:20 +00:00
MLX, MLX-C: version bump (#19647)
This commit is contained in:
1 parent
9b390157f2
commit
6140670fd1
5 files changed
+105
-18
No files matched your search
+1
-1
@@ -1 +1 @@
|
||||
57731b00e8bed710e0750e7356da9f18f8eb3e20
|
||||
a26f2d584a14ec619ae8db9a09be03becd47598a
|
||||
+1
-1
@@ -1 +1 @@
|
||||
54a70511f4ea151378d03b657a4fdd823386ea38
|
||||
fc344c986c4169d99f76b5d95ae6b4a58a359a63
|
||||
+14
-4
@@ -333,8 +333,16 @@ int (*mlx_distributed_init_)(
|
||||
mlx_distributed_group* res,
|
||||
bool strict,
|
||||
const char* bk /* may be null */) = NULL;
|
||||
int (*mlx_distributed_group_rank_)(mlx_distributed_group group) = NULL;
|
||||
int (*mlx_distributed_group_size_)(mlx_distributed_group group) = NULL;
|
||||
int (*mlx_distributed_init_with_all_gather_)(
|
||||
mlx_distributed_group* res,
|
||||
bool strict,
|
||||
const char* bk,
|
||||
mlx_distributed_all_gather_fn all_gather,
|
||||
void* payload,
|
||||
void (*dtor)(void*)) = NULL;
|
||||
int (*mlx_distributed_clear_backends_)(void) = NULL;
|
||||
int (*mlx_distributed_group_get_rank_)(int* res, mlx_distributed_group group) = NULL;
|
||||
int (*mlx_distributed_group_get_size_)(int* res, mlx_distributed_group group) = NULL;
|
||||
int (*mlx_distributed_group_split_)(
|
||||
mlx_distributed_group* res,
|
||||
mlx_distributed_group group,
|
||||
@@ -2748,8 +2756,10 @@ int mlx_dynamic_load_symbols(mlx_dynamic_handle handle) {
|
||||
CHECK_LOAD(handle, mlx_distributed_group_new);
|
||||
CHECK_LOAD(handle, mlx_distributed_group_free);
|
||||
CHECK_LOAD(handle, mlx_distributed_init);
|
||||
CHECK_LOAD(handle, mlx_distributed_group_rank);
|
||||
CHECK_LOAD(handle, mlx_distributed_group_size);
|
||||
CHECK_LOAD(handle, mlx_distributed_init_with_all_gather);
|
||||
CHECK_LOAD(handle, mlx_distributed_clear_backends);
|
||||
CHECK_LOAD(handle, mlx_distributed_group_get_rank);
|
||||
CHECK_LOAD(handle, mlx_distributed_group_get_size);
|
||||
CHECK_LOAD(handle, mlx_distributed_group_split);
|
||||
CHECK_LOAD(handle, mlx_distributed_is_available);
|
||||
CHECK_LOAD(handle, mlx_set_error_handler);
|
||||
|
||||
+34
-10
@@ -150,8 +150,10 @@
|
||||
#define mlx_distributed_group_new mlx_distributed_group_new_mlx_gen_orig_
|
||||
#define mlx_distributed_group_free mlx_distributed_group_free_mlx_gen_orig_
|
||||
#define mlx_distributed_init mlx_distributed_init_mlx_gen_orig_
|
||||
#define mlx_distributed_group_rank mlx_distributed_group_rank_mlx_gen_orig_
|
||||
#define mlx_distributed_group_size mlx_distributed_group_size_mlx_gen_orig_
|
||||
#define mlx_distributed_init_with_all_gather mlx_distributed_init_with_all_gather_mlx_gen_orig_
|
||||
#define mlx_distributed_clear_backends mlx_distributed_clear_backends_mlx_gen_orig_
|
||||
#define mlx_distributed_group_get_rank mlx_distributed_group_get_rank_mlx_gen_orig_
|
||||
#define mlx_distributed_group_get_size mlx_distributed_group_get_size_mlx_gen_orig_
|
||||
#define mlx_distributed_group_split mlx_distributed_group_split_mlx_gen_orig_
|
||||
#define mlx_distributed_is_available mlx_distributed_is_available_mlx_gen_orig_
|
||||
#define mlx_set_error_handler mlx_set_error_handler_mlx_gen_orig_
|
||||
@@ -832,8 +834,10 @@
|
||||
#undef mlx_distributed_group_new
|
||||
#undef mlx_distributed_group_free
|
||||
#undef mlx_distributed_init
|
||||
#undef mlx_distributed_group_rank
|
||||
#undef mlx_distributed_group_size
|
||||
#undef mlx_distributed_init_with_all_gather
|
||||
#undef mlx_distributed_clear_backends
|
||||
#undef mlx_distributed_group_get_rank
|
||||
#undef mlx_distributed_group_get_size
|
||||
#undef mlx_distributed_group_split
|
||||
#undef mlx_distributed_is_available
|
||||
#undef mlx_set_error_handler
|
||||
@@ -1694,8 +1698,16 @@ extern int (*mlx_distributed_init_)(
|
||||
mlx_distributed_group* res,
|
||||
bool strict,
|
||||
const char* bk /* may be null */);
|
||||
extern int (*mlx_distributed_group_rank_)(mlx_distributed_group group);
|
||||
extern int (*mlx_distributed_group_size_)(mlx_distributed_group group);
|
||||
extern int (*mlx_distributed_init_with_all_gather_)(
|
||||
mlx_distributed_group* res,
|
||||
bool strict,
|
||||
const char* bk,
|
||||
mlx_distributed_all_gather_fn all_gather,
|
||||
void* payload,
|
||||
void (*dtor)(void*));
|
||||
extern int (*mlx_distributed_clear_backends_)(void);
|
||||
extern int (*mlx_distributed_group_get_rank_)(int* res, mlx_distributed_group group);
|
||||
extern int (*mlx_distributed_group_get_size_)(int* res, mlx_distributed_group group);
|
||||
extern int (*mlx_distributed_group_split_)(
|
||||
mlx_distributed_group* res,
|
||||
mlx_distributed_group group,
|
||||
@@ -4582,11 +4594,23 @@ static inline int mlx_distributed_init(
|
||||
const char* bk /* may be null */) {
|
||||
return mlx_distributed_init_(res, strict, bk);
|
||||
}
|
||||
static inline int mlx_distributed_group_rank(mlx_distributed_group group) {
|
||||
return mlx_distributed_group_rank_(group);
|
||||
static inline int mlx_distributed_init_with_all_gather(
|
||||
mlx_distributed_group* res,
|
||||
bool strict,
|
||||
const char* bk,
|
||||
mlx_distributed_all_gather_fn all_gather,
|
||||
void* payload,
|
||||
void (*dtor)(void*)) {
|
||||
return mlx_distributed_init_with_all_gather_(res, strict, bk, all_gather, payload, dtor);
|
||||
}
|
||||
static inline int mlx_distributed_group_size(mlx_distributed_group group) {
|
||||
return mlx_distributed_group_size_(group);
|
||||
static inline int mlx_distributed_clear_backends(void) {
|
||||
return mlx_distributed_clear_backends_();
|
||||
}
|
||||
static inline int mlx_distributed_group_get_rank(int* res, mlx_distributed_group group) {
|
||||
return mlx_distributed_group_get_rank_(res, group);
|
||||
}
|
||||
static inline int mlx_distributed_group_get_size(int* res, mlx_distributed_group group) {
|
||||
return mlx_distributed_group_get_size_(res, group);
|
||||
}
|
||||
static inline int mlx_distributed_group_split(
|
||||
mlx_distributed_group* res,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#define MLX_DISTRIBUTED_GROUP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "mlx/c/stream.h"
|
||||
|
||||
@@ -41,15 +42,67 @@ int mlx_distributed_init(
|
||||
bool strict,
|
||||
const char* bk /* may be null */);
|
||||
|
||||
/**
|
||||
* Byte-level all-gather callback used by the JACCL side channel.
|
||||
*
|
||||
* \param rank The rank of the process.
|
||||
* \param size The size of the group.
|
||||
* \param src Pointer to this rank's data of size n_bytes.
|
||||
* \param dst Pointer to an output buffer of size size * n_bytes. After the
|
||||
* call, dst[rank * n_bytes, (rank+1) * n_bytes] contains the data from rank.
|
||||
* \param n_bytes The number of bytes contributed by each rank.
|
||||
* \param payload Opaque user data passed to the callback.
|
||||
* \return Zero on success, non-zero on failure.
|
||||
*/
|
||||
typedef int (*mlx_distributed_all_gather_fn)(
|
||||
int rank,
|
||||
int size,
|
||||
const char* src,
|
||||
char* dst,
|
||||
size_t n_bytes,
|
||||
void* payload);
|
||||
|
||||
/**
|
||||
* Initialize JACCL with a custom metadata all-gather callback.
|
||||
*
|
||||
* `bk` must be `jaccl`. The synchronous callback reads `n_bytes` from `src`
|
||||
* and fills `size * n_bytes` in `dst`, ordered by `rank`. Buffers are borrowed.
|
||||
* The callback returns zero on success, nonzero on failure.
|
||||
*
|
||||
* If a `jaccl` group is already cached, it is returned and `all_gather` is
|
||||
* never called: the callback is dropped and, with `dtor`, `payload` is
|
||||
* destroyed before this function returns. Call
|
||||
* `mlx_distributed_clear_backends()` first to initialize with a new callback.
|
||||
*
|
||||
* With `dtor`, ownership of `payload` transfers on entry, including failure.
|
||||
* Destruction occurs once after all references are released. Cached or
|
||||
* live groups may delay it. Without `dtor`, `payload` is borrowed and must
|
||||
* remain valid while the callback is retained.
|
||||
*
|
||||
* Returns zero on success, nonzero on error. `res` is unchanged on failure.
|
||||
*/
|
||||
int mlx_distributed_init_with_all_gather(
|
||||
mlx_distributed_group* res,
|
||||
bool strict,
|
||||
const char* bk,
|
||||
mlx_distributed_all_gather_fn all_gather,
|
||||
void* payload,
|
||||
void (*dtor)(void*));
|
||||
|
||||
/**
|
||||
* Clear the distributed backend cache.
|
||||
*/
|
||||
int mlx_distributed_clear_backends(void);
|
||||
|
||||
/**
|
||||
* Get the rank.
|
||||
*/
|
||||
int mlx_distributed_group_rank(mlx_distributed_group group);
|
||||
int mlx_distributed_group_get_rank(int* res, mlx_distributed_group group);
|
||||
|
||||
/**
|
||||
* Get the group size.
|
||||
*/
|
||||
int mlx_distributed_group_size(mlx_distributed_group group);
|
||||
int mlx_distributed_group_get_size(int* res, mlx_distributed_group group);
|
||||
|
||||
/**
|
||||
* Split the group.
|
||||
|
||||
Reference in new issue
Block a user