Skip to content

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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion common/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion common/ngram-cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Loading