Skip to content

[None][perf] Remove IndexK duplication with TEP for MinimaxM3 - #19681

Draft
brb-nv wants to merge 2 commits into
NVIDIA:feat/m3_with_msafrom
brb-nv:user/brb/remove-indexk-offload-duplication
Draft

brb-nv wants to merge 2 commits into
NVIDIA:feat/m3_with_msafrom
brb-nv:user/brb/remove-indexk-offload-duplication

Conversation

@brb-nv

@brb-nv brb-nv commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

MiniMax-M3's index-K is computed from a replicated projection, so every TP rank
holds identical bytes. The Mooncake store connector keyed every page by
attention shard (w<count>r<rank>), so a TP=8 deployment wrote and stored eight
copies of the same index-K.

This introduces the notion of a replicated role and threads it through the
connector stack:

  • KVCacheManagerV2.get_replicated_roles() names the roles whose bytes do not
    depend on the shard. It is derived from the existing
    get_disagg_role_mapper_kinds() declaration, so replication is declared once
    and the native disagg path and the connector path cannot disagree.
  • KvCacheLayout describes those bytes as a separate replicated_regions set
    per layer group. V2 may interleave the two classes inside one pool, so each
    class is aggregated separately rather than sliced out of a merged range.
  • The connector keys the replicated page under a literal replicated in place
    of the rank component. One rank writes it and every rank reads it, since each
    still needs the bytes in its own GPU memory. A prefix hit requires it
    alongside every shard's page, so a block whose shared copy was evicted reads
    as a miss rather than loading half-initialized.

For MiniMax-M3 at TP=8, where K, V and index-K are each 256 B/token, this
removes about 29% of the store footprint and of the bytes written.
Models that declare no replicated role are unaffected: replicated_regions is
empty and every buffer stays in regions.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@brb-nv
brb-nv force-pushed the user/brb/remove-indexk-offload-duplication branch 2 times, most recently from 07c71d9 to a88a792 Compare September 29, 2026 05:41
@brb-nv
brb-nv marked this pull request as ready for review September 29, 2026 05:49
@brb-nv
brb-nv requested review from a team as code owners September 29, 2026 05:49
@brb-nv
brb-nv requested a review from peihu-nv September 29, 2026 05:50
@brb-nv

brb-nv commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #75627 [ run ] triggered by Bot. Commit: a88a792 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #75627 [ run ] completed with state SUCCESS. Commit: a88a792
/LLM/main/L0_MergeRequest_PR pipeline #62343 completed with status: 'SUCCESS'

CI Report

Link to invocation


The shard component has two forms. A page whose bytes depend on the shard is
named per rank, while one whose bytes are identical on every rank is named
`REPLICATED_SHARD_KEY` instead, giving a TP group a single shared key.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if TP is 8, (K head is 4), the change does not generalizes to that duplication because it is all ranks or one?

keys, and the existence filter in `_put` collapses the overlap. Gating
them on rank would drop the pages of every owner but one.
"""
return self._attention_rank == 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no easy way to spread the writes with TP?

@brb-nv
brb-nv force-pushed the user/brb/remove-indexk-offload-duplication branch from a88a792 to 1bf4152 Compare October 5, 2026 01:40
@brb-nv

brb-nv commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #76208 [ run ] triggered by Bot. Commit: 1bf4152 Link to invocation

@brb-nv
brb-nv force-pushed the user/brb/remove-indexk-offload-duplication branch from 1bf4152 to ace7552 Compare October 5, 2026 02:36
@brb-nv

brb-nv commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #76209 [ run ] triggered by Bot. Commit: ace7552 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #76208 [ run ] completed with state ABORTED. Commit: 1bf4152

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #76209 [ run ] completed with state SUCCESS. Commit: ace7552
/LLM/main/L0_MergeRequest_PR pipeline #62833 completed with status: 'SUCCESS'

CI Report

Link to invocation

@brb-nv
brb-nv marked this pull request as draft October 5, 2026 17:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants