Skip to content

Commit 7069221

Browse files
committed
eltwise: add back split buffer type checks
1 parent 11fe7ca commit 7069221

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

ggml/src/ggml-sycl/element_wise.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ inline void ggml_sycl_op_silu(ggml_backend_sycl_context & ctx, ggml_tensor * dst
512512

513513
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
514514
GGML_ASSERT(dst->type == GGML_TYPE_F32);
515+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
515516
const dpct::queue_ptr main_stream = ctx.stream();
516517
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
517518
float * dst_dd = static_cast<float *>(dst->data);
@@ -523,6 +524,7 @@ inline void ggml_sycl_op_gelu(ggml_backend_sycl_context & ctx, ggml_tensor * dst
523524

524525
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
525526
GGML_ASSERT(dst->type == GGML_TYPE_F32);
527+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
526528
const dpct::queue_ptr main_stream = ctx.stream();
527529
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
528530
float * dst_dd = static_cast<float *>(dst->data);
@@ -534,6 +536,7 @@ inline void ggml_sycl_op_gelu_quick(ggml_backend_sycl_context & ctx, ggml_tensor
534536

535537
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
536538
GGML_ASSERT(dst->type == GGML_TYPE_F32);
539+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
537540
const dpct::queue_ptr main_stream = ctx.stream();
538541
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
539542
float * dst_dd = static_cast<float *>(dst->data);
@@ -545,6 +548,7 @@ inline void ggml_sycl_op_tanh(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
545548

546549
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
547550
GGML_ASSERT(dst->type == GGML_TYPE_F32);
551+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
548552

549553
const dpct::queue_ptr main_stream = ctx.stream();
550554
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
@@ -556,6 +560,7 @@ inline void ggml_sycl_op_relu(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
556560

557561
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
558562
GGML_ASSERT(dst->type == GGML_TYPE_F32);
563+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
559564
const dpct::queue_ptr main_stream = ctx.stream();
560565
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
561566
float * dst_dd = static_cast<float *>(dst->data);
@@ -566,6 +571,7 @@ inline void ggml_sycl_op_hardsigmoid(ggml_backend_sycl_context & ctx, ggml_tenso
566571

567572
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
568573
GGML_ASSERT(dst->type == GGML_TYPE_F32);
574+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
569575
const dpct::queue_ptr main_stream = ctx.stream();
570576
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
571577
float * dst_dd = static_cast<float *>(dst->data);
@@ -576,6 +582,7 @@ inline void ggml_sycl_op_hardswish(ggml_backend_sycl_context & ctx, ggml_tensor
576582

577583
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
578584
GGML_ASSERT(dst->type == GGML_TYPE_F32);
585+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
579586

580587
const dpct::queue_ptr main_stream = ctx.stream();
581588
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
@@ -588,6 +595,7 @@ inline void ggml_sycl_op_exp(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
588595

589596
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
590597
GGML_ASSERT(dst->type == GGML_TYPE_F32);
598+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
591599
const dpct::queue_ptr main_stream = ctx.stream();
592600
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
593601
float * dst_dd = static_cast<float *>(dst->data);
@@ -598,6 +606,7 @@ inline void ggml_sycl_op_log(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
598606

599607
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
600608
GGML_ASSERT( dst->type == GGML_TYPE_F32);
609+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
601610
const dpct::queue_ptr main_stream = ctx.stream();
602611
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
603612
float * dst_dd = static_cast<float *>(dst->data);
@@ -609,6 +618,7 @@ inline void ggml_sycl_op_sigmoid(ggml_backend_sycl_context & ctx, ggml_tensor *d
609618

610619
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
611620
GGML_ASSERT(dst->type == GGML_TYPE_F32);
621+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
612622
const dpct::queue_ptr main_stream = ctx.stream();
613623
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
614624
float * dst_dd = static_cast<float *>(dst->data);
@@ -620,6 +630,7 @@ inline void ggml_sycl_op_sqrt(ggml_backend_sycl_context & ctx, ggml_tensor * dst
620630

621631
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
622632
GGML_ASSERT(dst->type == GGML_TYPE_F32);
633+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
623634
const dpct::queue_ptr main_stream = ctx.stream();
624635
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
625636
float * dst_dd = static_cast<float *>(dst->data);
@@ -630,6 +641,7 @@ inline void ggml_sycl_op_sin(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
630641

631642
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
632643
GGML_ASSERT(dst->type == GGML_TYPE_F32);
644+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
633645
const dpct::queue_ptr main_stream = ctx.stream();
634646
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
635647
float * dst_dd = static_cast<float *>(dst->data);
@@ -641,7 +653,7 @@ inline void ggml_sycl_op_cos(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
641653

642654
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
643655
GGML_ASSERT(dst->type == GGML_TYPE_F32);
644-
656+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
645657
const dpct::queue_ptr main_stream = ctx.stream();
646658
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
647659
float * dst_dd = static_cast<float *>(dst->data);
@@ -653,6 +665,7 @@ inline void ggml_sycl_op_step(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
653665

654666
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
655667
GGML_ASSERT(dst->type == GGML_TYPE_F32);
668+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
656669
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
657670
float * dst_dd = static_cast<float *>(dst->data);
658671
dpct::queue_ptr main_stream = ctx.stream();
@@ -664,6 +677,7 @@ inline void ggml_sycl_op_neg(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
664677

665678
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
666679
GGML_ASSERT(dst->type == GGML_TYPE_F32);
680+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
667681
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
668682
float * dst_dd = static_cast<float *>(dst->data);
669683
dpct::queue_ptr main_stream = ctx.stream();
@@ -675,6 +689,7 @@ inline void ggml_sycl_op_leaky_relu(ggml_backend_sycl_context & ctx, ggml_tensor
675689

676690
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
677691
GGML_ASSERT(dst->type == GGML_TYPE_F32);
692+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
678693

679694
float negative_slope;
680695
memcpy(&negative_slope, dst->op_params, sizeof(float));
@@ -690,6 +705,7 @@ inline void ggml_sycl_op_sqr(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
690705

691706
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
692707
GGML_ASSERT(dst->type == GGML_TYPE_F32);
708+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
693709
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
694710
float * dst_dd = static_cast<float *>(dst->data);
695711
dpct::queue_ptr main_stream = ctx.stream();
@@ -701,6 +717,7 @@ inline void ggml_sycl_op_upscale(ggml_backend_sycl_context & ctx, ggml_tensor *
701717

702718
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
703719
GGML_ASSERT(dst->type == GGML_TYPE_F32);
720+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
704721

705722
const float sf0 = (float)dst->ne[0]/dst->src[0]->ne[0];
706723
const float sf1 = (float)dst->ne[1]/dst->src[0]->ne[1];
@@ -721,6 +738,7 @@ inline void ggml_sycl_op_pad(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
721738
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32);
722739
GGML_ASSERT(dst->type == GGML_TYPE_F32);
723740
GGML_ASSERT(dst->src[0]->ne[3] == 1 && dst->ne[3] == 1); // just 3D tensors
741+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
724742

725743
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);
726744
float * dst_dd = static_cast<float *>(dst->data);
@@ -738,6 +756,8 @@ inline void ggml_sycl_op_acc(ggml_backend_sycl_context & ctx,
738756
GGML_ASSERT(dst->src[1]->type == GGML_TYPE_F32);
739757
GGML_ASSERT(dst->type == GGML_TYPE_F32);
740758
GGML_ASSERT(dst->ne[3] == 1); // just 3D tensors supported
759+
GGML_ASSERT(strcmp(dst->src[1]->buffer->buft->iface.get_name(dst->src[1]->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
760+
GGML_ASSERT(strcmp(dst->buffer->buft->iface.get_name(dst->buffer->buft), GGML_SYCL_NAME "_Split") != 0);
741761

742762
const dpct::queue_ptr main_stream = ctx.stream();
743763
const float * src0_dd = static_cast<const float *>(dst->src[0]->data);

0 commit comments

Comments
 (0)