@@ -11430,8 +11430,8 @@ static void ggml_compute_forward_rope_f32(
11430
11430
const struct ggml_tensor * src0,
11431
11431
const struct ggml_tensor * src1,
11432
11432
struct ggml_tensor * dst) {
11433
- assert (src1->type == GGML_TYPE_I32);
11434
- assert (ggml_nelements(src1) == 3);
11433
+ GGML_ASSERT (src1->type == GGML_TYPE_I32);
11434
+ GGML_ASSERT (ggml_nelements(src1) == 3);
11435
11435
11436
11436
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
11437
11437
return;
@@ -11454,12 +11454,16 @@ static void ggml_compute_forward_rope_f32(
11454
11454
//printf("ne0: %d, ne1: %d, ne2: %d, ne3: %d\n", ne0, ne1, ne2, ne3);
11455
11455
//printf("n_past = %d, ne2 = %d\n", n_past, ne2);
11456
11456
11457
- assert (nb0 == sizeof(float));
11457
+ GGML_ASSERT (nb0 == sizeof(float));
11458
11458
11459
11459
const int ith = params->ith;
11460
11460
const int nth = params->nth;
11461
11461
11462
11462
const int nr = ggml_nrows(src0);
11463
+ const int nc = src0->ne[0];
11464
+
11465
+ GGML_ASSERT(n_dims <= nc);
11466
+ GGML_ASSERT(n_dims % 2 == 0);
11463
11467
11464
11468
// rows per thread
11465
11469
const int dr = (nr + nth - 1)/nth;
@@ -11520,8 +11524,8 @@ static void ggml_compute_forward_rope_f16(
11520
11524
const struct ggml_tensor * src0,
11521
11525
const struct ggml_tensor * src1,
11522
11526
struct ggml_tensor * dst) {
11523
- assert (src1->type == GGML_TYPE_I32);
11524
- assert (ggml_nelements(src1) == 3);
11527
+ GGML_ASSERT (src1->type == GGML_TYPE_I32);
11528
+ GGML_ASSERT (ggml_nelements(src1) == 3);
11525
11529
11526
11530
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
11527
11531
return;
@@ -11544,12 +11548,16 @@ static void ggml_compute_forward_rope_f16(
11544
11548
//printf("ne0: %d, ne1: %d, ne2: %d, ne3: %d\n", ne0, ne1, ne2, ne3);
11545
11549
//printf("n_past = %d, ne2 = %d\n", n_past, ne2);
11546
11550
11547
- assert (nb0 == sizeof(ggml_fp16_t));
11551
+ GGML_ASSERT (nb0 == sizeof(ggml_fp16_t));
11548
11552
11549
11553
const int ith = params->ith;
11550
11554
const int nth = params->nth;
11551
11555
11552
11556
const int nr = ggml_nrows(src0);
11557
+ const int nc = src0->ne[0];
11558
+
11559
+ GGML_ASSERT(n_dims <= nc);
11560
+ GGML_ASSERT(n_dims % 2 == 0);
11553
11561
11554
11562
// rows per thread
11555
11563
const int dr = (nr + nth - 1)/nth;
0 commit comments