@@ -514,6 +514,7 @@ inline void ggml_sycl_op_silu(ggml_backend_sycl_context & ctx, ggml_tensor * dst
514514 GGML_ASSERT (dst->type == GGML_TYPE_F32);
515515 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
516516 const dpct::queue_ptr main_stream = ctx.stream ();
517+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
517518 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
518519 float * dst_dd = static_cast <float *>(dst->data );
519520
@@ -526,6 +527,7 @@ inline void ggml_sycl_op_gelu(ggml_backend_sycl_context & ctx, ggml_tensor * dst
526527 GGML_ASSERT (dst->type == GGML_TYPE_F32);
527528 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
528529 const dpct::queue_ptr main_stream = ctx.stream ();
530+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
529531 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
530532 float * dst_dd = static_cast <float *>(dst->data );
531533
@@ -538,6 +540,7 @@ inline void ggml_sycl_op_gelu_quick(ggml_backend_sycl_context & ctx, ggml_tensor
538540 GGML_ASSERT (dst->type == GGML_TYPE_F32);
539541 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
540542 const dpct::queue_ptr main_stream = ctx.stream ();
543+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
541544 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
542545 float * dst_dd = static_cast <float *>(dst->data );
543546
@@ -551,6 +554,7 @@ inline void ggml_sycl_op_tanh(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
551554 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
552555
553556 const dpct::queue_ptr main_stream = ctx.stream ();
557+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
554558 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
555559 float * dst_dd = static_cast <float *>(dst->data );
556560 tanh_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
@@ -562,6 +566,7 @@ inline void ggml_sycl_op_relu(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
562566 GGML_ASSERT (dst->type == GGML_TYPE_F32);
563567 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
564568 const dpct::queue_ptr main_stream = ctx.stream ();
569+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
565570 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
566571 float * dst_dd = static_cast <float *>(dst->data );
567572 relu_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
@@ -573,6 +578,7 @@ inline void ggml_sycl_op_hardsigmoid(ggml_backend_sycl_context & ctx, ggml_tenso
573578 GGML_ASSERT (dst->type == GGML_TYPE_F32);
574579 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
575580 const dpct::queue_ptr main_stream = ctx.stream ();
581+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
576582 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
577583 float * dst_dd = static_cast <float *>(dst->data );
578584 hardsigmoid_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
@@ -585,6 +591,7 @@ inline void ggml_sycl_op_hardswish(ggml_backend_sycl_context & ctx, ggml_tensor
585591 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
586592
587593 const dpct::queue_ptr main_stream = ctx.stream ();
594+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
588595 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
589596 float * dst_dd = static_cast <float *>(dst->data );
590597
@@ -597,6 +604,7 @@ inline void ggml_sycl_op_exp(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
597604 GGML_ASSERT (dst->type == GGML_TYPE_F32);
598605 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
599606 const dpct::queue_ptr main_stream = ctx.stream ();
607+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
600608 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
601609 float * dst_dd = static_cast <float *>(dst->data );
602610 exp_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
@@ -608,6 +616,7 @@ inline void ggml_sycl_op_log(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
608616 GGML_ASSERT ( dst->type == GGML_TYPE_F32);
609617 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
610618 const dpct::queue_ptr main_stream = ctx.stream ();
619+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
611620 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
612621 float * dst_dd = static_cast <float *>(dst->data );
613622
@@ -620,6 +629,7 @@ inline void ggml_sycl_op_sigmoid(ggml_backend_sycl_context & ctx, ggml_tensor *d
620629 GGML_ASSERT (dst->type == GGML_TYPE_F32);
621630 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
622631 const dpct::queue_ptr main_stream = ctx.stream ();
632+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
623633 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
624634 float * dst_dd = static_cast <float *>(dst->data );
625635
@@ -632,6 +642,7 @@ inline void ggml_sycl_op_sqrt(ggml_backend_sycl_context & ctx, ggml_tensor * dst
632642 GGML_ASSERT (dst->type == GGML_TYPE_F32);
633643 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
634644 const dpct::queue_ptr main_stream = ctx.stream ();
645+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
635646 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
636647 float * dst_dd = static_cast <float *>(dst->data );
637648 sqrt_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
@@ -643,6 +654,7 @@ inline void ggml_sycl_op_sin(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
643654 GGML_ASSERT (dst->type == GGML_TYPE_F32);
644655 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
645656 const dpct::queue_ptr main_stream = ctx.stream ();
657+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
646658 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
647659 float * dst_dd = static_cast <float *>(dst->data );
648660
@@ -655,6 +667,7 @@ inline void ggml_sycl_op_cos(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
655667 GGML_ASSERT (dst->type == GGML_TYPE_F32);
656668 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
657669 const dpct::queue_ptr main_stream = ctx.stream ();
670+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
658671 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
659672 float * dst_dd = static_cast <float *>(dst->data );
660673
@@ -669,6 +682,7 @@ inline void ggml_sycl_op_step(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
669682 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
670683 float * dst_dd = static_cast <float *>(dst->data );
671684 dpct::queue_ptr main_stream = ctx.stream ();
685+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
672686
673687 step_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
674688}
@@ -681,6 +695,7 @@ inline void ggml_sycl_op_neg(ggml_backend_sycl_context & ctx, ggml_tensor *dst)
681695 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
682696 float * dst_dd = static_cast <float *>(dst->data );
683697 dpct::queue_ptr main_stream = ctx.stream ();
698+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
684699
685700 neg_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
686701}
@@ -697,6 +712,7 @@ inline void ggml_sycl_op_leaky_relu(ggml_backend_sycl_context & ctx, ggml_tensor
697712 float * dst_dd = static_cast <float *>(dst->data );
698713
699714 dpct::queue_ptr main_stream = ctx.stream ();
715+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
700716
701717 leaky_relu_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), negative_slope, main_stream);
702718}
@@ -709,6 +725,7 @@ inline void ggml_sycl_op_sqr(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
709725 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
710726 float * dst_dd = static_cast <float *>(dst->data );
711727 dpct::queue_ptr main_stream = ctx.stream ();
728+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
712729
713730 sqr_f32_sycl (src0_dd, dst_dd, ggml_nelements (dst->src [0 ]), main_stream);
714731}
@@ -727,6 +744,7 @@ inline void ggml_sycl_op_upscale(ggml_backend_sycl_context & ctx, ggml_tensor *
727744 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
728745 float * dst_dd = static_cast <float *>(dst->data );
729746 dpct::queue_ptr main_stream = ctx.stream ();
747+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
730748
731749 upscale_f32_sycl (src0_dd, dst_dd, dst->src [0 ]->nb [0 ], dst->src [0 ]->nb [1 ], dst->src [0 ]->nb [2 ], dst->src [0 ]->nb [3 ],
732750 dst->ne [0 ], dst->ne [1 ], dst->ne [2 ], dst->ne [3 ], sf0, sf1, sf2, sf3,
@@ -743,6 +761,7 @@ inline void ggml_sycl_op_pad(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
743761 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
744762 float * dst_dd = static_cast <float *>(dst->data );
745763 dpct::queue_ptr main_stream = ctx.stream ();
764+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
746765
747766 pad_f32_sycl (src0_dd, dst_dd,
748767 dst->src [0 ]->ne [0 ], dst->src [0 ]->ne [1 ], dst->src [0 ]->ne [2 ],
@@ -760,6 +779,7 @@ inline void ggml_sycl_op_acc(ggml_backend_sycl_context & ctx,
760779 GGML_ASSERT (strcmp (dst->buffer ->buft ->iface .get_name (dst->buffer ->buft ), GGML_SYCL_NAME " _Split" ) != 0 );
761780
762781 const dpct::queue_ptr main_stream = ctx.stream ();
782+ SYCL_CHECK (ggml_sycl_set_device (ctx.device ));
763783 const float * src0_dd = static_cast <const float *>(dst->src [0 ]->data );
764784 const float * src1_dd = static_cast <const float *>(dst->src [1 ]->data );
765785 float * dst_dd = static_cast <float *>(dst->data );
0 commit comments