From 8115b4c31faeab22954383202e0c26c4e55944e4 Mon Sep 17 00:00:00 2001 From: Neo Zhang Date: Tue, 20 Oct 2026 19:35:48 +0800 Subject: [PATCH] sycl : replace memset due to not always ordered (#30812) --- ggml/src/ggml-sycl/fattn-sparse.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-sycl/fattn-sparse.cpp b/ggml/src/ggml-sycl/fattn-sparse.cpp index df2837094..6ea7d5404 100644 --- a/ggml/src/ggml-sycl/fattn-sparse.cpp +++ b/ggml/src/ggml-sycl/fattn-sparse.cpp @@ -202,7 +202,8 @@ bool ggml_sycl_flash_attn_ext_sparse(ggml_backend_sycl_context & ctx, ggml_tenso uint8_t * d_V = v_alloc.get(); sycl::half * d_mask = m_alloc.get(); - SYCL_CHECK(CHECK_TRY_ERROR(stream->memset(d_cnt, 0, sizeof(int32_t)))); + // reset with a kernel: on Level Zero a queue memset is not always ordered before the next kernel + stream->single_task([=]() { *d_cnt = 0; }); sparse_fa_compact_mask(stream, (const sycl::half *) mask->data, d_idx, d_cnt, n_kv, n_kv_g);