Commit 81ff0cab0 for llama.cpp

commit 81ff0cab06cf97b445c647d278594c7f97b39740
Author: Michael Taylor <162068037+mctylr-gh@users.noreply.github.com>
Date:   Wed Nov 25 03:35:18 2026 -0400

    sycl: F8 e4m3 initial support SET_ROWS, CPY, ADD, MUL_MAT, MUL_MAT_ID (#31871)

diff --git a/ggml/src/ggml-sycl/binbcast.cpp b/ggml/src/ggml-sycl/binbcast.cpp
index fbfedd60b..e8f40d20c 100644
--- a/ggml/src/ggml-sycl/binbcast.cpp
+++ b/ggml/src/ggml-sycl/binbcast.cpp
@@ -5,6 +5,7 @@
 #include <cstdint>
 #include <sycl/sycl.hpp>

+#include "convert.hpp"
 #include "ggml.h"

 template<float (*bin_op)(const float, const float), typename src0_t, typename src1_t, typename dst_t>
@@ -46,7 +47,9 @@ static void k_bin_bcast(const src0_t * src0, const src1_t * src1, dst_t * dst,
     for (int i0 = i0s; i0 < ne0;
          i0 += item_ct1.get_local_range(2) * item_ct1.get_group_range(2)) {
         const int i10 = (int) fast_div_modulo((uint32_t) i0, ne10_fd).y();
-        dst_row[i0] = (dst_t)bin_op(src0 ? (float)src0_row[i0*s00] : 0.0f, (float)src1_row[i10*s10]);
+        const float a = src0 ? ggml_sycl_cast<float>(src0_row[i0*s00]) : 0.0f;
+        const float b = ggml_sycl_cast<float>(src1_row[i10*s10]);
+        dst_row[i0] = ggml_sycl_cast<dst_t>(bin_op(a, b));
     }
 }

@@ -85,7 +88,9 @@ static void k_bin_bcast_unravel(const src0_t * src0, const src1_t * src1, dst_t
     dst_t * dst_row = dst + i_dst;

     const int i10 = (int) fast_div_modulo((uint32_t) i0, ne10_fd).y();
-    dst_row[i0] = (dst_t)bin_op(src0 ? (float)src0_row[i0*s00] : 0.0f, (float)src1_row[i10*s10]);
+    const float a = src0 ? ggml_sycl_cast<float>(src0_row[i0*s00]) : 0.0f;
+    const float b = ggml_sycl_cast<float>(src1_row[i10*s10]);
+    dst_row[i0] = ggml_sycl_cast<dst_t>(bin_op(a, b));
 }


@@ -291,6 +296,11 @@ inline void ggml_sycl_op_bin_bcast(ggml_backend_sycl_context & ctx, const ggml_t
              ne10, ne11, ne12, ne13, ne0, ne1, ne2, ne3, nb00, nb01, nb02, nb03, nb10, nb11, nb12, nb13, nb0, nb1, nb2,
              nb3, ggml_is_contiguous(src0), ggml_is_contiguous(src1), ggml_is_permuted(src0), ggml_is_permuted(src1),
              main_stream);
+    } else if (src0->type == GGML_TYPE_F8_E4M3 && src1->type == GGML_TYPE_F32 && dst->type == GGML_TYPE_F8_E4M3) {
+        op()((const ggml_fp8_e4m3_t *) src0->data, (const float *) src1->data, (ggml_fp8_e4m3_t *) dst->data, ne00, ne01,
+             ne02, ne03, ne10, ne11, ne12, ne13, ne0, ne1, ne2, ne3, nb00, nb01, nb02, nb03, nb10, nb11, nb12, nb13, nb0,
+             nb1, nb2, nb3, ggml_is_contiguous(src0), ggml_is_contiguous(src1), ggml_is_permuted(src0),
+             ggml_is_permuted(src1), main_stream);
 #ifdef GGML_SYCL_HAS_BF16
     } else if (src0->type == GGML_TYPE_BF16 && src1->type == GGML_TYPE_BF16 && dst->type == GGML_TYPE_BF16) {
         op()((const sycl::ext::oneapi::bfloat16 *) src0->data, (const sycl::ext::oneapi::bfloat16 *) src1->data,
diff --git a/ggml/src/ggml-sycl/convert.cpp b/ggml/src/ggml-sycl/convert.cpp
index e991e29e7..b88ef53d9 100644
--- a/ggml/src/ggml-sycl/convert.cpp
+++ b/ggml/src/ggml-sycl/convert.cpp
@@ -636,7 +636,7 @@ static void convert_unary_nc(const void * __restrict__ vx, dst_t * __restrict__

 #pragma unroll
     for (int64_t i00 = global_id; i00 < ne00; i00 += work_group_size * item_ct1.get_group_range(2)) {
-        y[iy + i00] = static_cast<dst_t>(x[ix + i00]);
+        y[iy + i00] = ggml_sycl_cast<dst_t>(x[ix + i00]);
     }
 }

@@ -785,6 +785,8 @@ static to_t_sycl_t<dst_t> ggml_get_dequant_sycl(ggml_type type, ggml_tensor * ds
         case GGML_TYPE_BF16:
             return convert_unary_sycl<sycl::ext::oneapi::bfloat16>;
 #endif
+        case GGML_TYPE_F8_E4M3:
+            return convert_unary_sycl<ggml_fp8_e4m3_t>;
         default:
             break;
     }
diff --git a/ggml/src/ggml-sycl/convert.hpp b/ggml/src/ggml-sycl/convert.hpp
index 8de79d10f..6dea2af44 100644
--- a/ggml/src/ggml-sycl/convert.hpp
+++ b/ggml/src/ggml-sycl/convert.hpp
@@ -40,6 +40,11 @@ template<typename dst_t, typename src_t>
  inline dst_t ggml_sycl_cast(src_t x) {
     if constexpr (std::is_same_v<dst_t, src_t>) {
         return x;
+    } else if constexpr (std::is_same_v<dst_t, ggml_fp8_e4m3_t>) {
+        // ggml_fp8_e4m3_t is a struct, so this branch comes before the float(x) paths
+        return { ggml_fp32_to_f8_e4m3(float(x)) };
+    } else if constexpr (std::is_same_v<src_t, ggml_fp8_e4m3_t>) {
+        return dst_t(ggml_f8_e4m3_to_fp32(x.bits));
 #ifdef GGML_SYCL_HAS_BF16
     } else if constexpr (std::is_same_v<dst_t, sycl::ext::oneapi::bfloat16>) {
         return sycl::ext::oneapi::bfloat16(float(x));
diff --git a/ggml/src/ggml-sycl/cpy.cpp b/ggml/src/ggml-sycl/cpy.cpp
index 8e1f1d50a..ee86e9665 100644
--- a/ggml/src/ggml-sycl/cpy.cpp
+++ b/ggml/src/ggml-sycl/cpy.cpp
@@ -3,6 +3,7 @@
 #include <float.h>
 #include <vector>

+#include "convert.hpp"
 #include "dequantize.hpp"
 #include "ggml-sycl/common.hpp"
 #include "ggml-sycl/presets.hpp"
@@ -64,6 +65,41 @@ static void cpy_1_i32_f32(const char * cxi, char * cdsti) {
     *dsti = (float) *xi;
 }

+static void cpy_1_f8_e4m3_f8_e4m3(const char * cxi, char * cdsti) {
+    const ggml_fp8_e4m3_t * xi   = (const ggml_fp8_e4m3_t *) cxi;
+    ggml_fp8_e4m3_t *       dsti = (ggml_fp8_e4m3_t *) cdsti;
+
+    *dsti = *xi;
+}
+
+static void cpy_1_f8_e4m3_f32(const char * cxi, char * cdsti) {
+    const ggml_fp8_e4m3_t * xi   = (const ggml_fp8_e4m3_t *) cxi;
+    float *                 dsti = (float *) cdsti;
+
+    *dsti = ggml_sycl_cast<float>(*xi);
+}
+
+static void cpy_1_f32_f8_e4m3(const char * cxi, char * cdsti) {
+    const float *         xi   = (const float *) cxi;
+    ggml_fp8_e4m3_t *     dsti = (ggml_fp8_e4m3_t *) cdsti;
+
+    *dsti = ggml_sycl_cast<ggml_fp8_e4m3_t>(*xi);
+}
+
+static void cpy_1_f8_e4m3_f16(const char * cxi, char * cdsti) {
+    const ggml_fp8_e4m3_t * xi   = (const ggml_fp8_e4m3_t *) cxi;
+    sycl::half *            dsti = (sycl::half *) cdsti;
+
+    *dsti = ggml_sycl_cast<sycl::half>(*xi);
+}
+
+static void cpy_1_f16_f8_e4m3(const char * cxi, char * cdsti) {
+    const sycl::half *    xi   = (const sycl::half *) cxi;
+    ggml_fp8_e4m3_t *     dsti = (ggml_fp8_e4m3_t *) cdsti;
+
+    *dsti = ggml_sycl_cast<ggml_fp8_e4m3_t>(*xi);
+}
+
 #ifdef GGML_SYCL_HAS_BF16
 static void cpy_1_f32_bf16(const char * cxi, char * cdsti) {
     const float * xi   = (const float *) cxi;
@@ -99,6 +135,20 @@ static void cpy_1_bf16_f16(const char * cxi, char * cdsti) {

     *dsti = sycl::half(static_cast<float>(*xi));
 }
+
+static void cpy_1_f8_e4m3_bf16(const char * cxi, char * cdsti) {
+    const ggml_fp8_e4m3_t *         xi   = (const ggml_fp8_e4m3_t *) cxi;
+    sycl::ext::oneapi::bfloat16 *   dsti = (sycl::ext::oneapi::bfloat16 *) cdsti;
+
+    *dsti = ggml_sycl_cast<sycl::ext::oneapi::bfloat16>(*xi);
+}
+
+static void cpy_1_bf16_f8_e4m3(const char * cxi, char * cdsti) {
+    const sycl::ext::oneapi::bfloat16 * xi   = (const sycl::ext::oneapi::bfloat16 *) cxi;
+    ggml_fp8_e4m3_t *                   dsti = (ggml_fp8_e4m3_t *) cdsti;
+
+    *dsti = ggml_sycl_cast<ggml_fp8_e4m3_t>(*xi);
+}
 #endif

 template <cpy_kernel_t cpy_1>
@@ -344,6 +394,90 @@ static void ggml_cpy_i32_f32_sycl(const char * cx, char * cdst, const int ne, co
     }
 }

+static void ggml_cpy_f8_e4m3_f8_e4m3_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
+                                          const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
+                                          const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
+                                          const int nb12, const int nb13, queue_ptr stream) {
+    const int num_blocks = (ne + SYCL_CPY_BLOCK_SIZE - 1) / SYCL_CPY_BLOCK_SIZE;
+    {
+        stream->parallel_for(
+            sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE),
+                              sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE)),
+            [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
+                cpy_f32_f16<cpy_1_f8_e4m3_f8_e4m3>(cx, cdst, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12,
+                                                   nb10, nb11, nb12, nb13, item_ct1);
+            });
+    }
+}
+
+static void ggml_cpy_f8_e4m3_f32_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
+                                      const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
+                                      const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
+                                      const int nb12, const int nb13, queue_ptr stream) {
+    const int num_blocks = (ne + SYCL_CPY_BLOCK_SIZE - 1) / SYCL_CPY_BLOCK_SIZE;
+    {
+        stream->parallel_for(
+            sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE),
+                              sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE)),
+            [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
+                cpy_f32_f16<cpy_1_f8_e4m3_f32>(cx, cdst, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12,
+                                               nb10, nb11, nb12, nb13, item_ct1);
+            });
+    }
+}
+
+static void ggml_cpy_f32_f8_e4m3_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
+                                      const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
+                                      const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
+                                      const int nb12, const int nb13, queue_ptr stream) {
+    const int num_blocks = (ne + SYCL_CPY_BLOCK_SIZE - 1) / SYCL_CPY_BLOCK_SIZE;
+    {
+        stream->parallel_for(
+            sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE),
+                              sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE)),
+            [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
+                cpy_f32_f16<cpy_1_f32_f8_e4m3>(cx, cdst, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12,
+                                               nb10, nb11, nb12, nb13, item_ct1);
+            });
+    }
+}
+
+static void ggml_cpy_f8_e4m3_f16_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
+                                      const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
+                                      const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
+                                      const int nb12, const int nb13, queue_ptr stream) {
+    const int num_blocks = (ne + SYCL_CPY_BLOCK_SIZE - 1) / SYCL_CPY_BLOCK_SIZE;
+    {
+        dpct::has_capability_or_fail(stream->get_device(), { sycl::aspect::fp16 });
+
+        stream->parallel_for(
+            sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE),
+                              sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE)),
+            [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
+                cpy_f32_f16<cpy_1_f8_e4m3_f16>(cx, cdst, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12,
+                                               nb10, nb11, nb12, nb13, item_ct1);
+            });
+    }
+}
+
+static void ggml_cpy_f16_f8_e4m3_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
+                                      const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
+                                      const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
+                                      const int nb12, const int nb13, queue_ptr stream) {
+    const int num_blocks = (ne + SYCL_CPY_BLOCK_SIZE - 1) / SYCL_CPY_BLOCK_SIZE;
+    {
+        dpct::has_capability_or_fail(stream->get_device(), { sycl::aspect::fp16 });
+
+        stream->parallel_for(
+            sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE),
+                              sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE)),
+            [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
+                cpy_f32_f16<cpy_1_f16_f8_e4m3>(cx, cdst, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12,
+                                               nb10, nb11, nb12, nb13, item_ct1);
+            });
+    }
+}
+
 static void ggml_cpy_f32_q8_0_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
                                    const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
                                    const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
