Skip to content

Commit f6ba36d

Browse files
authored
Reduce warnings. (ggml-org#439)
1 parent 8d90072 commit f6ba36d

10 files changed

+28
-36
lines changed

ggml-opencl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ static void ggml_cl_mul_mat_f32(const ggml_tensor * src0, const ggml_tensor * sr
15291529
&queue, &ev_sgemm);
15301530

15311531
if (status != clblast::StatusCode::kSuccess) {
1532-
printf("\nF32 Matmul Failed (%d): [dims: %lld,%lld,%lld,%lld] You may be out of VRAM. Please check if you have enough.\n",status,ne00,ne01,ne10,ne11);
1532+
printf("\nF32 Matmul Failed (%d): [dims: %ld,%ld,%ld,%ld] You may be out of VRAM. Please check if you have enough.\n",static_cast<int>(status),ne00,ne01,ne10,ne11);
15331533
GGML_ASSERT(false);
15341534
}
15351535

@@ -1634,7 +1634,7 @@ static void ggml_cl_mul_mat_f16(const ggml_tensor * src0, const ggml_tensor * sr
16341634
&queue, &ev_sgemm);
16351635

16361636
if (status != clblast::StatusCode::kSuccess) {
1637-
printf("\nF16 Matmul Failed (%d): [dims: %lld,%lld,%lld,%lld] You may be out of VRAM. Please check if you have enough.\n",status,ne00,ne01,ne10,ne11);
1637+
printf("\nF16 Matmul Failed (%d): [dims: %ld,%ld,%ld,%ld] You may be out of VRAM. Please check if you have enough.\n",static_cast<int>(status),ne00,ne01,ne10,ne11);
16381638
GGML_ASSERT(false);
16391639
}
16401640

@@ -1754,7 +1754,7 @@ static void ggml_cl_mul_mat_q_f32(const ggml_tensor * src0, const ggml_tensor *
17541754
&queue, events.data() + ev_idx++);
17551755

17561756
if (status != clblast::StatusCode::kSuccess) {
1757-
printf("\nQF32 Matmul Failed (%d): [dims: %lld,%lld,%lld,%lld] You may be out of VRAM. Please check if you have enough.\n",status,ne00,ne01,ne10,ne11);
1757+
printf("\nQF32 Matmul Failed (%d): [dims: %ld,%ld,%ld,%ld] You may be out of VRAM. Please check if you have enough.\n",static_cast<int>(status),ne00,ne01,ne10,ne11);
17581758
GGML_ASSERT(false);
17591759
}
17601760
}

gpttype_adapter.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
691691

