feat(mla): support custom tree masks in decode#338
Open
mesaleh wants to merge 1 commit into
Open
Conversation
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.
Summary
Adds optional FP8 custom tree-mask support to TokenSpeed MLA decode. The new path lets callers provide a flattened per-request
custom_maskpluscmask_offoffsets so tree-style speculative verification can use the TokenSpeed MLA kernel instead of falling back to dense/causal-only behavior.What changed:
custom_mask/cmask_offkwargs totokenspeed_mla_decode.S_qhandling and non-tile-aligned K.tokenspeed_mlaattention backend.Validation
tokenspeed-mla/test/microbench_tree_decode.pyharness provides a reproducible GB200 check against an independent absorbed-MLA PyTorch reference, including non-tile-aligned K and batched mask-offset cases.python3 -m py_compile tokenspeed-mla/python/tokenspeed_mla/mla_decode.py tokenspeed-mla/python/tokenspeed_mla/mla_decode_fp8.py python/tokenspeed/runtime/layers/attention/backends/tokenspeed_mla.py tokenspeed-mla/test/test_tree_mask_decode.py tokenspeed-mla/test/microbench_tree_decode.pygit diff --checkReview
Reviewed with an external collaborative code reviewer before pushing. Initial findings were fixed:
custom_mask_lento prevent malformed offsets from causing out-of-bounds mask reads.custom_mask/cmask_offthrough the runtime TokenSpeed MLA backend.Second review returned
LGTM.