ggml : fix null ptr deref in backward pass
This commit is contained in:
parent
f977243ded
commit
33034cfede
3 changed files with 8 additions and 7 deletions
3
ggml.c
3
ggml.c
|
@ -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:
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 };
|
||||||
|
|
||||||
|
|
|
@ -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};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue