]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
examples : fix compile warnings
authorGeorgi Gerganov <redacted>
Fri, 15 Sep 2023 17:46:00 +0000 (20:46 +0300)
committerGeorgi Gerganov <redacted>
Fri, 15 Sep 2023 17:46:00 +0000 (20:46 +0300)
examples/mnist/main-mtl.m
examples/sam/main.cpp

index bee8d4c902b8eaae0c9b968ac815c083297c497f..4b7717920a69b0017d91135c9f7adf118ec81394 100644 (file)
@@ -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<MTLBuffer> 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) {
index e15cbefdec73f20a0cd68a55634e5a12e723fc7b..1de41f30a8e6db5d5c5c3441fe911bb981073cbe 100644 (file)
@@ -18,6 +18,7 @@
 #include <string>
 #include <vector>
 #include <thread>
+#include <cinttypes>
 
 #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]);