Inkling SYCL: the Q8_ROW XMX matmul for 4..16 tokens is part of the fast set only

SQ-10's trunk is Q8_ROW. The 4..16-token XMX kernel sums the int8 products in another order than the one-token kernel, so verify windows of 4+ rows
differed from one-token steps by up to 1.27 in a logit (--spec-check DIFFERS). With STRATA_INK_NO_Q8_XMX=1 the same run is identical. The default now uses the
one-token kernel for every row count; --turbo keeps the XMX kernel. Also logs the Level Zero adapter version at start.
This commit is contained in:
Niko1221 committed 2026-12-02 22:23:35 +01:00
1 parent 177b279c02
commit 1df20c491f
3 files changed
+14 -3

No files matched your search

@@ -27,6 +27,14 @@ inline bool b70_kernels_enabled() {
return v;
}
// The Q8_ROW XMX matmul for 4..16 tokens (verify windows, DFlash 2) sums the int8 products in a different order from the one-token dp4a kernel, so its logits differ
// from the one-token step by rounding (SQ-10, whose trunk is Q8_ROW: --spec-check windows of 4+ rows differ by up to 1.27 in a logit). It runs in the Arc fast set
// (--turbo) only; the default keeps the one-token kernel for every row count, as the lossless default requires.
inline bool b70_q8_xmx_ok() {
static const bool v = arc_cfg().fast && !env_truthy_arc("STRATA_INK_NO_Q8_XMX");
return v;
}
// ============================================================================
// 1. High-Occupancy BF16 Linear & Fused QKVRG + Sinks + DynSConv Megakernel
// - 128-thread WGs (8 SG16s = 8 rows/WG -> 8 WGs/Xe2 core = 64 SG16s = 100% EU thread occupancy!)
@@ -3912,7 +3920,7 @@ inline void k_b70_q8row_m8_xmx_sg16(
float* Y0, int N0, float* Y1, int N1, float* Y2, int M,
bool fuse_swiglu_gu = false) {
#if INK_SY_HAS_JOINT_MATRIX
if (M >= 4 && M <= 16 && (K & 63) == 0 && is_bmg_gpu() && !env_truthy_arc("STRATA_INK_NO_Q8_XMX")) {
if (M >= 4 && M <= 16 && (K & 63) == 0 && is_bmg_gpu() && b70_q8_xmx_ok()) {
namespace jm = sycl::ext::oneapi::experimental::matrix;
if (fuse_swiglu_gu && ((N >> 1) & 63) == 0) {
const int out_N = N >> 1;
@@ -6778,7 +6786,7 @@ inline void k_b70_qkvrg_q8_fused_sg16(
const int same_qkv = (in_k == in_q && in_v == in_q) ? 1 : 0;
const int n_f32 = has_dyn_taps ? (24 + 32 + 32) : 24;
#if INK_SY_HAS_JOINT_MATRIX
if (M >= 4 && M <= 16 && is_bmg_gpu() && !env_truthy_arc("STRATA_INK_NO_Q8_XMX")) {
if (M >= 4 && M <= 16 && is_bmg_gpu() && b70_q8_xmx_ok()) {
namespace jm = sycl::ext::oneapi::experimental::matrix;
constexpr int K = INK_D;
constexpr int nbn = 134; // (3072 + 384 + 3072 + 1024 + 1024) / 64 = 134!
@@ -93,6 +93,9 @@ public:
return false;
}
ink_sycl::apply_gpu_index(opts.gpu_index, opts.gpus);
if (const char* v2 = std::getenv("UR_LOADER_USE_LEVEL_ZERO_V2")) {
std::fprintf(stderr, "[ink_sycl] Level Zero adapter: %s%s\n", (v2[0] == '1') ? "V2" : "V1", ink_sycl::intel_battlemage_pci_present() ? " (Battlemage GPU present)" : "");
}
const auto& acfg = ink_sycl::arc_cfg();
const int par = std::max(1, std::min(64, opts.parallel));
const int ctx = std::max(256, opts.max_ctx);
+1 -1
View File
@@ -24978,7 +24978,7 @@
"last_date": "2026-12-02",
"status": "rollback",
"owner": "owner-intelarc",
"note": "Intel Arc Battlemage fast set: 1 turns the Q8_ROW XMX matmul for 4 to 16 tokens off.",
"note": "Intel Arc Battlemage --turbo: 1 turns the Q8_ROW XMX matmul for 4 to 16 tokens off (it runs in the fast set only; the lossless default uses the one-token kernel for every row count).",
"retire_after": "",
"retired_in": ""
},