Archived
libxe2: DPAS flash attention at head_dim 64 and 128, not only 256
attn_flash_esimd (decode / verify and prefill) and attn_flash_quad (prefill) were written over HD but gated to head_dim 256 (Qwen3.8's full attention); every other model fell to the SIMT kernel. Both now dispatch 64, 128 and 256; the decode merge takes HD / 16 values a lane. MiniCPM5-2B bf16 (head_dim 128, gqa 8) on the Arc Pro B65, same build, XE2_ATTN_SIMT=1 as before: decode 69.3 -> 83.1 tok/s, prefill at ~2k tokens 1806 -> 8080 tok/s. rad-kbench attn_paged: fixture 207/207, MiniCPM5 160/160, Qwen3.8-27B 160/160. KL against XE2_EXACT=1 over the 12-document corpus: mean 0.00060, top-1 98.59% (the SIMT kernel: 0.00060, 98.59%). Qwen3.8-27B int4 unchanged (30.1 tok/s, 1361 tok/s prefill). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
989db71bfc
commit
3582900903
2 files changed
+91
-54
No files matched your search
@@ -346,17 +346,24 @@ int attn_flash_quad(sycl::queue& q, int64_t head_dim, const uint16_t* qb, int64_
|
||||
int64_t sb, int64_t sh, int64_t so, const char* btb, uint32_t btdt, int64_t bt_cs, const char* sub,
|
||||
uint32_t sudt, int64_t rows, int64_t kv_heads, int64_t gqa, float scale, int64_t jcap,
|
||||
uint16_t* ob, int64_t o_rs, int64_t o_hs) {
|
||||
if (head_dim != 256 || so != 2 * 256 || gqa < 1 || gqa > 8 || rows < 16) return RAD_E_UNSUPPORTED;
|
||||
if ((head_dim != 64 && head_dim != 128 && head_dim != 256) || so != 2 * head_dim || gqa < 1 || gqa > 8 || rows < 16)
|
||||
return RAD_E_UNSUPPORTED;
|
||||
#ifndef XE2_FAQ_KA
|
||||
#define XE2_FAQ_KA 1
|
||||
#endif
|
||||
/* gqa <= 6: two 16-row groups a work-group, 48 threads walking the same pages (126 KiB of staged
|
||||
* queries and swap area; one group a work-group was 28.3 TFLOPS at 64k, two 30.3); gqa 7-8 one */
|
||||
if (gqa <= 6)
|
||||
return launch_quad<256, 6, true, 2, XE2_FAQ_KA>(q, qb, q_rs, q_hs, cb, sb, sh, so, btb, btdt, bt_cs, sub, sudt, rows, kv_heads,
|
||||
(int)gqa, scale, jcap, ob, o_rs, o_hs, (int)gqa);
|
||||
return launch_quad<256, 8, true, 1>(q, qb, q_rs, q_hs, cb, sb, sh, so, btb, btdt, bt_cs, sub, sudt, rows, kv_heads,
|
||||
(int)gqa, scale, jcap, ob, o_rs, o_hs, (int)gqa);
|
||||
* queries and swap area at head_dim 256; one group a work-group was 28.3 TFLOPS at 64k, two 30.3);
|
||||
* gqa 7-8 one */
|
||||
#define XE2_QUAD(HD) \
|
||||
(gqa <= 6 ? launch_quad<HD, 6, true, 2, XE2_FAQ_KA>(q, qb, q_rs, q_hs, cb, sb, sh, so, btb, btdt, bt_cs, sub, \
|
||||
sudt, rows, kv_heads, (int)gqa, scale, jcap, ob, o_rs, \
|
||||
o_hs, (int)gqa) \
|
||||
: launch_quad<HD, 8, true, 1>(q, qb, q_rs, q_hs, cb, sb, sh, so, btb, btdt, bt_cs, sub, sudt, rows, \
|
||||
kv_heads, (int)gqa, scale, jcap, ob, o_rs, o_hs, (int)gqa))
|
||||
if (head_dim == 64) return XE2_QUAD(64);
|
||||
if (head_dim == 128) return XE2_QUAD(128);
|
||||
return XE2_QUAD(256);
|
||||
#undef XE2_QUAD
|
||||
}
|
||||
|
||||
} // namespace xe2
|
||||
Reference in new issue
Block a user