From 69306e69ed0f2831c7b5488878402b0d73c21e4b Mon Sep 17 00:00:00 2001 From: saharNooby Date: Mon, 18 Sep 2023 19:39:42 +0400 Subject: [PATCH] Fix warnings --- rwkv.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/rwkv.cpp b/rwkv.cpp index 54eb1de..ef32573 100644 --- a/rwkv.cpp +++ b/rwkv.cpp @@ -1,4 +1,12 @@ #include "rwkv.h" + +// Fix build on Linux. +// https://stackoverflow.com/questions/8518264/where-is-the-declaration-of-cpu-alloc +#if defined(__linux__) +#define _GNU_SOURCE +#include +#endif + #include "ggml.h" #include "ggml-alloc.h" @@ -316,10 +324,10 @@ struct rwkv_tensor_header { uint32_t width; uint32_t height; - const size_t size() const; + size_t size() const; }; -const size_t rwkv_tensor_header::size() const { +size_t rwkv_tensor_header::size() const { return rwkv_tensor_nbytes(rwkv_type_to_ggml[this->data_type], this->width, this->height); } @@ -1311,10 +1319,7 @@ bool rwkv_eval_sequence( RWKV_CTX_ASSERT_FALSE_MSG(ctx, RWKV_ERROR_ARGS, sequence_len > 0, "Sequence length is 0"); - const struct rwkv_file_header & header = ctx->model->header; - const size_t n_vocab = header.n_vocab; - const size_t n_embed = header.n_embed; - const size_t n_layer = header.n_layer; + const size_t n_vocab = ctx->model->header.n_vocab; if (sequence) { for (size_t i = 0; i < sequence_len; i++) {