[Feature] Add query-chunked TileLang DSA selector - #2068
Open
Denny991 wants to merge 3 commits into
Open
Conversation
Denny991
force-pushed
the
glm52-indexer-query-chunk
branch
from
September 4, 2026 08:40
97e4765 to
9366a49
Compare
Denny991
force-pushed
the
glm52-indexer-query-chunk
branch
from
September 4, 2026 09:00
9366a49 to
c4d7169
Compare
Satisfy formatting checks and make the distributed MoE accuracy test deterministic.
Denny991
force-pushed
the
glm52-indexer-query-chunk
branch
from
September 4, 2026 09:47
b13ba28 to
b2c3c59
Compare
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.
Motivation
The GLM-5.2 DSA Indexer selector originally processed all query tokens in a
single TileLang launch. For long sequences, this creates a large temporary
dense score buffer and increases peak GPU memory usage.
This PR introduces query chunking for the selector. Query tokens are processed
in independent chunks, while the fixed-ID Top-K output semantics remain
unchanged.
Changes
query_chunk_sizesupport to the DSA selector interface.torch.int32Top-K ID tensor.versus chunked Top-K parity.
Usage
The GLM-5.2 recipe uses an 8K query chunk by default.
To select a custom chunk size:
export INDEXER_TOPK_QUERY_CHUNK_SIZE=2048To disable query chunking:
export INDEXER_TOPK_QUERY_CHUNK_SIZE=0Low-level selector APIs still use
Noneas their default, so existing callersare not changed implicitly.
Behavior
(seq_len, 1, topk)andtorch.int32.-1.the selected Top-K IDs.
Memory Impact
The temporary dense selector score buffer changes from
[S, S_k]to[C, S_k], whereCis the query chunk size.For
S = S_k = 16K:These numbers describe the selector workspace only. Total model peak memory
also includes activations, communication buffers, and other temporary tensors.
Validation
2K query chunk.
git diff --checkpassed.Limitations