ggml, ngram-cache, log: added const and const ref for function params

This commit is contained in:
Herman Semenov 2024-05-13 19:29:19 -05:00
parent b228aba91a
commit ca61d3e498
3 changed files with 6 additions and 6 deletions

View file

@ -596,7 +596,7 @@ inline std::string log_var_to_string_impl(bool var)
return var ? "true" : "false";
}
inline std::string log_var_to_string_impl(std::string var)
inline std::string log_var_to_string_impl(const std::string & var)
{
return var;
}

View file

@ -59,7 +59,7 @@ constexpr int draft_min_sample_size_strict[LLAMA_NGRAM_MAX] = { 4, 3, 2, 2};
constexpr int draft_min_percent_strict[LLAMA_NGRAM_MAX] = {75, 66, 66, 66};
// Helper function that tries to draft a token from only the static ngram cache:
static llama_token try_draft(llama_ngram_cache & nc_static, const llama_ngram ngram_static) {
static llama_token try_draft(llama_ngram_cache & nc_static, const llama_ngram & ngram_static) {
llama_ngram_cache::iterator part_static_it = nc_static.find(ngram_static);
if (part_static_it == nc_static.end()) {
return -1;

8
ggml.c
View file

@ -3009,7 +3009,7 @@ size_t ggml_used_mem(const struct ggml_context * ctx) {
return ctx->objects_end == NULL ? 0 : ctx->objects_end->offs + ctx->objects_end->size;
}
size_t ggml_set_scratch(struct ggml_context * ctx, struct ggml_scratch scratch) {
size_t ggml_set_scratch(struct ggml_context * ctx, const struct ggml_scratch scratch) {
const size_t result = ctx->scratch.data ? ctx->scratch.offs : 0;
ctx->scratch = scratch;
@ -20646,7 +20646,7 @@ static void ggml_opt_acc_grad(int np, struct ggml_tensor * const ps[], float * g
static enum ggml_opt_result ggml_opt_adam(
struct ggml_context * ctx,
struct ggml_opt_context * opt,
struct ggml_opt_params params,
const struct ggml_opt_params params,
struct ggml_tensor * f,
struct ggml_cgraph * gf,
struct ggml_cgraph * gb,
@ -21345,7 +21345,7 @@ struct ggml_opt_params ggml_opt_default_params(enum ggml_opt_type type) {
GGML_API void ggml_opt_init(
struct ggml_context * ctx,
struct ggml_opt_context * opt,
struct ggml_opt_params params,
const struct ggml_opt_params params,
int64_t nx) {
opt->ctx = ctx;
opt->params = params;
@ -21417,7 +21417,7 @@ GGML_API void ggml_opt_init(
enum ggml_opt_result ggml_opt(
struct ggml_context * ctx,
struct ggml_opt_params params,
const struct ggml_opt_params params,
struct ggml_tensor * f) {
bool free_ctx = false;
if (ctx == NULL) {