ggml : fix null ptr deref in backward pass

This commit is contained in:
Georgi Gerganov 2023-05-13 10:08:01 +03:00
parent f977243ded
commit 33034cfede
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
3 changed files with 8 additions and 7 deletions

3
ggml.c
View file

@ -13605,9 +13605,6 @@ static void ggml_compute_backward(struct ggml_context * ctx, struct ggml_tensor
src0), src0),
inplace); inplace);
} }
if (src1->grad) {
// not supported
}
} break; } break;
case GGML_OP_SUM: case GGML_OP_SUM:
{ {

View file

@ -38,9 +38,7 @@
#define GGML_PRINT(...) printf(__VA_ARGS__) #define GGML_PRINT(...) printf(__VA_ARGS__)
float frand(void) {
float frand() {
return (float)rand()/(float)RAND_MAX; return (float)rand()/(float)RAND_MAX;
} }
@ -856,7 +854,6 @@ int main(int argc, const char ** argv) {
// set_2d // set_2d
{ {
int64_t ne2[4]; int64_t ne2[4];
int64_t nb2[4];
int64_t max_offsets[4] = { 0, 0, 0, 0 }; int64_t max_offsets[4] = { 0, 0, 0, 0 };
int64_t offsets[4] = { 0, 0, 0, 0 }; int64_t offsets[4] = { 0, 0, 0, 0 };

View file

@ -191,6 +191,13 @@ int main(int argc, const char ** argv) {
// main: original e = 1620817.8750 // main: original e = 1620817.8750
// main: optimized e = 698387.6875 // 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 ne1[4] = {32, 1024, 1, 1};
// int64_t ne2[4] = {32, 2048, 1, 1};; // int64_t ne2[4] = {32, 2048, 1, 1};;
// int64_t ne3[4] = {1024, 2048, 1, 1}; // int64_t ne3[4] = {1024, 2048, 1, 1};