Repository navigation
xpu(flashnext): Xe2 DPAS tile kernels, adaptive solo chunks, and confidence MTP - #3603
Conversation
|
/atc depends 3587 |
|
Attached the full |
c5944f1 to
d8c10bb
Compare
|
Amended Full updated |
d8c10bb to
a168cb0
Compare
|
Restacked onto updated #3587 ( Re-verified on the rebased head:
|
a168cb0 to
a810666
Compare
|
Thank you @supernovae. XPU_CHUNK and XPU_CHUNK_SOLO now go through the startup parser with bounds and invalid-input tests, and an explicit One thing on our side:
|
a810666 to
207aaae
Compare
|
Thanks @supernovae. To get this moving, we rebased this onto the finished #3587 ourselves, keeping your commits as they were. It carries the Windows test guard from #3586, and with it the Windows build compiles; nothing else changed. It is in the landing queue now; nothing is needed from you.
|
207aaae to
b04951b
Compare
|
I traced the red Windows benchmark client check at I trial-merged Ash's fake-stream fixture fix #4260 ( A trial merge of the #3603 public head against main reported 16 conflicts. The same 16 paths conflicted when paired with #4260, with no additional path from the fixture change. I reran checks after the rebase to The full No GPU workflow has now completed successfully on Igor Lessio - AIFLOW LABS |
b04951b to
a2320fe
Compare
…-bench -- 2.54.0 (Apple Git-157) -- 2.43.0
…with host-RAM PLE and MTP -- 2.43.0
a2320fe to
9c587f2
Compare
|
Thank you @supernovae. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
Refs #3583
Depends on #3587 (stacked 4 of 4: #3585 -> #3586 -> #3587 -> this PR)
Summary
Optimizes
Qwen3.8 Flash Next(qwen4_exp) prefill and decode throughput on Intel Xe2 GPUs (TP={1, 2, 4}) while preserving0-ULPbit-exact chunk invariance across1 .. 2,048rows:Coalesced 16-Column Tile-Packed Intel Xe2 XMX
DPASKernels (fn_dpas.cl,fn_moe_head.cl,fn_mixers.cl,flashnext.cl):PackJobonhost_pool) into[ceil(N/16), K/32, 4, 16]tiles so every 16-lane subgroup reads 4 contiguous 64-byte cachelines across all batch widthsR = 1 .. 2,048.ONES_BF16(0x3f803f80) XMXDPASand fixed left-to-right 4-quarter K-reductions(((p0 + p1) + p2) + p3)soR = 1,R = 2..16,R = 64, andR = 2,048produce bit-for-bit identical outputs (chunk_invariant = true, unlocking.planned = falseprompt-cache rules).qmv1_dpas,qmv16_dpas,qmm_tile_dpas), HyperConnections (hc_down_1/wide,hc_upmix_1/dpas, 4-stream parallelhc_writeback_norm), router (router_dpas_1/mm), and MoE (moe_compact,moe_up_1/dpas,moe_down_1/dpas,moe_sh_up_1/dpas,moe_combine) onto Xe2DPASwith0compiler warnings and0register spills (ocloc -device bmg).16x64query-blockedPOOLEDSLM reuse infn_qsa_scores(local ushort qs[16][512],KERNEL(256)), cuttingqsa_scores1.90xat256k(62.62 -> 32.89 s, exactfma/sub_group_reduce_addorder preserved).[32x64]KERNEL(256)layout and active-subgroup masking (sg_m * 8 < m/sg_m * 16 < m) infn_moe_up_dpas/fn_moe_down_dpasfor sparse small-mexpert groups (86.6%of busyc=64groups havem <= 8), plus row-parallel(tiles, R)launches (R = 1..16) on narrow-NL2-resident projections and active-pair Split-KDPASduring speculative verify /verifyMulti.Adaptive Solo Prompt Chunking & Attention Scratch Sub-Tiling (
xpu_lane_prompt.zig,xpu_flashnext.zig,xpu_state.zig,xpu_ops.zig,xpu_store.zig):prefill_step,cancel_prefill, andreports_fillonnative/xpu_lane.zig(xpu_lane_prompt.zig), usinglanes.solo_chunk.passRowsto runsolo_rows = 2,048when no other stream is decoding and automatically drop tobusy_rows = 64when an active stream is decoding (XPU_CHUNKandXPU_CHUNK_SOLOvalidated before device access).attn_tile_rows = 64insideattnRank, saving~3.3 GiB/GPUso full262,144(256k) context fits in24.42 GiB/GPU(> 7.3 GiB/GPUfree on 32 GB cards) even withsolo_rows = 2,048.Confidence-Stopped MTP Chains & Probability Pricing (
xpu_engine.zig,xpu_lane.zig,xpu_forward.zig,xpu_ple.zig):draftFirstProbs/draftKeptProbswith cumulative confidence early-stopping (conf = -0.4,max_drafts = 6) and wirestreeFn+probabilitiesFn(draft_probabilities = true,plain_streams = 16) intoxpu_lane.zig, plus removes the redundant hostsyncAll()at the end ofkeepRowsSeqand foldsw_scaleinto single-passPLEdequantRow.Full Benchmark Receipts (
4x Intel Arc Pro B70 32 GB,TP=4,Qwen3.8-Flash-Next-MLX-4bit-MTP,d8c10bb)Updated full
tools/bench_*.py+xpu-flashnexttables (2K->256Kfull262,144window) attached to Gate Issue #3583: #3583 (comment) (superseding earlierc5944f1run: #3583 (comment)).TP=4, 4x Arc Pro B70)#3587Baseline (64-row)d8c10bb,DPAS+ QSA/MoE + Adaptive Solo)#3587bench_cache.pyCold Prefill (2K/8K/32K)~385 tok/s1,640.8/1,539.6/1,474.5 tok/spk (1.25s/5.33s/22.5s)3.83x - 4.26xbench_cache.pyCold Prefill (64K/128K/256Kfull)~380/~375/~350 tok/s1,412.6/1,319.4/1,173.9 tok/spk (46.5s/99.7s/226.2s)3.35x - 3.72x32K/64K/128K/256Kceiling)394/393/386/359 tok/s1,347.6/1,340.1/1,287.6/1,163.9 tok/s3.24x - 3.42x--benchwarm)6.45 ms/round1.74 - 1.82 ms/round3.6xfasterbench_openai.py256tok (fibonacci/chat,T=0med)176.5(180.1pk,4.00 tok/chunk) /146.6 tok/sbench_openai.py256tok (fibonacci/chat,T=1med)143.9(163.5pk) /115.6 tok/sbench_openai.py64tok (fibonacci/chat,T=0med)112.6/106.9 tok/s159.3/159.5 tok/s+41.5%/+49.2%bench_concurrent.py16Distinct Prompts (T=0,S=1/2/4/8)202.0/246.1/266.2/252.1 tok/ssteady0unequalbench_concurrent.pyStandard (S=2/4/8/32,T=0)133.6/150.7/172.6/145.0 tok/s195.7/223.2/237.2/215.0 tok/ssteady+37.4% - +48.3%bench_fill.py16K&32KPrefill +512-tok Active Chatgap_p95 = 197.0 - 199.8 ms(exact: true)Verification
tools/bench_cache.py --require-coldacross2,048,8,192,32,768,65,536,131,072, and262,079(+ 64=262,143/262,144full window): all 6 cells exited0with"qualified": true,cached_tokens == 0, andequal_first_tokens: true.tools/bench_fill.pyat16,384and32,768long prompt tokens (--reply 512): both exited0withexact: trueandcold: truein bothreply_firstandlong_firstorders.tools/bench_concurrent.py --alone --serial: all 8 cells on--prompts tools/bench_prompts.json(16distinct prompts) and all 24 cells oncode/chat(1 .. 32streams) passed withfailed = 0,alone_unequal = 0, andserial_unequal = 0.xpu-flashnextraw CLI across512 .. 262,080 + 64 = 262,144: all 11 depths verifiedMTP == serial: true.c5944f1vsd8c10bbon identical token IDs): matched all output SHAs (2K:d94f99a2702e,32K:6becd29ac6f1,128K:bd8cd97f415c,256K:85c3b0c0a73c), speeding262,079prefill275.956 s -> 222.261 s(+24.2%).tools/bench_warm_turns.py(--prompt-cache-gib 1): restored4,123 / 4,157continuation tokens with exactfirst/continuationID and output equality.xpu-qwen27,Qwen3.8-27B2,048tokens):1,970 tok/sprefill,32.8 tok/sdecode, exact output tokens.zig build -Dxpu-contract=true xpu-kernel-contract-limits xpu-contract-run -Docloc=ocloc -Dxpu-device=bmg:zig build test-flashnext-xpu-host test-qwen27-prompt-tail-xpu-host test-qwen27-config-xpu-host test-fp64-gdn-xpu-host test-draft-xpu-host test-slide-xpu-host test-xpu-refusal-host:89/89build steps succeeded;12/12tests passed.zig fmt --check,git diff --check,ocloc -device bmg(0spills), andpython3 tools/pr_check.py --base origin/main --pr 3603(0errors,1advisoryUnreleasedCHANGELOG warning;lean 221 vs 221, 0 new).