Repository navigation
fix: time the device's attention tile in attention-sweep - #23
Merged
paperniuk merged 1 commit intoOct 22, 2026
Merged
Conversation
Owner
|
Thanks, good catch! Confirmed on M1 Max: the sweep now times the |
paperniuk
pushed a commit
that referenced
this pull request
Oct 22, 2026
attention-sweep built its graph with PagedAttention::prefillPlan and verifyPlan without the tile argument, so on Apple7/8 it timed the MPP kernels instead of the register tile the engine runs. Build the case graph from ops::ExecutionPlans, as the runtime does. Ported from 173a457 (#23) on apple7-m1-1.4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
attention-sweepbuilds its graph withPagedAttention::prefillPlan/verifyPlancalled without the tile argument, so it always takes the defaultAttentionTile::Mpp. On Apple7/8 the engine runs the register tile (ExecutionPlanspicksAttentionTile::Register, the*_sgfpipelines), so on M1/M2 the sweep was timing the stock MPP kernels, not the ones that serve. Found it while looking at long-context verify on M1 Pro: decode-profile showsverify_attention_q8_split_sgf, the sweep printedverify_attention_q8_split.The fix builds the case graph from
ops::ExecutionPlans(backend.capabilities()), same as the runtime does, one per backend (so--compare-metallibalso uses it). Apple9+ unchanged, its plans giveMppas before.apple7-m1-1.3.2has the same bug.M1 Pro (16-core GPU), qwen3.8-27b shape, Page32 int8 KV, verify, 1 lane, median of 15 fused graphs:
verify_attention_q8_split)verify_attention_q8_split_sgf)Prefill phase picks
prefill_attention_q8_split_sgf/_kv2_g8now too.dev/tests/attention_sweep_cli.shpasses, build clean with-Werror. Output digests change on Apple7/8, as expected (other kernel, other summation order).Why I care: at agent contexts verify attention becomes a real part of the M1 decode cycle (decode-profile, 27B, B1: 3% of the cycle at 2K, 22% at 24K, ~50 ms of 226 ms), so I want to try some things in the register tile and need the sweep to A/B it.