Remove "internal" header files

Move into main header with comment not to use, per PR feedback
This commit is contained in:
Håkon H. Hitland 2023-04-05 22:18:58 +02:00
parent 63cfa43200
commit 41d4a863c9
7 changed files with 31 additions and 43 deletions

View file

@ -1,7 +1,5 @@
#include "ggml.h"
#include "ggml_internal.h"
#include "llama.h"
#include "llama_internal.h"
#include <algorithm>
#include <cassert>

1
ggml.c
View file

@ -2,7 +2,6 @@
#define _GNU_SOURCE
#include "ggml.h"
#include "ggml_internal.h"
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <malloc.h> // using malloc.h with MSC/MINGW

24
ggml.h
View file

@ -773,6 +773,30 @@ int ggml_cpu_has_blas(void);
int ggml_cpu_has_sse3(void);
int ggml_cpu_has_vsx(void);
//
// Internal types and functions exposed for tests and benchmarks
//
#ifdef __cplusplus
// restrict not standard in C++
#define GGML_RESTRICT
#else
#define GGML_RESTRICT restrict
#endif
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);
typedef struct {
dequantize_row_q_t dequantize_row_q;
quantize_row_q_t quantize_row_q;
quantize_row_q_t quantize_row_q_reference;
vec_dot_q_t vec_dot_q;
} quantize_fns_t;
quantize_fns_t ggml_internal_get_quantize_fn(size_t i);
#ifdef __cplusplus
}
#endif

View file

@ -1,26 +0,0 @@
#pragma once
// Internal functions exposed for tests and benchmarks
#ifdef __cplusplus
// restrict not standard in C++
#define restrict
extern "C" {
#endif
typedef void (*dequantize_row_q_t)(const void * restrict x, float * restrict y, int k);
typedef void (*quantize_row_q_t)(const float * restrict x, void * restrict y, int k);
typedef void (*vec_dot_q_t)(const int n, float * restrict s, const void * restrict x, const void * restrict y);
typedef struct {
dequantize_row_q_t dequantize_row_q;
quantize_row_q_t quantize_row_q;
quantize_row_q_t quantize_row_q_reference;
vec_dot_q_t vec_dot_q;
} quantize_fns_t;
quantize_fns_t ggml_internal_get_quantize_fn(size_t i);
#ifdef __cplusplus
}
#endif

View file

@ -1,5 +1,4 @@
#include "llama.h"
#include "llama_internal.h"
#include "ggml.h"

View file

@ -164,6 +164,13 @@ extern "C" {
#ifdef __cplusplus
}
#include <string>
#include <unordered_map>
//
// Internal function exposed for tests and benchmarks
//
std::unordered_map<std::string, struct ggml_tensor *>& llama_internal_get_tensor_map(struct llama_context * ctx);
#endif
#endif

View file

@ -1,13 +0,0 @@
#ifndef LLAMA_INTERNAL_H
#define LLAMA_INTERNAL_H
// Internal functions exposed for tests and benchmarks
#include "ggml.h"
#include <string>
#include <unordered_map>
std::unordered_map<std::string, struct ggml_tensor *>& llama_internal_get_tensor_map(struct llama_context * ctx);
#endif