Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
sycl: the grouped XMX kernels (sub-group 8, joint_matrix 8x8x16) are Arc A-series only: an AOT build for Xe2 / Xe-HPC leaves them out (STRATA_NO_DG2_XMX), STRATA_PF_XMX is ignored with a message on Battlemage, and xmx_group_parity skips there
Niko122172a67c8e9023
diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txtindex fa0c79ddf..fd7349373 100644--- a/sycl/CMakeLists.txt+++ b/sycl/CMakeLists.txt@@ -37,6 +37,9 @@ if(STRATA_SYCL_SPIN_MAX)add_compile_definitions(STRATA_SYCL_SPIN_MAX=${STRATA_SYCL_SPIN_MAX}u)endif()set(_sycl_flags -fsycl)+if(STRATA_SYCL_AOT MATCHES "^(bmg|lnl|pvc)")+ add_compile_definitions(STRATA_NO_DG2_XMX=1) # the grouped XMX kernels (sub-group 8, 8x8x16) do not compile for Xe2 / Xe-HPC+endif()if(STRATA_SYCL_AOT)list(APPEND _sycl_flags -fsycl-targets=spir64_gen)# the divide/sqrt rounding option (below) must reach ocloc here: an AOT build has no spir64 backend to take itdiff --git a/sycl/src/kernels/cuda/iq_kernels.dp.cpp b/sycl/src/kernels/cuda/iq_kernels.dp.cppindex 2bcf692bc..e9f4a5742 100644--- a/sycl/src/kernels/cuda/iq_kernels.dp.cpp+++ b/sycl/src/kernels/cuda/iq_kernels.dp.cpp@@ -5213,6 +5213,7 @@ void launch(sycl::queue& q, int ty, bool gu, const sycl::half* X, float* Y, consconstexpr int BM = C::BM, BN = C::BN, KS = C::KS, WG = C::WG, SG = C::SG;constexpr int LDA = KS + 8, LDB = KS + 8;const int nb = N / BN;+#ifndef STRATA_NO_DG2_XMXq.submit([&](sycl::handler& h) {sycl::local_accessor<sycl::half, 1> sa(BM * LDA, h), sb(BN * LDB, h);auto props = sycl::ext::oneapi::experimental::properties{sycl::ext::intel::experimental::grf_size<256>};@@ -5298,6 +5299,11 @@ void launch(sycl::queue& q, int ty, bool gu, const sycl::half* X, float* Y, cons}});});+#else+ (void) q; (void) X; (void) Y; (void) gp; (void) ntiles; (void) N; (void) K;+ std::fprintf(stderr, "grouped XMX: the 8x8x16 / sub-group 8 kernel is not built for this device (STRATA_NO_DG2_XMX)\n");+ std::exit(1);+#endif}class k_xg_small; class k_xg_big;using Small = Cfg<2, 8, 4, 2>; // 64 x 128diff --git a/sycl/src/kernels/xmx_group_parity.cpp b/sycl/src/kernels/xmx_group_parity.cppindex d99f8c238..7b9d3eb47 100644--- a/sycl/src/kernels/xmx_group_parity.cpp+++ b/sycl/src/kernels/xmx_group_parity.cpp@@ -2,6 +2,7 @@// oneMKL per expert, on random expert blobs of each format the native packs use. Also times both.// xmx_group_parity [mean_rows=160] [n=16]#include "strata/kernels/iq_kernels.hpp"+#include "strata/sycl_queue.hpp"#include <sycl/sycl.hpp>#include <dpct/dpct.hpp>#include <dpct/blas_utils.hpp>@@ -16,6 +17,15 @@ int main(int argc, char** argv) {const int mean = argc > 1 ? std::atoi(argv[1]) : 160;const int n = argc > 2 ? std::atoi(argv[2]) : 16;sycl::queue* q = &dpct::get_in_order_queue();+#ifdef STRATA_NO_DG2_XMX+ std::printf("xmx_group_parity: SKIP (the sub-group 8 / 8x8x16 kernels are not built for this AOT device)");+ return 0;+#else+ if (strata::intel_gpu_gen(q->get_device()) == strata::IntelGpuGen::Battlemage) {+ std::printf("xmx_group_parity: SKIP (Battlemage has no sub-group 8 / 8x8x16 joint_matrix)");+ return 0;+ }+#endifdpct::blas::descriptor_ptr hd = new dpct::blas::descriptor();hd->set_queue(q);std::mt19937 rng(3);diff --git a/sycl/src/prefill/xmx_moe.dp.cpp b/sycl/src/prefill/xmx_moe.dp.cppindex f0418902b..416af931a 100644--- a/sycl/src/prefill/xmx_moe.dp.cpp+++ b/sycl/src/prefill/xmx_moe.dp.cpp@@ -7,6 +7,7 @@#include <sycl/ext/oneapi/matrix/matrix.hpp>#include <sycl/ext/intel/experimental/grf_size_properties.hpp>#include <cstdlib>+#include <cstdio>#include "strata/sycl_queue.hpp"#include "strata/prefill/xmx_moe.hpp"@@ -34,6 +35,7 @@ void launch(sycl::queue& q, const half* X, float* Y, const Grp& gp, int ntiles,constexpr int BM = C::BM, BN = C::BN, KS = C::KS, WG = C::WG, SG = C::SG;constexpr int LDA = KS + 8, LDB = KS + 8;const int nb = N / BN;+#ifndef STRATA_NO_DG2_XMXq.submit([&](sycl::handler& h) {sycl::local_accessor<half, 1> sa(BM * LDA, h), sb(BN * LDB, h);auto props = sycl::ext::oneapi::experimental::properties{sycl::ext::intel::experimental::grf_size<256>};@@ -107,6 +109,11 @@ void launch(sycl::queue& q, const half* X, float* Y, const Grp& gp, int ntiles,}});});+#else+ (void) q; (void) X; (void) Y; (void) gp; (void) ntiles; (void) N; (void) K;+ std::fprintf(stderr, "grouped XMX: the 8x8x16 / sub-group 8 kernel is not built for this device (STRATA_NO_DG2_XMX)\n");+ std::exit(1);+#endif}class k_small; class k_big;@@ -126,7 +133,22 @@ int fill(Grp& gp, const int32_t* cnt, int n) {} // namespaceint mode() {- static const int v = [] { const char* e = std::getenv("STRATA_PF_XMX"); return e ? std::atoi(e) : 0; }();+ // The kernels are joint_matrix 8x8x16 on sub-group 8: DG2 (Arc A-series) only. Battlemage has neither.+ static const int v = [] {+ const char* e = std::getenv("STRATA_PF_XMX");+ const int want = e ? std::atoi(e) : 0;+ if (want == 0) return 0;+#ifdef STRATA_NO_DG2_XMX+ std::fprintf(stderr, "STRATA_PF_XMX ignored: this build is AOT for a device without the sub-group 8 XMX kernels\n");+ return 0;+#else+ if (strata::intel_gpu_gen(strata::q_of(nullptr)->get_device()) == strata::IntelGpuGen::Battlemage) {+ std::fprintf(stderr, "STRATA_PF_XMX ignored: Battlemage has no sub-group 8 / 8x8x16 joint_matrix (Arc A-series only)\n");+ return 0;+ }+ return want;+#endif+ }();return v;}bool enabled() { return mode() != 0; }