attention-upgrade
Skill192 starsChanged 12 days agoApache-2.0View on GitHub
Review and adapt MetaX attention backends, MLA, sparse indexers, cache layouts, and kernel wrappers against target vLLM and installed MetaX component contracts. Use for attention work outside vllm_metax/patch/.
- Installs packages
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- common-senseSkill
- csrc-upgradeSkill
- environment-checkSkill
- model-adaptationSkill
- model-upgradeSkill
- patch-upgradeSkill
- registry-upgradeSkill
- vllm-metax-model-trimSkill
- vllm-metax-upgradeSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Read component-contracts.md for each affected component family.
- Distinctive: line 31
Treat every API change in target attention, MLA, indexer, PCP/DCP and DeepGEMM wrappers as upstream-owned.
- Very specific: line 46
Follow allocation/spec/layout selection through bind_kv_cache, insertion, gather, index conversion, kernel reads and output merge.
- Distinctive: line 60
Check LSE layout/base, neutral empty outputs and distributed ownership before merging.
- Very specific: line 70
Treat attention KV cache and indexer cache as separate contracts.
- Distinctive: line 73
Follow allocation, insertion/compression, gather and kernel reads together.
- Very specific: line 86
Update supports_combination, dtype/layout restrictions, supports_out, graph support and constructors with the reachable implementations.
- Very specific: line 91
Keep verified fast paths. Limit a numerical fallback to its failing case, preserve masks/dtypes/outputs, and avoid full-cache copies or …
- Distinctive: line 93
Document the component condition that permits its removal without promising speedups.
- Distinctive: line 97
Read validation.md for affected numerical, metadata-routing, graph-replay and DCP acceptance cases.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
vLLM-MetaX Attention Upgrade
Fully read and apply common-sense before this workflow.
Cover the requested attention backends under vllm_metax/v1/attention/, common MLA
layers, sparse indexer CustomOps, and their shared wrappers. Model-private implementations belong to model-upgrade.
Trace component contracts and dispatch
Read component-contracts.md for each affected component family. Its versioned observations are investigation prompts, not permanent capability rules.
Trace registration/platform selection through metadata builder, layer binding, wrapper,
and the selected Python/native kernel. Include native, flattened, fallback,
prefill/decode, capture and distributed branches relevant to the requested change.
Resolve aliases, decorators, *args/**kwargs and lazy symbols to the actual FA, MLA or
indexer entry point; wrapper transformations can differ from raw component contracts.
| Contract | Establish for each selected entry point |
| Inputs | Positional/keyword arguments, tensor vs tuple, dtype, shape, strides, contiguity, scales, index units and meanings of omitted/None arguments. |
| Outputs | Tensor vs tuple, output and LSE shapes/dtypes, LSE logarithm base, padding, aliasing, in-place writes and empty-row behavior. |
| Supported combinations | Joint restrictions on dtype, QK/V dimensions, sinks, block size, quantization, native MTP, DCP, variable lengths and graph capture. |
Treat every API change in target attention, MLA, indexer, PCP/DCP and DeepGEMM wrappers as upstream-owned. Port the target signature and argument meaning first, including parameters that carry metadata-routing or lifecycle state, then adapt installed MetaX components inside the wrapper and migrate all local callers. Keep compatibility inside the implementation boundary rather than changing the public API; if a target API cannot be supported, record the exact component limitation and reject it explicitly.
Challenge claims such as "FA2 cannot do DiffKV", "all sinks supported", "FP8/FP4 share this API", "cache is contiguous" and "DCP supported" with executable restrictions and discriminating calls. An absent Python signature can be an extension-interface detail; an accepted keyword can still have unimplemented semantics. A fallback remains needed until the selected MetaX entry point implements its replacement.
Review attention semantics end to end
- Follow allocation/spec/layout selection through
bind_kv_cache, insertion, gather, index conversion, kernel reads and output merge. Check layer/page/head/token strides and storage offsets; logical shapes do not establish physical layout. - Preserve actual query counts, per-request boundaries and phase when reordering. Review uniform MTP, variable query lengths, short prefills, zero-length padding and CPU/device boundary differences. Reshape only with proven uniformity; otherwise flatten or bucket with the correct per-token metadata.
- Distinguish request-relative token indices, paged slots, physical flat rows and chunk
workspace offsets. Preserve original indices when consumers need different mappings.
Review valid-count semantics when
-1entries have interior holes. - Dense-MHA-prefill tokens excluded from MQA form a valid subset. Do not run prefill work for absent tokens or return padded heads as real heads.
- For FP8/INT8, verify storage layout, scale placement/type, query scaling and whether weights already incorporate a scale.
- Check LSE layout/base, neutral empty outputs and distributed ownership before merging. Localize DCP causal lengths in the correct order relative to MTP expansion. Derive kernel head counts from gathered queries rather than local TP heads.
- Trace graph metadata lifetime and lazy scheduler state. Captured pointers must refer to runtime-updated buffers; metadata reuse must satisfy the component's conditions.
- Narrow optional attention metadata with direct
is not Nonechecks where required; do not hide incompatible metadata types with suppressions.
Quantized cache and split forwards
Treat attention KV cache and indexer cache as separate contracts. For each supported format compare upstream and MetaX logical/physical dtype, scale representation and placement, block byte layout, padding/alignment, token/head/page strides and index units. Follow allocation, insertion/compression, gather and kernel reads together. Review INT8 cache support explicitly; an upstream FP8 implementation is not a compatible substitute for the MACA path.
Review separate prefill and decode forwards and their dispatch/metadata boundaries, not only a combined forward. Include mixed batches, short prefills, multi-token decode, MTP, per-request offsets and reuse of cache/graph buffers. Preserve the target split and required MetaX semantics without merging/refactoring upstream paths. Apply common's chip policy when selecting numerical cases; unavailable formats remain source-reviewed and explicitly unverified on the current chip.
Align capability declarations and implementations
Update supports_combination, dtype/layout restrictions, supports_out, graph support
and constructors with the reachable implementations. Evaluate combinations rather than
independent flags. Retain a verified implementation, update its mapping, select a
verified fallback or reject an unsupported combination before launching the kernel.
Keep verified fast paths. Limit a numerical fallback to its failing case, preserve masks/dtypes/outputs, and avoid full-cache copies or hot-path host synchronization. Document the component condition that permits its removal without promising speedups.
Attention acceptance cases
Read validation.md for affected numerical, metadata-routing, graph-replay and DCP acceptance cases.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

