Krotos Modules 3
Loading...
Searching...
No Matches
ggml.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  ggml_object
 
struct  ggml_tensor
 
struct  ggml_cgraph
 
struct  ggml_scratch
 
struct  ggml_init_params
 
struct  ggml_opt_params
 
struct  quantize_fns_t
 

Macros

#define GGML_API
 
#define GGML_FILE_MAGIC   0x67676d6c
 
#define GGML_FILE_VERSION   1
 
#define GGML_MAX_DIMS   4
 
#define GGML_MAX_NODES   4096
 
#define GGML_MAX_PARAMS   16
 
#define GGML_MAX_CONTEXTS   64
 
#define GGML_MAX_OPT   4
 
#define GGML_DEFAULT_N_THREADS   4
 
#define GGML_ASSERT(x)
 
#define GGML_RESTRICT   restrict
 

Typedefs

typedef uint16_t ggml_fp16_t
 
typedef void(* ggml_unary_op_f32_t) (const int, float *, const float *)
 
typedef void(* ggml_binary_op_f32_t) (const int, float *, const float *, const float *)
 
typedef void(* dequantize_row_q_t) (const void *GGML_RESTRICT x, float *GGML_RESTRICT y, int k)
 
typedef void(* quantize_row_q_t) (const float *GGML_RESTRICT x, void *GGML_RESTRICT y, int k)
 
typedef void(* vec_dot_q_t) (const int n, float *GGML_RESTRICT s, const void *GGML_RESTRICT x, const void *GGML_RESTRICT y)
 

Enumerations

enum  ggml_type {
  GGML_TYPE_F32 = 0 , GGML_TYPE_F16 = 1 , GGML_TYPE_Q4_0 = 2 , GGML_TYPE_Q4_1 = 3 ,
  GGML_TYPE_Q4_2 = 4 , GGML_TYPE_Q5_0 = 6 , GGML_TYPE_Q5_1 = 7 , GGML_TYPE_Q8_0 = 8 ,
  GGML_TYPE_Q8_1 = 9 , GGML_TYPE_I8 , GGML_TYPE_I16 , GGML_TYPE_I32 ,
  GGML_TYPE_COUNT
}
 
enum  ggml_ftype {
  GGML_FTYPE_UNKNOWN = -1 , GGML_FTYPE_ALL_F32 = 0 , GGML_FTYPE_MOSTLY_F16 = 1 , GGML_FTYPE_MOSTLY_Q4_0 = 2 ,
  GGML_FTYPE_MOSTLY_Q4_1 = 3 , GGML_FTYPE_MOSTLY_Q4_1_SOME_F16 = 4 , GGML_FTYPE_MOSTLY_Q4_2 = 5 , GGML_FTYPE_MOSTLY_Q8_0 = 7 ,
  GGML_FTYPE_MOSTLY_Q5_0 = 8 , GGML_FTYPE_MOSTLY_Q5_1 = 9
}
 
enum  ggml_op {
  GGML_OP_NONE = 0 , GGML_OP_DUP , GGML_OP_ADD , GGML_OP_SUB ,
  GGML_OP_MUL , GGML_OP_DIV , GGML_OP_SQR , GGML_OP_SQRT ,
  GGML_OP_SUM , GGML_OP_MEAN , GGML_OP_REPEAT , GGML_OP_ABS ,
  GGML_OP_SGN , GGML_OP_NEG , GGML_OP_STEP , GGML_OP_RELU ,
  GGML_OP_GELU , GGML_OP_SILU , GGML_OP_NORM , GGML_OP_RMS_NORM ,
  GGML_OP_MUL_MAT , GGML_OP_SCALE , GGML_OP_CPY , GGML_OP_CONT ,
  GGML_OP_RESHAPE , GGML_OP_VIEW , GGML_OP_PERMUTE , GGML_OP_TRANSPOSE ,
  GGML_OP_GET_ROWS , GGML_OP_DIAG_MASK_INF , GGML_OP_SOFT_MAX , GGML_OP_ROPE ,
  GGML_OP_ALIBI , GGML_OP_CONV_1D_1S , GGML_OP_CONV_1D_2S , GGML_OP_FLASH_ATTN ,
  GGML_OP_FLASH_FF , GGML_OP_MAP_UNARY , GGML_OP_MAP_BINARY , GGML_OP_COUNT
}
 
enum  ggml_opt_type { GGML_OPT_ADAM , GGML_OPT_LBFGS }
 
enum  ggml_linesearch { GGML_LINESEARCH_DEFAULT = 1 , GGML_LINESEARCH_BACKTRACKING_ARMIJO = 0 , GGML_LINESEARCH_BACKTRACKING_WOLFE = 1 , GGML_LINESEARCH_BACKTRACKING_STRONG_WOLFE = 2 }
 
