bugfix: prevent incompatible npu graph replays. - #2065
Open
shifengmin wants to merge 1 commit into
Open
Conversation
- Track the per-rank DP token distribution captured by each ACL graph.\n- Fall back to eager execution before preparing or replaying incompatible persistent padding metadata.\n- Cover rounded buckets, decode-no-padding buckets, and empty-rank transitions.\n\nDepends on xLLM-AI#2024 for correct empty-shard raw token accounting.
shifengmin
requested review from
Clement-Wang26,
DongheJin,
DragonFive,
JimHsiung,
Kang-Meng,
RobbieLeung,
XuZhang99,
liujinguang0125,
liutongxuan,
walsonyang,
xiao-yu-chen,
yingxudeng,
yq33victor and
zhang-minchao
as code owners
July 28, 2026 15:42
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.
Description
ACL graph keys are based on the rounded or exact maximum DP token bucket. Two decode steps can therefore select the same graph while carrying different per-rank token distributions.
The persistent DP/EP padding buffers are refreshed before replay, but the graph keeps the tensor descriptors and empty-rank branches recorded during capture. Replaying with another distribution can expose stale tails, truncate new padding metadata, or reuse the wrong q_cu_seq_lens binding.
This change:
dp_global_token_numsvector for each captured ACL graph;decode_no_padding, and empty-to-nonempty rank transitions.The distribution vector is global and identical on all DP ranks, so the fallback decision remains collective-safe.
Dependency
Depends on #2024.
#2024 preserves raw DP token counts for empty shards so fake execution rows are excluded from LM-head/output compaction. This PR fixes graph persistence consistency but intentionally does not duplicate that accounting change. Without #2024, graph and eager execution follow the same metadata after fallback, but both can still count an empty shard's fake row.
Please merge #2024 first, or rebase this PR after #2024 lands.
Related Issues
Change Type
Pull Request Checklist
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Changed-file validation passed:
Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build --device npucompleted successfully on an Ascend development machine.python setup.py build testhas passed on an MLU machine.NPU test results:
acl_graph_executor_test: 24/24 passed.Reviewer Notes
This intentionally falls back to eager execution instead of caching one graph per DP distribution. The latter can create an unbounded graph cache for normal scheduling variance.
Please review together with #2024 for the complete empty-shard data flow.