mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
On the Arc Pro B70 a decode step spends 16.5 ms of 45 in the attention-residual mix / loop-controller phase (10.6 ms) and the router phase (5.9 ms): kernels that run as one work-group (or a handful) per token, so one Xe core of 32 does the work and the step waits on its latency. Every change below keeps the arithmetic of each value, so the logits do not move (checked bit for bit). - k_ctrl_apply_norm_sg16: the gated mix runs one thread per channel over D/64 work-groups (the same 64-term dots in the same order); the RMS norm is a second kernel, one group per token, adding the squares in the order the single kernel did, then wg_sum16. - k_attn_res_mix_sg16: one work-group per (token, query) instead of one per token (the queries are independent; each repeats the cheap block norms), and the block norms and the block dot products are reduced in one batch each (wg_sum16_multi: the same reduce / local sum / reduce per value, two barriers for all of them instead of two per value). - k_router_topk8_sg16: the eight rounds of "best remaining expert, lowest index among equals" run on the 128 threads of the group with exact max / min reductions, instead of one thread scanning 8 x 128 entries. - k_linear_f32_sg16: with up to 1,024 rows (the loop controllers' 64-row projections, the router's 128 rows, the conv taps) each row is one sub-group in its own work-group, so the rows spread over the whole GPU instead of N/16 groups; the arithmetic of a row is unchanged. - The FP4 decode by integer ops is dropped: on the B70 it was 1.5-2.5% slower than the table. - CI: the speed job also checks identical answers (logits of 64 ids and 48 greedy tokens, base against branch, two runs each). Arc A750 (p1006, UD-IQ1_S, no XMX): base and branch give the same logits hash (2780509b400ba29d) and the same greedy hash in 4 runs.