enum  ggml_opt_result {
  GGML_OPT_OK = 0 , GGML_OPT_DID_NOT_CONVERGE , GGML_OPT_NO_CONTEXT , GGML_OPT_INVALID_WOLFE ,
  GGML_OPT_FAIL , GGML_LINESEARCH_FAIL = -128 , GGML_LINESEARCH_MINIMUM_STEP , GGML_LINESEARCH_MAXIMUM_STEP ,
  GGML_LINESEARCH_MAXIMUM_ITERATIONS , GGML_LINESEARCH_INVALID_PARAMETERS
}
 

Functions

GGML_API float ggml_fp16_to_fp32 (ggml_fp16_t x)
 
GGML_API ggml_fp16_t ggml_fp32_to_fp16 (float x)
 
GGML_API void ggml_fp16_to_fp32_row (const ggml_fp16_t *x, float *y, size_t n)
 
GGML_API void ggml_fp32_to_fp16_row (const float *x, ggml_fp16_t *y, size_t n)
 
GGML_API void ggml_time_init (void)
 
GGML_API int64_t ggml_time_ms (void)
 
GGML_API int64_t ggml_time_us (void)
 
GGML_API int64_t ggml_cycles (void)
 
GGML_API int64_t ggml_cycles_per_ms (void)
 
GGML_API void ggml_print_object (const struct ggml_object *obj)
 
GGML_API void ggml_print_objects (const struct ggml_context *ctx)
 
GGML_API int64_t ggml_nelements (const struct ggml_tensor *tensor)
 
GGML_API size_t ggml_nbytes (const struct ggml_tensor *tensor)
 
GGML_API int ggml_blck_size (enum ggml_type type)
 
GGML_API size_t ggml_type_size (enum ggml_type type)
 
GGML_API float ggml_type_sizef (enum ggml_type type)
 
GGML_API const char * ggml_type_name (enum ggml_type type)
 
GGML_API size_t ggml_element_size (const struct ggml_tensor *tensor)
 
GGML_API bool ggml_is_quantized (enum ggml_type type)
 
GGML_API enum ggml_type ggml_ftype_to_ggml_type (enum ggml_ftype ftype)
 
GGML_API struct ggml_context * ggml_init (struct ggml_init_params params)
 
GGML_API void ggml_free (struct ggml_context *ctx)
 
GGML_API size_t ggml_used_mem (const struct ggml_context *ctx)
 
GGML_API size_t ggml_set_scratch (struct ggml_context *ctx, struct ggml_scratch scratch)
 
GGML_API struct ggml_tensorggml_new_tensor (struct ggml_context *ctx, enum ggml_type type, int n_dims, const int64_t *ne)
 
GGML_API struct ggml_tensorggml_new_tensor_1d (struct ggml_context *ctx, enum ggml_type type, int64_t ne0)
 
GGML_API struct ggml_tensorggml_new_tensor_2d (struct ggml_context *ctx, enum ggml_type type, int64_t ne0, int64_t ne1)
 
GGML_API struct ggml_tensorggml_new_tensor_3d (struct ggml_context *ctx, enum ggml_type type, int64_t ne0, int64_t ne1, int64_t ne2)
 
GGML_API struct ggml_tensorggml_new_tensor_4d (struct ggml_context *ctx, enum ggml_type type, int64_t ne0, int64_t ne1, int64_t ne2, int64_t ne3)
 
GGML_API struct ggml_tensorggml_new_i32 (struct ggml_context *ctx, int32_t value)
 
GGML_API struct ggml_tensorggml_new_f32 (struct ggml_context *ctx, float value)
 
GGML_API struct ggml_tensorggml_dup_tensor (struct ggml_context *ctx, const struct ggml_tensor *src)
 
GGML_API struct ggml_tensorggml_view_tensor (struct ggml_context *ctx, const struct ggml_tensor *src)
 
GGML_API struct ggml_tensorggml_set_zero (struct ggml_tensor *tensor)
 
GGML_API struct ggml_tensorggml_set_i32 (struct ggml_tensor *tensor, int32_t value)
 
GGML_API struct ggml_tensorggml_set_f32 (struct ggml_tensor *tensor, float value)
 
GGML_API int32_t ggml_get_i32_1d (const struct ggml_tensor *tensor, int i)
 
GGML_API void ggml_set_i32_1d (const struct ggml_tensor *tensor, int i, int32_t value)
 
GGML_API float ggml_get_f32_1d (const struct ggml_tensor *tensor, int i)
 
GGML_API void ggml_set_f32_1d (const struct ggml_tensor *tensor, int i, float value)
 
GGML_API void * ggml_get_data (const struct ggml_tensor *tensor)
 
