From: Georgi Gerganov Date: Fri, 15 Sep 2023 17:46:00 +0000 (+0300) Subject: examples : fix compile warnings X-Git-Tag: upstream/0.0.1642~1238 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=1472fed16d8083ebee5cadc00852e00e5c4875fe;p=pkg%2Fggml%2Fsources%2Fggml examples : fix compile warnings --- diff --git a/examples/mnist/main-mtl.m b/examples/mnist/main-mtl.m index bee8d4c9..4b771792 100644 --- a/examples/mnist/main-mtl.m +++ b/examples/mnist/main-mtl.m @@ -125,15 +125,15 @@ struct ggml_mtl_context * mnist_mtl_init( ctx->function_add = [ctx->library newFunctionWithName:@"kernel_add"]; ctx->pipeline_add = [ctx->device newComputePipelineStateWithFunction:ctx->function_add error:nil]; - fprintf(stderr, "%s: loaded kernel_add: %p\n", __func__, ctx->pipeline_add); + fprintf(stderr, "%s: loaded kernel_add: %p\n", __func__, (void *) ctx->pipeline_add); ctx->function_relu = [ctx->library newFunctionWithName:@"kernel_relu"]; ctx->pipeline_relu = [ctx->device newComputePipelineStateWithFunction:ctx->function_relu error:nil]; - fprintf(stderr, "%s: loaded kernel_relu: %p\n", __func__, ctx->pipeline_relu); + fprintf(stderr, "%s: loaded kernel_relu: %p\n", __func__, (void *) ctx->pipeline_relu); ctx->function_soft_max = [ctx->library newFunctionWithName:@"kernel_soft_max" constantValues:constants error:nil]; ctx->pipeline_soft_max = [ctx->device newComputePipelineStateWithFunction:ctx->function_soft_max error:nil]; - fprintf(stderr, "%s: loaded kernel_soft_max: %p\n", __func__, ctx->pipeline_soft_max); + fprintf(stderr, "%s: loaded kernel_soft_max: %p\n", __func__, (void *) ctx->pipeline_soft_max); } #ifdef GGML_MTL_HEAP @@ -314,7 +314,7 @@ int mnist_mtl_eval( id id_dst = mnist_mtl_get_buffer(ctx, inp, &offs_src0); - memcpy(id_dst.contents + offs_src0, inp->data, ggml_nbytes(inp)); + memcpy((char *) id_dst.contents + offs_src0, inp->data, ggml_nbytes(inp)); } for (int i = 0; i < gf->n_nodes; ++i) { diff --git a/examples/sam/main.cpp b/examples/sam/main.cpp index e15cbefd..1de41f30 100644 --- a/examples/sam/main.cpp +++ b/examples/sam/main.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #if defined(_MSC_VER) #pragma warning(disable: 4244 4267) // possible loss of data @@ -298,7 +299,7 @@ struct sam_image_f32 { void print_t_f32(const char* title, struct ggml_tensor * t, int n = 10) { printf("%s\n", title); float * data = (float *)t->data; - printf("dims: %jd %jd %jd %jd f32\n", t->ne[0], t->ne[1], t->ne[2], t->ne[3]); + printf("dims: % " PRId64 " % " PRId64 " % " PRId64 " % " PRId64 " f32\n", t->ne[0], t->ne[1], t->ne[2], t->ne[3]); printf("First & Last %d elements:\n", n); for (int i = 0; i < std::min((int) (t->ne[0]*t->ne[1]), n); i++) { printf("%.5f ", data[i]);