Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24634
Note: Links to docs will display an error until the docs builds have been completed. ❌ 136 New Failures, 5 Unrelated Failures, 6 Unclassified FailuresAs of commit 57123b7 with merge base c7f7931 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
| _cache_id, | ||
| offgraph_attention_forward as mlx_offgraph_attention_forward, |
There was a problem hiding this comment.
_cache_id and mlx_offgraph_attention_forward aren't used here, register_offgraph_attention uses both inside the shared module, probably we don't need to import these
There was a problem hiding this comment.
Good point, removed both imports (and the now-unneeded # noqa: F401). Nothing else imported them through the MLX module.
The HF attention function that routes attention through kvcache::update_and_attend is backend-neutral: it only emits the cache op. Move it from backends/mlx/llm into extension/llm/cache so other backends can export with an off-graph KV cache. register_mlx_offgraph_attention and the other names MLX exporters import are unchanged.
9cc9b4d to
57123b7
Compare
Stack
Off-graph KV cache for the native ggml engine, through serving Muse Glimmer on it. Review bottom-up; each PR builds and passes its tests on its own.
Summary
Moves the HuggingFace attention function that routes attention through
torch.ops.kvcache.update_and_attendfrombackends/mlx/llm/hf_attention.pytoextension/llm/cache/hf_attention.py, so backends other than MLX can export with an off-graph KV cache.Nothing in it was MLX-specific: it only emits the cache op, works out the YOCO donor cache id, and replaces HF's mask with a pass-through. The new module exposes
offgraph_attention_forward,sdpa_mask_passthrough, andregister_offgraph_attention(name). The MLX module keeps the names its exporters import (register_mlx_offgraph_attention,OffGraphExportWrapper, ...), so MLX callers are unchanged.Also adds a
hf_attentionBUCK target inextension/llm/cache.Test plan
export_llm_hf.py,dflash/export.py) and checked thatregister_mlx_offgraph_attention()registers the shared function.