10000 WIP Feature/cpp by jmikedupont2 · Pull Request #4155 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

WIP Feature/cpp #4155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update
  • Loading branch information
mike dupont committed Nov 22, 2023
commit 9b7a2964525a8e9009d58207d2a0eea2c2a38717
48 changes: 40 additions & 8 deletions ggml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2024,8 +2024,44 @@ static inline int ggml_up(int n, int m) {

////////////////////////////////////////////////////////////////////////////////

static size_t GGUF_TYPE_SIZE[GGUF_TYPE_COUNT]={};
struct gguf_str {
uint64_t n; // GGUFv2
char * data;
};

static const char * GGUF_TYPE_NAME[GGUF_TYPE_COUNT] = {};

struct ggml_context * ggml_init(struct ggml_init_params params) {

GGUF_TYPE_SIZE[GGUF_TYPE_UINT8] = sizeof(uint8_t);
GGUF_TYPE_SIZE [GGUF_TYPE_INT8] = sizeof(int8_t);
GGUF_TYPE_SIZE[GGUF_TYPE_UINT16] = sizeof(uint16_t);
GGUF_TYPE_SIZE [GGUF_TYPE_INT16] = sizeof(int16_t);
GGUF_TYPE_SIZE [GGUF_TYPE_UINT32] = sizeof(uint32_t);
GGUF_TYPE_SIZE [GGUF_TYPE_INT32] = sizeof(int32_t);
GGUF_TYPE_SIZE [GGUF_TYPE_FLOAT32] = sizeof(float);
GGUF_TYPE_SIZE [GGUF_TYPE_BOOL] = sizeof(bool);
GGUF_TYPE_SIZE [GGUF_TYPE_STRING] = sizeof(struct gguf_str);
GGUF_TYPE_SIZE [GGUF_TYPE_UINT64] = sizeof(uint64_t);
GGUF_TYPE_SIZE [GGUF_TYPE_INT64] = sizeof(int64_t);
GGUF_TYPE_SIZE [GGUF_TYPE_FLOAT64] = sizeof(double);
GGUF_TYPE_SIZE [GGUF_TYPE_ARRAY] = 0; // undefined

GGUF_TYPE_NAME[GGUF_TYPE_UINT8] = "u8";
GGUF_TYPE_NAME[GGUF_TYPE_INT8] = "i8";
GGUF_TYPE_NAME[GGUF_TYPE_UINT16] = "u16";
GGUF_TYPE_NAME[GGUF_TYPE_INT16] = "i16";
GGUF_TYPE_NAME[GGUF_TYPE_UINT32] = "u32";
GGUF_TYPE_NAME[GGUF_TYPE_INT32] = "i32";
GGUF_TYPE_NAME[GGUF_TYPE_FLOAT32] = "f32";
GGUF_TYPE_NAME[GGUF_TYPE_BOOL] = "bool";
GGUF_TYPE_NAME[GGUF_TYPE_STRING] = "str";
GGUF_TYPE_NAME[GGUF_TYPE_ARRAY] = "arr";
GGUF_TYPE_NAME[GGUF_TYPE_UINT64] = "u64";
GGUF_TYPE_NAME[GGUF_TYPE_INT64] = "i64";
GGUF_TYPE_NAME[GGUF_TYPE_FLOAT64] = "f64";

type_traits[GGML_TYPE_I8] = {
.type_name = "i8",
.blck_size = 1,
Expand Down Expand Up @@ -18291,12 +18327,8 @@ size_t ggml_quantize_chunk(enum ggml_type type, const float * src, void * dst, i

////////////////////////////////////////////////////////////////////////////////

struct gguf_str {
uint64_t n; // GGUFv2
char * data;
};

static const size_t GGUF_TYPE_SIZE[GGUF_TYPE_COUNT] = {
//static const size_t GGUF_TYPE_SIZE[GGUF_TYPE_COUNT] = {
// [GGUF_TYPE_UINT8] = sizeof(uint8_t),
// [GGUF_TYPE_INT8] = sizeof(int8_t),
// [GGUF_TYPE_UINT16] = sizeof(uint16_t),
Expand All @@ -18310,10 +18342,10 @@ static const size_t GGUF_TYPE_SIZE[GGUF_TYPE_COUNT] = {
// [GGUF_TYPE_INT64] = sizeof(int64_t),
// [GGUF_TYPE_FLOAT64] = sizeof(double),
// [GGUF_TYPE_ARRAY] = 0, // undefined
};
//};
static_assert(GGUF_TYPE_COUNT == 13, "GGUF_TYPE_COUNT != 13");

static const char * GGUF_TYPE_NAME[GGUF_TYPE_COUNT] = {

// [GGUF_TYPE_UINT8] = "u8",
// [GGUF_TYPE_INT8] = "i8",
// [GGUF_TYPE_UINT16] = "u16",
Expand All @@ -18327,7 +18359,7 @@ static const char * GGUF_TYPE_NAME[GGUF_TYPE_COUNT] = {
// [GGUF_TYPE_UINT64] = "u64",
// [GGUF_TYPE_INT64] = "i64",
// [GGUF_TYPE_FLOAT64] = "f64",
};
//};
static_assert(GGUF_TYPE_COUNT == 13, "GGUF_TYPE_COUNT != 13");

union gguf_value {
Expand Down
0