Dynamic block-sparse attention skips most of the attention work of a long prompt. On accelerators whose multicast is statically routed and flow-controlled, such as wafer-scale engines, the pruning gains far less than the skipped work suggests: with the conventional placement, sparse attention that skips most of the blocks still takes most of the dense attention time. The cause is multicast backpressure: a route advances only when every destination has a free buffer, so processing elements (PEs) that receive the same key-value stream stall each other when their work falls at different points of it. We present SparseWafer, which reduces this stall by placing query rows. The rows that share one selection decision select the same key blocks, so spreading them cyclically over the PEs of a stream gives every PE the same work on every block, and we prove that such PEs run as fast as one PE alone, for any buffer depth. A per-head start offset, which starts each query head at a different set of PEs, extends this balance across the multicast routes that share one key-value stream; it depends only on tensor shapes and is fixed before run time. We evaluate SparseWafer on the Cerebras SDK's WSE-3 simulator and a model calibrated on it, with selection and data movement included. With the masks of a published selection method (XAttention), SparseWafer is 1.31-1.49x faster than sparse prefill with the conventional placement at each model's longest context. With these masks, sparse prefill loses at most 1.8 points of accuracy on the RULER long-context benchmark, and on the denser masks of RULER prompts SparseWafer is still 1.28-1.54x faster than dense prefill at 128K. It is also faster than mask-aware load balancers and within 5-10% in attention time of an idealized, zero-cost one: on such networks, the shape of the computation decides almost all of where each row belongs.
翻译:暂无翻译