GGML_API float * ggml_get_data_f32 (const struct ggml_tensor *tensor)
 
GGML_API const char * ggml_get_name (const struct ggml_tensor *tensor)
 
GGML_API void ggml_set_name (struct ggml_tensor *tensor, const char *name)
 
GGML_API struct ggml_tensorggml_dup (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_add (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_add_inplace (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_sub (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_mul (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_div (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_sqr (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_sqrt (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_sum (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_mean (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_repeat (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_abs (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_sgn (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_neg (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_step (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_relu (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_gelu (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_silu (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_norm (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_rms_norm (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_mul_mat (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_scale (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_cpy (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_cont (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_reshape (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_reshape_2d (struct ggml_context *ctx, struct ggml_tensor *a, int64_t ne0, int64_t ne1)
 
GGML_API struct ggml_tensorggml_reshape_3d (struct ggml_context *ctx, struct ggml_tensor *a, int64_t ne0, int64_t ne1, int64_t ne2)
 
GGML_API struct ggml_tensorggml_view_1d (struct ggml_context *ctx, struct ggml_tensor *a, int64_t ne0, size_t offset)
 
GGML_API struct ggml_tensorggml_view_2d (struct ggml_context *ctx, struct ggml_tensor *a, int64_t ne0, int64_t ne1, size_t nb1, size_t offset)
 
GGML_API struct ggml_tensorggml_view_3d (struct ggml_context *ctx, struct ggml_tensor *a, int64_t ne0, int64_t ne1, int64_t ne2, size_t nb1, size_t nb2, size_t offset)
 
GGML_API struct ggml_tensorggml_permute (struct ggml_context *ctx, struct ggml_tensor *a, int axis0, int axis1, int axis2, int axis3)
 
GGML_API struct ggml_tensorggml_transpose (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_get_rows (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_diag_mask_inf (struct ggml_context *ctx, struct ggml_tensor *a, int n_past)
 
GGML_API struct ggml_tensorggml_soft_max (struct ggml_context *ctx, struct ggml_tensor *a)
 
GGML_API struct ggml_tensorggml_rope (struct ggml_context *ctx, struct ggml_tensor *a, int n_past, int n_dims, int mode)
 
struct ggml_tensorggml_alibi (struct ggml_context *ctx, struct ggml_tensor *a, int n_past, int n_head)
 
GGML_API struct ggml_tensorggml_conv_1d_1s (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_conv_1d_2s (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b)
 
GGML_API struct ggml_tensorggml_flash_attn (struct ggml_context *ctx, struct ggml_tensor *q, struct ggml_tensor *k, struct ggml_tensor *v, bool masked)
 
GGML_API struct ggml_tensorggml_flash_ff (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b0, struct ggml_tensor *b1, struct ggml_tensor *c0, struct ggml_tensor *c1)
 
GGML_API struct ggml_tensorggml_map_unary_f32 (struct ggml_context *ctx, struct ggml_tensor *a, const ggml_unary_op_f32_t fun)
 
GGML_API struct ggml_tensorggml_map_binary_f32 (struct ggml_context *ctx, struct ggml_tensor *a, struct ggml_tensor *b, const ggml_binary_op_f32_t fun)
 
GGML_API void ggml_set_param (struct ggml_context *ctx, struct ggml_tensor *tensor)
 
GGML_API void ggml_build_forward_expand (struct ggml_cgraph *cgraph, struct ggml_tensor *tensor)
 
GGML_API struct ggml_cgraph ggml_build_forward (struct ggml_tensor *tensor)
 
GGML_API struct ggml_cgraph ggml_build_backward (struct ggml_context *ctx, struct ggml_cgraph *gf, bool keep)
 
GGML_API void ggml_graph_compute (struct ggml_context *ctx, struct ggml_cgraph *cgraph)
 
GGML_API void ggml_graph_reset (struct ggml_cgraph *cgraph)
 
GGML_API void ggml_graph_print (const struct ggml_cgraph *cgraph)
 
GGML_API void ggml_graph_dump_dot (const struct ggml_cgraph *gb, const struct ggml_cgraph *gf, const char *filename)
 
GGML_API struct ggml_opt_params ggml_opt_default_params (enum ggml_opt_type type)
 
GGML_API enum ggml_opt_result ggml_opt (struct ggml_context *ctx, struct ggml_opt_params params, struct ggml_tensor *f)
 
GGML_API size_t ggml_quantize_q4_0 (const float *src, void *dst, int n, int k, int64_t *hist)
 
GGML_API size_t ggml_quantize_q4_1 (const float *src, void *dst, int n, int k, int64_t *hist)
 
GGML_API size_t ggml_quantize_q4_2 (const float *src, void *dst, int n, int k, int64_t *hist)
 
GGML_API size_t ggml_quantize_q5_0 (const float *src, void *dst, int n, int k, int64_t *hist)
 
GGML_API size_t ggml_quantize_q5_1 (const float *src, void *dst, int n, int k, int64_t *hist)
 
GGML_API size_t ggml_quantize_q8_0 (const float *src, void *dst, int n, int k, int64_t *hist)
 
GGML_API size_t ggml_quantize_chunk (enum ggml_type type, const float *src, void *dst, int start, int n, int64_t *hist)
 
GGML_API int ggml_cpu_has_avx (void)
 
GGML_API int ggml_cpu_has_avx2 (void)
 
GGML_API int ggml_cpu_has_avx512 (void)
 
GGML_API int ggml_cpu_has_avx512_vbmi (void)
 
GGML_API int ggml_cpu_has_avx512_vnni (void)
 
GGML_API int ggml_cpu_has_fma (void)
 
GGML_API int ggml_cpu_has_neon (void)
 
GGML_API int ggml_cpu_has_arm_fma (void)
 
GGML_API int ggml_cpu_has_f16c (void)
 
GGML_API int ggml_cpu_has_fp16_va (void)
 
GGML_API int ggml_cpu_has_wasm_simd (void)
 
GGML_API int ggml_cpu_has_blas (void)
 
GGML_API int ggml_cpu_has_cublas (void)
 
GGML_API int ggml_cpu_has_clblast (void)
 
GGML_API int ggml_cpu_has_gpublas (void)
 
GGML_API int ggml_cpu_has_sse3 (void)
 
GGML_API int ggml_cpu_has_vsx (void)
 
quantize_fns_t ggml_internal_get_quantize_fn (size_t i)
 

Variables

static const size_t GGML_OBJECT_SIZE = sizeof(struct ggml_object)
 

Macro Definition Documentation

◆ GGML_API

#define GGML_API

◆ GGML_ASSERT

#define GGML_ASSERT ( x)
Value:
do \
{ \
if (!(x)) \
{ \
fprintf(stderr, "GGML_ASSERT: %s:%d: %s\n", __FILE__, __LINE__, #x); \
abort(); \
} \
} while (0)

◆ GGML_DEFAULT_N_THREADS

#define GGML_DEFAULT_N_THREADS   4

◆ GGML_FILE_MAGIC

#define GGML_FILE_MAGIC   0x67676d6c

◆ GGML_FILE_VERSION

#define GGML_FILE_VERSION   1

◆ GGML_MAX_CONTEXTS

#define GGML_MAX_CONTEXTS   64

◆ GGML_MAX_DIMS

#define GGML_MAX_DIMS   4

◆ GGML_MAX_NODES

#define GGML_MAX_NODES   4096

◆ GGML_MAX_OPT

#define GGML_MAX_OPT   4

◆ GGML_MAX_PARAMS

#define GGML_MAX_PARAMS   16

◆ GGML_RESTRICT

#define GGML_RESTRICT   restrict

Typedef Documentation

◆ dequantize_row_q_t

typedef void(* dequantize_row_q_t) (const void *GGML_RESTRICT x, float *GGML_RESTRICT y, int k)

◆ ggml_binary_op_f32_t

typedef void(* ggml_binary_op_f32_t) (const int, float *, const float *, const float *)

◆ ggml_fp16_t

typedef uint16_t ggml_fp16_t

◆ ggml_unary_op_f32_t

typedef void(* ggml_unary_op_f32_t) (const int, float *, const float *)

◆ quantize_row_q_t

typedef void(* quantize_row_q_t) (const float *GGML_RESTRICT x, void *GGML_RESTRICT y, int k)

◆ vec_dot_q_t

typedef void(* vec_dot_q_t) (const int n, float *GGML_RESTRICT s, const void *GGML_RESTRICT x, const void *GGML_RESTRICT y)

Enumeration Type Documentation

◆ ggml_ftype

enum ggml_ftype
Enumerator
GGML_FTYPE_UNKNOWN 
GGML_FTYPE_ALL_F32 
GGML_FTYPE_MOSTLY_F16 
GGML_FTYPE_MOSTLY_Q4_0 
GGML_FTYPE_MOSTLY_Q4_1 
GGML_FTYPE_MOSTLY_Q4_1_SOME_F16 
GGML_FTYPE_MOSTLY_Q4_2 
GGML_FTYPE_MOSTLY_Q8_0 
GGML_FTYPE_MOSTLY_Q5_0 
GGML_FTYPE_MOSTLY_Q5_1 

◆ ggml_linesearch

Enumerator
GGML_LINESEARCH_DEFAULT 
GGML_LINESEARCH_BACKTRACKING_ARMIJO 
GGML_LINESEARCH_BACKTRACKING_WOLFE 
GGML_LINESEARCH_BACKTRACKING_STRONG_WOLFE 

◆ ggml_op

enum ggml_op
Enumerator
GGML_OP_NONE 
GGML_OP_DUP 
GGML_OP_ADD 
GGML_OP_SUB 
GGML_OP_MUL 
GGML_OP_DIV 
GGML_OP_SQR 
GGML_OP_SQRT 
GGML_OP_SUM 
GGML_OP_MEAN 
GGML_OP_REPEAT 
GGML_OP_ABS 
GGML_OP_SGN 
GGML_OP_NEG 
GGML_OP_STEP 
GGML_OP_RELU 
GGML_OP_GELU 
GGML_OP_SILU 
GGML_OP_NORM 
GGML_OP_RMS_NORM 
GGML_OP_MUL_MAT 
GGML_OP_SCALE 
GGML_OP_CPY 
GGML_OP_CONT 
GGML_OP_RESHAPE 
GGML_OP_VIEW 
GGML_OP_PERMUTE 
GGML_OP_TRANSPOSE 
GGML_OP_GET_ROWS 
GGML_OP_DIAG_MASK_INF 
GGML_OP_SOFT_MAX 
GGML_OP_ROPE 
GGML_OP_ALIBI 
GGML_OP_CONV_1D_1S 
GGML_OP_CONV_1D_2S 
GGML_OP_FLASH_ATTN 
GGML_OP_FLASH_FF 
GGML_OP_MAP_UNARY 
GGML_OP_MAP_BINARY 
GGML_OP_COUNT 

◆ ggml_opt_result

Enumerator
GGML_OPT_OK 
GGML_OPT_DID_NOT_CONVERGE 
GGML_OPT_NO_CONTEXT 
GGML_OPT_INVALID_WOLFE 
GGML_OPT_FAIL 
GGML_LINESEARCH_FAIL 
GGML_LINESEARCH_MINIMUM_STEP 
GGML_LINESEARCH_MAXIMUM_STEP 
GGML_LINESEARCH_MAXIMUM_ITERATIONS 
GGML_LINESEARCH_INVALID_PARAMETERS 

◆ ggml_opt_type

Enumerator
GGML_OPT_ADAM 
GGML_OPT_LBFGS 

◆ ggml_type

enum ggml_type
Enumerator
GGML_TYPE_F32 
GGML_TYPE_F16 
GGML_TYPE_Q4_0 
GGML_TYPE_Q4_1 
GGML_TYPE_Q4_2 
GGML_TYPE_Q5_0 
GGML_TYPE_Q5_1 
GGML_TYPE_Q8_0 
GGML_TYPE_Q8_1 
GGML_TYPE_I8 
GGML_TYPE_I16 
GGML_TYPE_I32 
GGML_TYPE_COUNT 

Function Documentation

◆ ggml_abs()

GGML_API struct ggml_tensor * ggml_abs ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_add()

GGML_API struct ggml_tensor * ggml_add ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_add_inplace()

GGML_API struct ggml_tensor * ggml_add_inplace ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_alibi()

struct ggml_tensor * ggml_alibi ( struct ggml_context * ctx,
struct ggml_tensor * a,
int n_past,
int n_head )

◆ ggml_blck_size()

GGML_API int ggml_blck_size ( enum ggml_type type)

◆ ggml_build_backward()

GGML_API struct ggml_cgraph ggml_build_backward ( struct ggml_context * ctx,
struct ggml_cgraph * gf,
bool keep )

◆ ggml_build_forward()

GGML_API struct ggml_cgraph ggml_build_forward ( struct ggml_tensor * tensor)

◆ ggml_build_forward_expand()

GGML_API void ggml_build_forward_expand ( struct ggml_cgraph * cgraph,
struct ggml_tensor * tensor )

◆ ggml_cont()

GGML_API struct ggml_tensor * ggml_cont ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_conv_1d_1s()

GGML_API struct ggml_tensor * ggml_conv_1d_1s ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_conv_1d_2s()

GGML_API struct ggml_tensor * ggml_conv_1d_2s ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_cpu_has_arm_fma()

GGML_API int ggml_cpu_has_arm_fma ( void )

◆ ggml_cpu_has_avx()

GGML_API int ggml_cpu_has_avx ( void )

◆ ggml_cpu_has_avx2()

GGML_API int ggml_cpu_has_avx2 ( void )

◆ ggml_cpu_has_avx512()

GGML_API int ggml_cpu_has_avx512 ( void )

◆ ggml_cpu_has_avx512_vbmi()

GGML_API int ggml_cpu_has_avx512_vbmi ( void )

◆ ggml_cpu_has_avx512_vnni()

GGML_API int ggml_cpu_has_avx512_vnni ( void )

◆ ggml_cpu_has_blas()

GGML_API int ggml_cpu_has_blas ( void )

◆ ggml_cpu_has_clblast()

GGML_API int ggml_cpu_has_clblast ( void )

◆ ggml_cpu_has_cublas()

GGML_API int ggml_cpu_has_cublas ( void )

◆ ggml_cpu_has_f16c()

GGML_API int ggml_cpu_has_f16c ( void )

◆ ggml_cpu_has_fma()

GGML_API int ggml_cpu_has_fma ( void )

◆ ggml_cpu_has_fp16_va()

GGML_API int ggml_cpu_has_fp16_va ( void )

◆ ggml_cpu_has_gpublas()

GGML_API int ggml_cpu_has_gpublas ( void )

◆ ggml_cpu_has_neon()

GGML_API int ggml_cpu_has_neon ( void )

◆ ggml_cpu_has_sse3()

GGML_API int ggml_cpu_has_sse3 ( void )

◆ ggml_cpu_has_vsx()

GGML_API int ggml_cpu_has_vsx ( void )

◆ ggml_cpu_has_wasm_simd()

GGML_API int ggml_cpu_has_wasm_simd ( void )

◆ ggml_cpy()

GGML_API struct ggml_tensor * ggml_cpy ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_cycles()

GGML_API int64_t ggml_cycles ( void )

◆ ggml_cycles_per_ms()

GGML_API int64_t ggml_cycles_per_ms ( void )

◆ ggml_diag_mask_inf()

GGML_API struct ggml_tensor * ggml_diag_mask_inf ( struct ggml_context * ctx,
struct ggml_tensor * a,
int n_past )

◆ ggml_div()

GGML_API struct ggml_tensor * ggml_div ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_dup()

GGML_API struct ggml_tensor * ggml_dup ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_dup_tensor()

GGML_API struct ggml_tensor * ggml_dup_tensor ( struct ggml_context * ctx,
const struct ggml_tensor * src )

◆ ggml_element_size()

GGML_API size_t ggml_element_size ( const struct ggml_tensor * tensor)

◆ ggml_flash_attn()

GGML_API struct ggml_tensor * ggml_flash_attn ( struct ggml_context * ctx,
struct ggml_tensor * q,
struct ggml_tensor * k,
struct ggml_tensor * v,
bool masked )

◆ ggml_flash_ff()

GGML_API struct ggml_tensor * ggml_flash_ff ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b0,
struct ggml_tensor * b1,
struct ggml_tensor * c0,
struct ggml_tensor * c1 )

◆ ggml_fp16_to_fp32()

GGML_API float ggml_fp16_to_fp32 ( ggml_fp16_t x)

◆ ggml_fp16_to_fp32_row()

GGML_API void ggml_fp16_to_fp32_row ( const ggml_fp16_t * x,
float * y,
size_t n )

◆ ggml_fp32_to_fp16()

GGML_API ggml_fp16_t ggml_fp32_to_fp16 ( float x)

◆ ggml_fp32_to_fp16_row()

GGML_API void ggml_fp32_to_fp16_row ( const float * x,
ggml_fp16_t * y,
size_t n )

◆ ggml_free()

GGML_API void ggml_free ( struct ggml_context * ctx)

◆ ggml_ftype_to_ggml_type()

GGML_API enum ggml_type ggml_ftype_to_ggml_type ( enum ggml_ftype ftype)

◆ ggml_gelu()

GGML_API struct ggml_tensor * ggml_gelu ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_get_data()

GGML_API void * ggml_get_data ( const struct ggml_tensor * tensor)

◆ ggml_get_data_f32()

GGML_API float * ggml_get_data_f32 ( const struct ggml_tensor * tensor)

◆ ggml_get_f32_1d()

GGML_API float ggml_get_f32_1d ( const struct ggml_tensor * tensor,
int i )

◆ ggml_get_i32_1d()

GGML_API int32_t ggml_get_i32_1d ( const struct ggml_tensor * tensor,
int i )

◆ ggml_get_name()

GGML_API const char * ggml_get_name ( const struct ggml_tensor * tensor)

◆ ggml_get_rows()

GGML_API struct ggml_tensor * ggml_get_rows ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_graph_compute()

GGML_API void ggml_graph_compute ( struct ggml_context * ctx,
struct ggml_cgraph * cgraph )

◆ ggml_graph_dump_dot()

GGML_API void ggml_graph_dump_dot ( const struct ggml_cgraph * gb,
const struct ggml_cgraph * gf,
const char * filename )

◆ ggml_graph_print()

GGML_API void ggml_graph_print ( const struct ggml_cgraph * cgraph)

◆ ggml_graph_reset()

GGML_API void ggml_graph_reset ( struct ggml_cgraph * cgraph)

◆ ggml_init()

GGML_API struct ggml_context * ggml_init ( struct ggml_init_params params)

◆ ggml_internal_get_quantize_fn()

quantize_fns_t ggml_internal_get_quantize_fn ( size_t i)

◆ ggml_is_quantized()

GGML_API bool ggml_is_quantized ( enum ggml_type type)

◆ ggml_map_binary_f32()

GGML_API struct ggml_tensor * ggml_map_binary_f32 ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b,
const ggml_binary_op_f32_t fun )

◆ ggml_map_unary_f32()

GGML_API struct ggml_tensor * ggml_map_unary_f32 ( struct ggml_context * ctx,
struct ggml_tensor * a,
const ggml_unary_op_f32_t fun )

◆ ggml_mean()

GGML_API struct ggml_tensor * ggml_mean ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_mul()

GGML_API struct ggml_tensor * ggml_mul ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_mul_mat()

GGML_API struct ggml_tensor * ggml_mul_mat ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_nbytes()

GGML_API size_t ggml_nbytes ( const struct ggml_tensor * tensor)

◆ ggml_neg()

GGML_API struct ggml_tensor * ggml_neg ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_nelements()

GGML_API int64_t ggml_nelements ( const struct ggml_tensor * tensor)

◆ ggml_new_f32()

GGML_API struct ggml_tensor * ggml_new_f32 ( struct ggml_context * ctx,
float value )

◆ ggml_new_i32()

GGML_API struct ggml_tensor * ggml_new_i32 ( struct ggml_context * ctx,
int32_t value )

◆ ggml_new_tensor()

GGML_API struct ggml_tensor * ggml_new_tensor ( struct ggml_context * ctx,
enum ggml_type type,
int n_dims,
const int64_t * ne )

◆ ggml_new_tensor_1d()

GGML_API struct ggml_tensor * ggml_new_tensor_1d ( struct ggml_context * ctx,
enum ggml_type type,
int64_t ne0 )

◆ ggml_new_tensor_2d()

GGML_API struct ggml_tensor * ggml_new_tensor_2d ( struct ggml_context * ctx,
enum ggml_type type,
int64_t ne0,
int64_t ne1 )

◆ ggml_new_tensor_3d()

GGML_API struct ggml_tensor * ggml_new_tensor_3d ( struct ggml_context * ctx,
enum ggml_type type,
int64_t ne0,
int64_t ne1,
int64_t ne2 )

◆ ggml_new_tensor_4d()

GGML_API struct ggml_tensor * ggml_new_tensor_4d ( struct ggml_context * ctx,
enum ggml_type type,
int64_t ne0,
int64_t ne1,
int64_t ne2,
int64_t ne3 )

◆ ggml_norm()

GGML_API struct ggml_tensor * ggml_norm ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_opt()

GGML_API enum ggml_opt_result ggml_opt ( struct ggml_context * ctx,
struct ggml_opt_params params,
struct ggml_tensor * f )

◆ ggml_opt_default_params()

GGML_API struct ggml_opt_params ggml_opt_default_params ( enum ggml_opt_type type)

◆ ggml_permute()

GGML_API struct ggml_tensor * ggml_permute ( struct ggml_context * ctx,
struct ggml_tensor * a,
int axis0,
int axis1,
int axis2,
int axis3 )

◆ ggml_print_object()

GGML_API void ggml_print_object ( const struct ggml_object * obj)

◆ ggml_print_objects()

GGML_API void ggml_print_objects ( const struct ggml_context * ctx)

◆ ggml_quantize_chunk()

GGML_API size_t ggml_quantize_chunk ( enum ggml_type type,
const float * src,
void * dst,
int start,
int n,
int64_t * hist )

◆ ggml_quantize_q4_0()

GGML_API size_t ggml_quantize_q4_0 ( const float * src,
void * dst,
int n,
int k,
int64_t * hist )

◆ ggml_quantize_q4_1()

GGML_API size_t ggml_quantize_q4_1 ( const float * src,
void * dst,
int n,
int k,
int64_t * hist )

◆ ggml_quantize_q4_2()

GGML_API size_t ggml_quantize_q4_2 ( const float * src,
void * dst,
int n,
int k,
int64_t * hist )

◆ ggml_quantize_q5_0()

GGML_API size_t ggml_quantize_q5_0 ( const float * src,
void * dst,
int n,
int k,
int64_t * hist )

◆ ggml_quantize_q5_1()

GGML_API size_t ggml_quantize_q5_1 ( const float * src,
void * dst,
int n,
int k,
int64_t * hist )

◆ ggml_quantize_q8_0()

GGML_API size_t ggml_quantize_q8_0 ( const float * src,
void * dst,
int n,
int k,
int64_t * hist )

◆ ggml_relu()

GGML_API struct ggml_tensor * ggml_relu ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_repeat()

GGML_API struct ggml_tensor * ggml_repeat ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_reshape()

GGML_API struct ggml_tensor * ggml_reshape ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_reshape_2d()

GGML_API struct ggml_tensor * ggml_reshape_2d ( struct ggml_context * ctx,
struct ggml_tensor * a,
int64_t ne0,
int64_t ne1 )

◆ ggml_reshape_3d()

GGML_API struct ggml_tensor * ggml_reshape_3d ( struct ggml_context * ctx,
struct ggml_tensor * a,
int64_t ne0,
int64_t ne1,
int64_t ne2 )

◆ ggml_rms_norm()

GGML_API struct ggml_tensor * ggml_rms_norm ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_rope()

GGML_API struct ggml_tensor * ggml_rope ( struct ggml_context * ctx,
struct ggml_tensor * a,
int n_past,
int n_dims,
int mode )

◆ ggml_scale()

GGML_API struct ggml_tensor * ggml_scale ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_set_f32()

GGML_API struct ggml_tensor * ggml_set_f32 ( struct ggml_tensor * tensor,
float value )

◆ ggml_set_f32_1d()

GGML_API void ggml_set_f32_1d ( const struct ggml_tensor * tensor,
int i,
float value )

◆ ggml_set_i32()

GGML_API struct ggml_tensor * ggml_set_i32 ( struct ggml_tensor * tensor,
int32_t value )

◆ ggml_set_i32_1d()

GGML_API void ggml_set_i32_1d ( const struct ggml_tensor * tensor,
int i,
int32_t value )

◆ ggml_set_name()

GGML_API void ggml_set_name ( struct ggml_tensor * tensor,
const char * name )

◆ ggml_set_param()

GGML_API void ggml_set_param ( struct ggml_context * ctx,
struct ggml_tensor * tensor )

◆ ggml_set_scratch()

GGML_API size_t ggml_set_scratch ( struct ggml_context * ctx,
struct ggml_scratch scratch )

◆ ggml_set_zero()

GGML_API struct ggml_tensor * ggml_set_zero ( struct ggml_tensor * tensor)

◆ ggml_sgn()

GGML_API struct ggml_tensor * ggml_sgn ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_silu()

GGML_API struct ggml_tensor * ggml_silu ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_soft_max()

GGML_API struct ggml_tensor * ggml_soft_max ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_sqr()

GGML_API struct ggml_tensor * ggml_sqr ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_sqrt()

GGML_API struct ggml_tensor * ggml_sqrt ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_step()

GGML_API struct ggml_tensor * ggml_step ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_sub()

GGML_API struct ggml_tensor * ggml_sub ( struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b )

◆ ggml_sum()

GGML_API struct ggml_tensor * ggml_sum ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_time_init()

GGML_API void ggml_time_init ( void )

◆ ggml_time_ms()

GGML_API int64_t ggml_time_ms ( void )

◆ ggml_time_us()

GGML_API int64_t ggml_time_us ( void )

◆ ggml_transpose()

GGML_API struct ggml_tensor * ggml_transpose ( struct ggml_context * ctx,
struct ggml_tensor * a )

◆ ggml_type_name()

GGML_API const char * ggml_type_name ( enum ggml_type type)

◆ ggml_type_size()

GGML_API size_t ggml_type_size ( enum ggml_type type)

◆ ggml_type_sizef()

GGML_API float ggml_type_sizef ( enum ggml_type type)

◆ ggml_used_mem()

GGML_API size_t ggml_used_mem ( const struct ggml_context * ctx)

◆ ggml_view_1d()

GGML_API struct ggml_tensor * ggml_view_1d ( struct ggml_context * ctx,
struct ggml_tensor * a,
int64_t ne0,
size_t offset )

◆ ggml_view_2d()

GGML_API struct ggml_tensor * ggml_view_2d ( struct ggml_context * ctx,
struct ggml_tensor * a,
int64_t ne0,
int64_t ne1,
size_t nb1,
size_t offset )

◆ ggml_view_3d()

GGML_API struct ggml_tensor * ggml_view_3d ( struct ggml_context * ctx,
struct ggml_tensor * a,
int64_t ne0,
int64_t ne1,
int64_t ne2,
size_t nb1,
size_t nb2,
size_t offset )

◆ ggml_view_tensor()

GGML_API struct ggml_tensor * ggml_view_tensor ( struct ggml_context * ctx,
const struct ggml_tensor * src )

Variable Documentation

◆ GGML_OBJECT_SIZE

const size_t GGML_OBJECT_SIZE = sizeof(struct ggml_object)
static