@@ -1246,6 +1380,34 @@ static void ggml_cpy_bf16_f16_sycl(const char * cx, char * cdst, const int ne, c
                                            nb10, nb11, nb12, nb13, item_ct1);
         });
 }
+
+static void ggml_cpy_f8_e4m3_bf16_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
+                                       const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
+                                       const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
+                                       const int nb12, const int nb13, queue_ptr stream) {
+    const int num_blocks = (ne + SYCL_CPY_BLOCK_SIZE - 1) / SYCL_CPY_BLOCK_SIZE;
+    stream->parallel_for(
+        sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE),
+                          sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE)),
+        [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
+            cpy_f32_f16<cpy_1_f8_e4m3_bf16>(cx, cdst, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12,
+                                             nb10, nb11, nb12, nb13, item_ct1);
+        });
+}
+
+static void ggml_cpy_bf16_f8_e4m3_sycl(const char * cx, char * cdst, const int ne, const int ne00, const int ne01,
+                                       const int ne02, const int nb00, const int nb01, const int nb02, const int nb03,
+                                       const int ne10, const int ne11, const int ne12, const int nb10, const int nb11,
+                                       const int nb12, const int nb13, queue_ptr stream) {
+    const int num_blocks = (ne + SYCL_CPY_BLOCK_SIZE - 1) / SYCL_CPY_BLOCK_SIZE;
+    stream->parallel_for(
+        sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE),
+                          sycl::range<3>(1, 1, SYCL_CPY_BLOCK_SIZE)),
+        [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]]{
+            cpy_f32_f16<cpy_1_bf16_f8_e4m3>(cx, cdst, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12,
+                                             nb10, nb11, nb12, nb13, item_ct1);
+        });
+}
 #endif

 void ggml_sycl_cpy(ggml_backend_sycl_context & ctx, const ggml_tensor * src0, const ggml_tensor * src1) try {
@@ -1418,6 +1580,29 @@ void ggml_sycl_cpy(ggml_backend_sycl_context & ctx, const ggml_tensor * src0, co
     } else if (src0->type == GGML_TYPE_BF16 && src1->type == GGML_TYPE_F16) {
         ggml_cpy_bf16_f16_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
                               nb11, nb12, nb13, main_stream);
+#endif
+    } else if (src0->type == GGML_TYPE_F8_E4M3 && src1->type == GGML_TYPE_F8_E4M3) {
+        ggml_cpy_f8_e4m3_f8_e4m3_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
+                                      nb11, nb12, nb13, main_stream);
+    } else if (src0->type == GGML_TYPE_F8_E4M3 && src1->type == GGML_TYPE_F32) {
+        ggml_cpy_f8_e4m3_f32_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
+                                  nb11, nb12, nb13, main_stream);
+    } else if (src0->type == GGML_TYPE_F32 && src1->type == GGML_TYPE_F8_E4M3) {
+        ggml_cpy_f32_f8_e4m3_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
+                                  nb11, nb12, nb13, main_stream);
+    } else if (src0->type == GGML_TYPE_F8_E4M3 && src1->type == GGML_TYPE_F16) {
+        ggml_cpy_f8_e4m3_f16_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
+                                  nb11, nb12, nb13, main_stream);
+    } else if (src0->type == GGML_TYPE_F16 && src1->type == GGML_TYPE_F8_E4M3) {
+        ggml_cpy_f16_f8_e4m3_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
+                                  nb11, nb12, nb13, main_stream);
+#ifdef GGML_SYCL_HAS_BF16
+    } else if (src0->type == GGML_TYPE_F8_E4M3 && src1->type == GGML_TYPE_BF16) {
+        ggml_cpy_f8_e4m3_bf16_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
+                                   nb11, nb12, nb13, main_stream);
+    } else if (src0->type == GGML_TYPE_BF16 && src1->type == GGML_TYPE_F8_E4M3) {
+        ggml_cpy_bf16_f8_e4m3_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
+                                   nb11, nb12, nb13, main_stream);
 #endif
     } else {
         GGML_LOG_ERROR("%s: unsupported type combination (%s to %s)\n", __func__, ggml_type_name(src0->type),
diff --git a/ggml/src/ggml-sycl/set_rows.cpp b/ggml/src/ggml-sycl/set_rows.cpp
index c73ad8dc2..8a471b96b 100644
--- a/ggml/src/ggml-sycl/set_rows.cpp
+++ b/ggml/src/ggml-sycl/set_rows.cpp
@@ -1,6 +1,7 @@
 #include "set_rows.hpp"
 #include "cpy.hpp"

+#include "convert.hpp"
 #include "ggml-quants.h"

 #include <vector>
@@ -12,6 +13,7 @@ static constexpr bool is_arithmetic_v() {
 #ifdef GGML_SYCL_HAS_BF16
         || std::is_same_v<T, sycl::ext::oneapi::bfloat16>
 #endif
+        || std::is_same_v<T, ggml_fp8_e4m3_t>
         ;
 }
 }
@@ -20,8 +22,13 @@ template<typename TIn, typename TOut>
 static inline std::enable_if_t<utils::is_arithmetic_v<TIn>() && utils::is_arithmetic_v<TOut>(), void>
 convert (const char* src, char* dst) {
     auto src_val = *reinterpret_cast<const TIn*>(src);
-    auto dst_val = sycl::vec<TIn, 1>(src_val).template convert<TOut, sycl::rounding_mode::automatic>()[0];
-   *reinterpret_cast<TOut*>(dst) = dst_val;
+    if constexpr (std::is_same_v<TIn, ggml_fp8_e4m3_t> || std::is_same_v<TOut, ggml_fp8_e4m3_t>) {
+        // sycl::vec does not support ggml_fp8_e4m3_t, so f8 uses ggml_sycl_cast
+        *reinterpret_cast<TOut*>(dst) = ggml_sycl_cast<TOut>(src_val);
+    } else {
+        auto dst_val = sycl::vec<TIn, 1>(src_val).template convert<TOut, sycl::rounding_mode::automatic>()[0];
+        *reinterpret_cast<TOut*>(dst) = dst_val;
+    }
 }

 #ifdef GGML_SYCL_HAS_BF16
@@ -355,6 +362,18 @@ static void set_rows_sycl(ggml_backend_sycl_context & ctx, const ggml_tensor * s
             );
             break;
 #endif
+        case GGML_TYPE_F8_E4M3:
+            set_rows_sycl<TIn, TIdx, ggml_fp8_e4m3_t>(
+                src0_d, src1_d, (char *)dst->data,
+                ne00, ne01, ne02, ne03,
+                ne11, ne12,
+                nb01, nb02, nb03,
+                nb10, nb11, nb12,
+                nb1, nb2, nb3,
+                sizeof(TIn), sizeof(ggml_fp8_e4m3_t),
+                stream
+            );
+            break;
         case GGML_TYPE_Q8_0:
             set_rows_sycl_q<TIn, TIdx, block_q8_0, QK8_0, cpy_blck_f32_q8_0>(
                 src0_d, src1_d, (block_q8_0 *) dst->data, ne00, ne01, ne02, ne03,