692692
const struct rwkv_file_header & header = rwkv_ctx_v3->instance->model.header;
693693
const size_t n_vocab = header.n_vocab;
694-
printf("\nDetected Vocab: %d",n_vocab);
694+
printf("\nDetected Vocab: %zu",n_vocab);
695695
if(n_vocab>60000)
696696
{
697697
printf("\nUsing WORLD TOKENIZER");
@@ -729,7 +729,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
729729
auto statebufsiz = rwkv_v2_get_state_buffer_element_count(rwkv_ctx_v2) * sizeof(float) + padding;
730730
auto logitbufsiz = rwkv_v2_get_logits_buffer_element_count(rwkv_ctx_v2) * sizeof(float) + padding;
731731

732-
printf("\nRWKV old Init: State Buffer:%u, Logit Buffer:%u\n", statebufsiz, logitbufsiz);
732+
printf("\nRWKV old Init: State Buffer:%lu, Logit Buffer:%lu\n", statebufsiz, logitbufsiz);
733733
rwkv_ctx_v2->state_out = (float *)malloc(statebufsiz);
734734
rwkv_ctx_v2->logits_out = (float *)malloc(logitbufsiz);
735735
rwkv_ctx_v2->state_in = nullptr;
@@ -757,7 +757,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
757757
auto statebufsiz = rwkv_get_state_buffer_element_count(rwkv_ctx_v3) * sizeof(float) + padding;
758758
auto logitbufsiz = rwkv_get_logits_buffer_element_count(rwkv_ctx_v3) * sizeof(float) + padding;
759759

760-
printf("\nRWKV Init: State Buffer:%u, Logit Buffer:%u\n", statebufsiz, logitbufsiz);
760+
printf("\nRWKV Init: State Buffer:%lu, Logit Buffer:%lu\n", statebufsiz, logitbufsiz);
761761
rwkv_ctx_v3->state_out = (float *)malloc(statebufsiz);
762762
rwkv_ctx_v3->logits_out = (float *)malloc(logitbufsiz);
763763
rwkv_ctx_v3->state_in = nullptr;
@@ -1284,7 +1284,7 @@ generation_outputs gpttype_generate(const generation_inputs inputs, generation_o
12841284
//prepare banned tokens
12851285
if(banned_token_ids.size()==0 && banned_tokens.size()>0)
12861286
{
1287-
printf("\n[First Run] Banning %d token sequences...",banned_tokens.size());
1287+
printf("\n[First Run] Banning %zu token sequences...",banned_tokens.size());
12881288
for(int v=0;v<n_vocab;++v)
12891289
{
12901290
std::string word = FileFormatTokenizeID(v,file_format);
@@ -1297,7 +1297,7 @@ generation_outputs gpttype_generate(const generation_inputs inputs, generation_o
12971297
}
12981298
}
12991299
}
1300-
printf("\nBanned a total of %d tokens.\n",banned_token_ids.size());
1300+
printf("\nBanned a total of %zu tokens.\n",banned_token_ids.size());
13011301
}
13021302

13031303
if(debugmode!=-1)
@@ -1337,7 +1337,7 @@ generation_outputs gpttype_generate(const generation_inputs inputs, generation_o
13371337
//print progress
13381338
if (!startedsampling && debugmode!=-1)
13391339
{
1340-
printf("\rProcessing Prompt%s (%d / %d tokens)", (blasmode ? " [BLAS]" : ""), input_consumed, embd_inp.size());
1340+
printf("\rProcessing Prompt%s (%d / %zu tokens)", (blasmode ? " [BLAS]" : ""), input_consumed, embd_inp.size());
13411341
}
13421342
fflush(stdout);
13431343

otherarch/ggml_v1.c

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Defines CLOCK_MONOTONIC and asprintf on Linux
2-
#define _GNU_SOURCE
3-
41
#include "ggml_v1.h"
52

63
#if defined(_MSC_VER) || defined(__MINGW32__)

otherarch/ggml_v2-opencl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ static void ggml_v2_cl_mul_mat_f32(const ggml_v2_tensor * src0, const ggml_v2_te
573573
&queue, &ev_sgemm);
574574

575575
if (status != clblast::StatusCode::kSuccess) {
576-
printf("\nF32 Matmul Failed (%d): [dims: %lld,%lld,%lld,%lld] You may be out of VRAM. Please check if you have enough.\n",status,ne00,ne01,ne10,ne11);
576+
printf("\nF32 Matmul Failed (%d): [dims: %ld,%ld,%ld,%ld] You may be out of VRAM. Please check if you have enough.\n",static_cast<int>(status),ne00,ne01,ne10,ne11);
577577
GGML_V2_ASSERT(false);
578578
}
579579

@@ -672,7 +672,7 @@ static void ggml_v2_cl_mul_mat_f16(const ggml_v2_tensor * src0, const ggml_v2_te
672672
&queue, &ev_sgemm);
673673

674674
if (status != clblast::StatusCode::kSuccess) {
675-
printf("\nF16 Matmul Failed (%d): [dims: %lld,%lld,%lld,%lld] You may be out of VRAM. Please check if you have enough.\n",status,ne00,ne01,ne10,ne11);
675+
printf("\nF16 Matmul Failed (%d): [dims: %ld,%ld,%ld,%ld] You may be out of VRAM. Please check if you have enough.\n",static_cast<int>(status),ne00,ne01,ne10,ne11);
676676
GGML_V2_ASSERT(false);
677677
}
678678

@@ -780,7 +780,7 @@ static void ggml_v2_cl_mul_mat_q_f32(const ggml_v2_tensor * src0, const ggml_v2_
780780
&queue, &ev_sgemm);
781781

782782
if (status != clblast::StatusCode::kSuccess) {
783-
printf("\nQF32 Matmul Failed (%d): [dims: %lld,%lld,%lld,%lld] You may be out of VRAM. Please check if you have enough.\n",status,ne00,ne01,ne10,ne11);
783+
printf("\nQF32 Matmul Failed (%d): [dims: %ld,%ld,%ld,%ld] You may be out of VRAM. Please check if you have enough.\n",static_cast<int>(status),ne00,ne01,ne10,ne11);
784784
GGML_V2_ASSERT(false);
785785
}
786786
}

otherarch/ggml_v2.c

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Defines CLOCK_MONOTONIC on Linux
2-
#define _GNU_SOURCE
3-
41
#include "ggml_v2.h"
52

63
#if defined(_MSC_VER) || defined(__MINGW32__)

otherarch/gpt2_v2.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ ModelLoadResult gpt2_v2_model_load(const std::string & fname, gpt2_v2_model & mo
150150
params.mem_size = ctx_size;
151151
params.mem_buffer = NULL;
152152
params.no_alloc = false;
153-
153+
154154

155155
model.ctx = ggml_v2_init(params);
156156
if (!model.ctx) {
@@ -237,7 +237,7 @@ ModelLoadResult gpt2_v2_model_load(const std::string & fname, gpt2_v2_model & mo
237237

238238
const int n_mem = n_layer*n_ctx;
239239
const int n_elements = n_embd*n_mem;
240-
240+
241241
model.memory_k = ggml_v2_new_tensor_1d(ctx, memory_type, n_elements*1.5);
242242
model.memory_v = ggml_v2_new_tensor_1d(ctx, memory_type, n_elements*1.5);
243243

@@ -287,7 +287,7 @@ ModelLoadResult gpt2_v2_model_load(const std::string & fname, gpt2_v2_model & mo
287287
}
288288

289289
if (tensor->ne[0] != ne[0] || tensor->ne[1] != ne[1]) {
290-
fprintf(stderr, "%s: tensor '%s' has wrong shape in model file: got [%lld, %lld], expected [%lld, %lld]\n",
290+
fprintf(stderr, "%s: tensor '%s' has wrong shape in model file: got [%ld, %ld], expected [%d, %d]\n",
291291
__func__, name.data(), tensor->ne[0], tensor->ne[1], ne[0], ne[1]);
292292
return ModelLoadResult::FAIL;
293293
}
@@ -379,7 +379,7 @@ bool gpt2_v2_eval(
379379
params.mem_size = buf_size;
380380
params.mem_buffer = buf;
381381
params.no_alloc = false;
382-
382+
383383

384384
struct ggml_v2_context * ctx0 = ggml_v2_init(params);
385385
struct ggml_v2_cgraph gf = {};

otherarch/gptj_v2.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ ModelLoadResult gptj_v2_model_load(const std::string & fname, gptj_v2_model & mo
150150
params.mem_size = ctx_size;
151151
params.mem_buffer = NULL;
152152
params.no_alloc = false;
153-
153+
154154

155155
model.ctx = ggml_v2_init(params);
156156
if (!model.ctx) {
@@ -281,7 +281,7 @@ ModelLoadResult gptj_v2_model_load(const std::string & fname, gptj_v2_model & mo
281281
fprintf(stderr, "%s: tensor '%s' has wrong size in model file\n", __func__, name.data());
282282
return ModelLoadResult::FAIL;
283283
}
284-
284+
285285

286286
if (tensor->ne[0] != ne[0] || tensor->ne[1] != ne[1]) {
287287

@@ -294,11 +294,11 @@ ModelLoadResult gptj_v2_model_load(const std::string & fname, gptj_v2_model & mo
294294
}
295295
else
296296
{
297-
fprintf(stderr, "%s: tensor '%s' has wrong shape in model file: got [%d, %d], expected [%d, %d]\n",
297+
fprintf(stderr, "%s: tensor '%s' has wrong shape in model file: got [%ld, %ld], expected [%d, %d]\n",
298298
__func__, name.data(), tensor->ne[0], tensor->ne[1], ne[0], ne[1]);
299299
return ModelLoadResult::FAIL;
300300
}
301-
301+
302302
}
303303

304304
// for debugging
@@ -387,7 +387,7 @@ bool gptj_v2_eval(
387387
params.mem_size = buf_size;
388388
params.mem_buffer = buf;
389389
params.no_alloc = false;
390-
390+
391391

392392
struct ggml_v2_context * ctx0 = ggml_v2_init(params);
393393
struct ggml_v2_cgraph gf = {};

otherarch/gptj_v3.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ ModelLoadResult gptj_model_load(const std::string & fname, gptj_model & model, g
304304
}
305305
else
306306
{
307-
fprintf(stderr, "%s: tensor '%s' has wrong shape in model file: got [%d, %d], expected [%d, %d]\n",
307+
fprintf(stderr, "%s: tensor '%s' has wrong shape in model file: got [%ld, %ld], expected [%d, %d]\n",
308308
__func__, name.data(), tensor->ne[0], tensor->ne[1], ne[0], ne[1]);
309309
return ModelLoadResult::FAIL;
310310
}

otherarch/llama_v3.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,9 @@ extern "C" {
243243
// Various functions for loading a ggml llama model.
244244
// Allocate (almost) all memory needed for the model.
245245
// Return NULL on failure
246-
LLAMA_V3_API DEPRECATED(struct llama_v3_context * llama_v3_init_from_file(
246+
LLAMA_V3_API struct llama_v3_context * llama_v3_init_from_file(
247247
const char * path_model,
248-
struct llama_v3_context_params params),
249-
"please use llama_v3_load_model_from_file combined with llama_v3_new_context_with_model instead");
248+
struct llama_v3_context_params params);
250249

251250
// Frees all allocated memory
252251
LLAMA_V3_API void llama_v3_free(struct llama_v3_context * ctx);
@@ -263,12 +262,11 @@ extern "C" {
263262
// The model needs to be reloaded before applying a new adapter, otherwise the adapter
264263
// will be applied on top of the previous one
265264
// Returns 0 on success
266-
LLAMA_V3_API DEPRECATED(int llama_v3_apply_lora_from_file(
265+
LLAMA_V3_API int llama_v3_apply_lora_from_file(
267266
struct llama_v3_context * ctx,
268267
const char * path_lora,
269268
const char * path_base_model,
270-
int n_threads),
271-
"please use llama_v3_model_apply_lora_from_file instead");
269+
int n_threads);
272270

273271
LLAMA_V3_API int llama_v3_model_apply_lora_from_file(
274272
const struct llama_v3_model * model,

otherarch/rwkv_v2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ struct rwkv_v2_context * rwkv_v2_init_from_file(const char * file_path, uint32_t
367367
// Verify order of dimensions
368368
struct ggml_v2_tensor * emb = model->emb;
369369
RWKV_V2_ASSERT_NULL(emb->n_dims == 2, "Unexpected dimension count of embedding matrix %d", emb->n_dims);
370-
RWKV_V2_ASSERT_NULL(emb->ne[0] == model->n_embed, "Unexpected dimension of embedding matrix %lld", emb->ne[0]);
371-
RWKV_V2_ASSERT_NULL(emb->ne[1] == model->n_vocab, "Unexpected dimension of embedding matrix %lld", emb->ne[1]);
370+
RWKV_V2_ASSERT_NULL(emb->ne[0] == model->n_embed, "Unexpected dimension of embedding matrix %ld", emb->ne[0]);
371+
RWKV_V2_ASSERT_NULL(emb->ne[1] == model->n_vocab, "Unexpected dimension of embedding matrix %ld", emb->ne[1]);
372372

373373
int32_t n_embed = model->n_embed;
374374
int32_t n_layer = model->n_layer;

0 commit comments

Comments
 (0)