From 33034cfede96f0d5248af80d9b9296b24a6a8eca Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 13 May 2023 10:08:01 +0300 Subject: [PATCH] ggml : fix null ptr deref in backward pass --- ggml.c | 3 --- tests/test-grad0.c | 5 +---- tests/test-opt.c | 7 +++++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ggml.c b/ggml.c index 0ffe8c733..e32ec5eac 100644 --- a/ggml.c +++ b/ggml.c @@ -13605,9 +13605,6 @@ static void ggml_compute_backward(struct ggml_context * ctx, struct ggml_tensor src0), inplace); } - if (src1->grad) { - // not supported - } } break; case GGML_OP_SUM: { diff --git a/tests/test-grad0.c b/tests/test-grad0.c index 12e8f3453..ec5059220 100644 --- a/tests/test-grad0.c +++ b/tests/test-grad0.c @@ -38,9 +38,7 @@ #define GGML_PRINT(...) printf(__VA_ARGS__) - - -float frand() { +float frand(void) { return (float)rand()/(float)RAND_MAX; } @@ -856,7 +854,6 @@ int main(int argc, const char ** argv) { // set_2d { int64_t ne2[4]; - int64_t nb2[4]; int64_t max_offsets[4] = { 0, 0, 0, 0 }; int64_t offsets[4] = { 0, 0, 0, 0 }; diff --git a/tests/test-opt.c b/tests/test-opt.c index de885533d..d001615ee 100644 --- a/tests/test-opt.c +++ b/tests/test-opt.c @@ -191,6 +191,13 @@ int main(int argc, const char ** argv) { // main: original e = 1620817.8750 // main: optimized e = 698387.6875 +// another run on M1 +// int64_t ne1[4] = {4, 1024, 1, 1}; +// int64_t ne2[4] = {4, 2048, 1, 1};; +// int64_t ne3[4] = {1024, 2048, 1, 1}; +// main: original e = 1629595.6250 +// main: optimized e = 698169.1250 + // int64_t ne1[4] = {32, 1024, 1, 1}; // int64_t ne2[4] = {32, 2048, 1, 1};; // int64_t ne3[4] = {1024, 2048, 1, 1};