mirror of
https://github.com/ollama/ollama.git
synced 2026-11-08 02:16:57 -06:00
The MLX runner is the only Go inference runner left and is no longer experimental, so its packages leave x/. The bindings become a top-level mlx package beside the carried patches in mlx/compat, mirroring how llama/ holds the llama.cpp integration, and the runner becomes mlxrunner with the architectures nested under the package they implement. Subpackages move with their parent unless listed. x/mlxrunner/mlx mlx x/internal/mlxthread mlx/mlxthread x/internal/mlxthreadtest mlx/mlxthread/mlxthreadtest x/internal/mlxtest mlx/mlxtest x/quant mlx/quant mlx/compat/*.patch mlx/compat/mlx-c (MLX patches go in mlx/compat/mlx) x/mlxrunner mlxrunner x/models/nn mlxrunner/nn x/models/<arch> mlxrunner/model/<arch> x/mlxrunner/imports.go mlxrunner/model/architectures (new package) x/create create x/safetensors fs/safetensors x/tokenizer mlxrunner/tokenizer Every package keeps its name, so the Go changes are the import path rewrites the moves force, and the CMake, Dockerfile, CI cache keys, drift check and Darwin payload script follow the new paths. Four edits are not paths: the runner's blank architecture imports become the package mlxrunner/model/architectures, so the list to extend for a new model sits beside the architecture directories; a depguard rule keeps the two test harnesses out of non-test code, as the x/internal placement used to; the CI change filter's two entries for the long-deleted x/imagegen/mlx now name the bindings' CMake project and the carried patches, so a change to either builds the payload; and the tokenizer parity test reads its fixtures from its own testdata instead of walking out of x/. x/server and x/imagegen/manifest stay for the next two commits.
164 lines
5.1 KiB
C
164 lines
5.1 KiB
C
/* Copyright © 2023-2024 Apple Inc. */
|
|
/* */
|
|
/* This file is auto-generated. Do not edit manually. */
|
|
/* */
|
|
|
|
#ifndef MLX_VECTOR_H
|
|
#define MLX_VECTOR_H
|
|
|
|
#include "mlx/c/array.h"
|
|
#include "mlx/c/stream.h"
|
|
#include "mlx/c/string.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* \defgroup mlx_vector Vectors
|
|
* MLX vector objects.
|
|
*/
|
|
/**@{*/
|
|
|
|
/**
|
|
* A vector of array.
|
|
*/
|
|
typedef struct mlx_vector_array_ {
|
|
void* ctx;
|
|
} mlx_vector_array;
|
|
mlx_vector_array mlx_vector_array_new(void);
|
|
int mlx_vector_array_set(mlx_vector_array* vec, const mlx_vector_array src);
|
|
int mlx_vector_array_free(mlx_vector_array vec);
|
|
mlx_vector_array mlx_vector_array_new_data(const mlx_array* data, size_t size);
|
|
mlx_vector_array mlx_vector_array_new_value(const mlx_array val);
|
|
int mlx_vector_array_set_data(
|
|
mlx_vector_array* vec,
|
|
const mlx_array* data,
|
|
size_t size);
|
|
int mlx_vector_array_set_value(mlx_vector_array* vec, const mlx_array val);
|
|
int mlx_vector_array_append_data(
|
|
mlx_vector_array vec,
|
|
const mlx_array* data,
|
|
size_t size);
|
|
int mlx_vector_array_append_value(mlx_vector_array vec, const mlx_array val);
|
|
size_t mlx_vector_array_size(mlx_vector_array vec);
|
|
int mlx_vector_array_get(
|
|
mlx_array* res,
|
|
const mlx_vector_array vec,
|
|
size_t idx);
|
|
|
|
/**
|
|
* A vector of vector_array.
|
|
*/
|
|
typedef struct mlx_vector_vector_array_ {
|
|
void* ctx;
|
|
} mlx_vector_vector_array;
|
|
mlx_vector_vector_array mlx_vector_vector_array_new(void);
|
|
int mlx_vector_vector_array_set(
|
|
mlx_vector_vector_array* vec,
|
|
const mlx_vector_vector_array src);
|
|
int mlx_vector_vector_array_free(mlx_vector_vector_array vec);
|
|
mlx_vector_vector_array mlx_vector_vector_array_new_data(
|
|
const mlx_vector_array* data,
|
|
size_t size);
|
|
mlx_vector_vector_array mlx_vector_vector_array_new_value(
|
|
const mlx_vector_array val);
|
|
int mlx_vector_vector_array_set_data(
|
|
mlx_vector_vector_array* vec,
|
|
const mlx_vector_array* data,
|
|
size_t size);
|
|
int mlx_vector_vector_array_set_value(
|
|
mlx_vector_vector_array* vec,
|
|
const mlx_vector_array val);
|
|
int mlx_vector_vector_array_append_data(
|
|
mlx_vector_vector_array vec,
|
|
const mlx_vector_array* data,
|
|
size_t size);
|
|
int mlx_vector_vector_array_append_value(
|
|
mlx_vector_vector_array vec,
|
|
const mlx_vector_array val);
|
|
size_t mlx_vector_vector_array_size(mlx_vector_vector_array vec);
|
|
int mlx_vector_vector_array_get(
|
|
mlx_vector_array* res,
|
|
const mlx_vector_vector_array vec,
|
|
size_t idx);
|
|
|
|
/**
|
|
* A vector of int.
|
|
*/
|
|
typedef struct mlx_vector_int_ {
|
|
void* ctx;
|
|
} mlx_vector_int;
|
|
mlx_vector_int mlx_vector_int_new(void);
|
|
int mlx_vector_int_set(mlx_vector_int* vec, const mlx_vector_int src);
|
|
int mlx_vector_int_free(mlx_vector_int vec);
|
|
mlx_vector_int mlx_vector_int_new_data(int* data, size_t size);
|
|
mlx_vector_int mlx_vector_int_new_value(int val);
|
|
int mlx_vector_int_set_data(mlx_vector_int* vec, int* data, size_t size);
|
|
int mlx_vector_int_set_value(mlx_vector_int* vec, int val);
|
|
int mlx_vector_int_append_data(mlx_vector_int vec, int* data, size_t size);
|
|
int mlx_vector_int_append_value(mlx_vector_int vec, int val);
|
|
size_t mlx_vector_int_size(mlx_vector_int vec);
|
|
int mlx_vector_int_get(int* res, const mlx_vector_int vec, size_t idx);
|
|
|
|
/**
|
|
* A vector of string.
|
|
*/
|
|
typedef struct mlx_vector_string_ {
|
|
void* ctx;
|
|
} mlx_vector_string;
|
|
mlx_vector_string mlx_vector_string_new(void);
|
|
int mlx_vector_string_set(mlx_vector_string* vec, const mlx_vector_string src);
|
|
int mlx_vector_string_free(mlx_vector_string vec);
|
|
mlx_vector_string mlx_vector_string_new_data(const char** data, size_t size);
|
|
mlx_vector_string mlx_vector_string_new_value(const char* val);
|
|
int mlx_vector_string_set_data(
|
|
mlx_vector_string* vec,
|
|
const char** data,
|
|
size_t size);
|
|
int mlx_vector_string_set_value(mlx_vector_string* vec, const char* val);
|
|
int mlx_vector_string_append_data(
|
|
mlx_vector_string vec,
|
|
const char** data,
|
|
size_t size);
|
|
int mlx_vector_string_append_value(mlx_vector_string vec, const char* val);
|
|
size_t mlx_vector_string_size(mlx_vector_string vec);
|
|
int mlx_vector_string_get(char** res, const mlx_vector_string vec, size_t idx);
|
|
|
|
/**
|
|
* A vector of stream.
|
|
*/
|
|
typedef struct mlx_vector_stream_ {
|
|
void* ctx;
|
|
} mlx_vector_stream;
|
|
mlx_vector_stream mlx_vector_stream_new(void);
|
|
int mlx_vector_stream_set(mlx_vector_stream* vec, const mlx_vector_stream src);
|
|
int mlx_vector_stream_free(mlx_vector_stream vec);
|
|
mlx_vector_stream mlx_vector_stream_new_data(
|
|
const mlx_stream* data,
|
|
size_t size);
|
|
mlx_vector_stream mlx_vector_stream_new_value(const mlx_stream val);
|
|
int mlx_vector_stream_set_data(
|
|
mlx_vector_stream* vec,
|
|
const mlx_stream* data,
|
|
size_t size);
|
|
int mlx_vector_stream_set_value(mlx_vector_stream* vec, const mlx_stream val);
|
|
int mlx_vector_stream_append_data(
|
|
mlx_vector_stream vec,
|
|
const mlx_stream* data,
|
|
size_t size);
|
|
int mlx_vector_stream_append_value(mlx_vector_stream vec, const mlx_stream val);
|
|
size_t mlx_vector_stream_size(mlx_vector_stream vec);
|
|
int mlx_vector_stream_get(
|
|
mlx_stream* res,
|
|
const mlx_vector_stream vec,
|
|
size_t idx);
|
|
|
|
/**@}*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|