Skip to content

Port Kimi column-tail and auxiliary dataflow to main - #3638

Open
whx-sjtu wants to merge 12 commits into
mainfrom
task-698-main-tail-dataflow
Open

whx-sjtu wants to merge 12 commits into
mainfrom
task-698-main-tail-dataflow

Conversation

@whx-sjtu

@whx-sjtu whx-sjtu commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes https://github.com/wuhuikx/LLM-Booster/issues/698. Ready for human review. All peer/GPU/model/fullgraph/timing, Category A and final-integration holds remain.

Category B carries rank-local columns into the next attention-residual kernel, overlaps bank-only mixing with the exchange, and captures standard DSpark taps from the complete, unnormalized sum. Ordinary readers materialize columns explicitly; unsupported paths retain immediate results.

Depends on Category A, #3637, inherited at cb6f1af. The B-only range ends at ff9e892. After A lands, main will be append-merged so the final diff contains B only.

Dev record

  • Found: peer setup could run before the producer decision was settled.
  • Decided: bind after weight/layout/front hooks through the same step-independent predicate used at runtime. First-step tokens and prefill status do not control allocation.
  • Surprised: none.
  • Left undone: GPU qualification, complete-operation timing, model accuracy, human review and final landing-tree checks.

Named result

  • 697: public AITER API reuse and exhaustive token/rank test coverage implemented.
  • 698: native column dispatch and rank views implemented.
  • 699: typed exchange and explicit lifecycle implemented.
  • 700: bank-aware polling implemented, including two/three-bank-row placement.
  • 701: standard taps moved; custom/GQA, input, PP and last-local paths preserved.

Gates

Current ff9 allocation review is source/CPU clear, complementing the prior five-section B review. Linux CI 44745088544 passes 15,263 tests, with 1,727 skipped and 3 xfailed; all five new controls ran. CI tested the ff9+main merge tree, detailed below. GPU/model/fullgraph/replay, peer lifetime, timing, parent and final-tree gates remain open.

Evidence, review sections and scope

Current CI provenance: non-GPU unit job 136318219570 tested merge 45a0d54, combining ff9e892 with main cbf1617. It reports 15,263 passed, 1,727 skipped, 3 xfailed, 9 warnings in 630.65 seconds; Black/Ruff/catalog passed. This is merge-tree CI, not an isolated ff9 full-suite run. JUnit confirms all five allocation controls executed. Native Accuracy 136318415116 skipped.

The independent allocation review completed all seven gates and a non-author pass. It verified five repaired controls and four failures with the original e83 method restored. The prior e83 source/CPU sections retain their exact scope; inherited A is excluded. Neither review grants whole-category, hardware or landing approval. Eligibility relies on the intended uniform loaded-model schema; live peer agreement, allocation failure/lifetime and GPU/model/fullgraph/replay/performance remain unqualified.

Immutable transport/aux review: 8b80095 to e66acec. Polling delta: e66 to 9dd2431. Test-only exhaustive tail grid: 9dd to 3eed4e2. Simulated-TP repair: 3eed4e2 to current head. The independent review completed all five sections at e83 using these immutable ranges and a fresh blind pass; inherited A was excluded.

Head e83 passed maintained non-GPU unit job 136262016491 in run 44728494932: 15,258 passed, 1,727 skipped, 3 xfailed, 9 warnings in 795.67 seconds. Black, Ruff and catalog jobs also passed. Native wrapper run 44728494896 succeeded with actual Accuracy job 136262045631 skipped. The scoped review is COMMENTED/LGTM for source/CPU; it is not GPU, whole-category or landing approval.

Final-main integration must reconcile #3577 after its repair is frozen: the planned active-bank count through AttnRes/apply variants, written-prefix PP transfer/reconstruction, and mono bank/aux ownership changes. The frozen #3577 integration surface is active-bank counts, written-prefix PP transfer/reconstruction and mono bank/aux ownership; current review does not approve that future combination. Category C must inherit the ff9 setup fix before its final integration review. Category A must also land, followed by the required main merge and exact-tree checks.

Windows transport controls cover typed-producer AOT without input-storage clones, ordinary-reader materialization, fused-consumer dispatch, target-to-drafter tap mapping/rounding, and normal/failure/idempotent teardown. The broader 106/72 result predates GPU test-definition additions and is preserved working-tree evidence. The 26/11 focused result follows the closure fixes. This environment does not qualify Linux or GPU behavior.

The polling order adapts the existing consumer algorithm from historical #3357 and #3359. No historical timing is reused. Changing the loop structure can change compiler contraction; gathered/full byte parity, plain-output deltas against e66, and model accuracy remain GPU gates.

The allocation repair addresses inline4642521802. Actual Kimi/Linear/RMSNorm/front-merger objects with meta storage exercise the real loader traversal; checkpoint I/O, GPU compute and peer allocation are substituted. Unsupported front, norm fusion, output destination and up-weight dtype allocate nothing. Supported setup binds after the front merge without a forward context and remains eligible for decode after prefill. Repeated setup does not allocate again. Five focused controls pass; the affected front/B suites 75 passed, 179 skipped.

Review 5992773882 also requests GPU exchange/poll, front-GEMM accuracy/perplexity, ColumnTail graph replay and overlap timing. Front GEMM belongs to A/#3637; its existing one-GPU inline-FusedMoE-view witness does not satisfy front-GEMM or full-model perplexity. Use a matched combined A+B model evaluation when it covers both, without duplicate full runs. B has no architecture-name gate; gfx950 qualification is planned, while MI300/gfx942 execution/timing remains unverified and unpromised.

GPU definitions cover all T=1..64 and eight rank shares with two seeds and padded/contiguous rows; the exact double-rounding boundary; bank counts 1..12 at T=1/4/7/16/32/64 in BF16/FP8; an independent exact mean oracle; and opt-in eight-rank replay stress. The added allocation controls are CPU checks; expanded GPU definitions remain unrun. No GPU test ran. The one-GPU peer test emulates publishers and does not replace real peer concurrency or quiescence evidence.

Extra files: atom/model_engine/model_runner.py invokes the optional resource hook before destroy_dist_env, and only Kimi implements it. atom/model_ops/attention_residual.py materializes typed columns before ordinary fallback additions. Source and CPU call-order checks do not establish live multi-rank/stream/graph lifetime safety.

The reused AITER API is aiter.ops.triton.gemm.fused.fused_gemm_a16w16_mul_add.fused_gemm_a16w16_mul_add, inspected at 73960daf4e1e8ff99da6bdcef042840150c86c5b, introduced by AITER #6674 as 9837f06b983e6d008697d8959313711a56d5d18d. ATOM retains its model-sensitive norm wrapper. No standalone tail primitive was copied.

The simulated-TP controls invoke the actual _patch_group with logical TP8 and physical TP4. Before repair, eligibility stayed enabled and the binder requested eight peers; both tests failed. After repair, the existing simulated collective path is retained, and real-TP positive controls remain green. This was a CPU source finding, not a GPU failure.

Current B-only scope: 767 non-test changed lines and 1039 test lines, within the approved grouped estimates. The earlier replicated-tail mutation failed all eight rank-view controls and was restored.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every eligible PR before approval:

  • ✅ Pre Checkin: Black, Ruff, catalog schema validation, non-GPU unit tests

Heavy model tests:

  • ✅ Gate checks are published on every PR so required checks do not stay missing
  • ✅ Expensive jobs run only after the PR is approved, or when a matching ci:* label is present
  • ✅ Pre Checkin must pass before approved heavy jobs continue
  • ✅ Without a matching label, expensive jobs also require a relevant path
  • ✅ A matching ci:* label is an explicit request and can open the gate even when paths would otherwise skip it

Path scope:

  • Native ATOM, vLLM, and SGLang use ignore lists: docs/markdown and unrelated plugin or Mesh paths are skipped
  • ATOMesh uses an include list: Mesh code, ATOMesh scripts/workflows/catalogs, OpenAI entrypoints, and Slurm helpers
  • Relevant path alone does not start expensive jobs; approval still opens the automatic path-scoped gate
Label Tests
ci:full Run all heavy PR model tests: native ATOM, vLLM, SGLang, and ATOMesh
ci:atom Run native ATOM model accuracy tests
ci:vllm Run ATOM vLLM OOT model accuracy tests
ci:sglang Run ATOM SGLang model accuracy tests
ci:mesh Run ATOMesh accuracy/benchmark gates for Mesh-related changes

Without a matching ci:* label, heavy jobs are skipped when the path is not relevant or the PR is not approved.
Add labels via the sidebar or gh pr edit 3638 --add-label <label>

@whx-sjtu whx-sjtu added the agent-team/hold-landing Holds landing only; development and review go on label Nov 20, 2026

@whx-sjtu whx-sjtu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ATOM PR #3638 — Category B source/CPU sections

Projects rank-local tails, carries typed columns into residual and standard DSpark consumers, overlaps independent bank work, and preserves simulated-TP fallback.

Review: ✅ LGTM for the five source/CPU sections at e83be33; no whole-category, GPU or landing approval. Dependency and qualification holds remain.
Coverage: 2 files / 136 added lines -- within one review pass
Coverage: 6 files / 422 added lines -- within one review pass
Coverage: 1 files / 149 added lines -- within one review pass
Coverage: 0 files / 0 added lines -- within one review pass
Coverage: 1 files / 10 added lines -- within one review pass
Validation (advisory): reviewer Windows CPU at e83: 47 passed, 179 skipped; one run, this box, unverified. Two simulated-TP regressions fail with pre-fix methods restored, then 26 fallback/capability/rank controls pass. GPU numerical/fullgraph/replay, peer lifetime, model accuracy and complete-operation timing remain unrun.

Section scope and evidence

Coverage lines follow these immutable ranges, in order: immediate tail cb6f1af..8b80095; transport/aux 8b80095..e66acec; polling e66acec..9dd2431; test grid 9dd2431..3eed4e2; simulated-TP repair 3eed4e2..e83be33. Inherited Category A is excluded.

The e66 transport snapshot stays frozen; its simulated logical8/physical4 admission defect is resolved by the e83 repair. Both _column_tail_eligible and _init_column_gather refuse the actual simulated-group marker. Restoring the original methods makes test_tail_keeps_safe_fallbacks[simulated_tp] and test_exchange_binds_only_safe_local_consumers[simulated_tp] fail their eligibility and no-allocation assertions.

Connected checks covered public AITER stride/FP32-epilogue contracts, real/fake tensor output shape, ordinary-reader materialization, last-local-layer output, standard versus custom/input/PP auxiliary taps, mono auxiliary writes, and cleanup order. The CPU AOT and lifecycle controls do not establish live multi-rank/stream/graph safety. The polling source preserves candidate order, but compiler contraction and parity with e66 still need GPU evidence. Expanded GPU definitions are not execution evidence. Historical CI results are not transferred to this head.

@whx-sjtu
whx-sjtu marked this pull request as ready for review November 20, 2026 12:05

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

some changes needed..

gpu run of the peer-column exchange and the triton poll kernel? accuracy/perplexity for the front-merged gemm? fullgraph/cuda-graph replay for ColumnTail? timing for the overlap on mi300/mi350?

ci green.

Comment thread atom/models/kimi_k3/model.py Resolved
@whx-sjtu
whx-sjtu marked this pull request as draft November 20, 2026 13:07

@whx-sjtu whx-sjtu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ATOM PR #3638 — Allocate column peers after producer setup

Allocates column-peer storage only after the loaded producer's shared capability check succeeds, without letting an initial prefill disable later decode.

Review: ✅ LGTM for the allocation delta e83be3372c7235f40a055631530665128e7d23bc → ff9e8922fd3188892d7a8347a4e6805db08b07df. No source/CPU blocker found; prior e83 sections retain their own scope. No whole-category, hardware or landing approval.
Coverage: 1 files / 48 added lines -- within one review pass
Validation (advisory): Independent Windows controls pass all five allocation cases; the actual original e83 method restored in memory fails all four unsupported-producer checks. The controls use real model/linear/norm/front/loader methods with meta storage and substituted I/O, GPU compute and peer allocation. Maintained Linux CPU CI passed 15,263 tests, skipped 1,727 and xfailed 3; JUnit confirms all five controls executed, and Black/Ruff/catalog passed. CI tested merge 45a0d54959d8d0c7000ad9e560aba6eb8397bdd7 of ff9 with main cbf161746, not an isolated-head full-suite run. Eligibility uses uniform loaded-model metadata; real peer agreement, allocation failure/lifetime, GPU/model/fullgraph/replay and performance remain unqualified. Category A landing and future #3577/Category C integration, formal review and final-tree gates remain open under hold landing.

@whx-sjtu
whx-sjtu marked this pull request as ready for review November 20, 2026 14:35
@valar-cop

valar-cop commented Nov 20, 2026 •

Copy link
Copy Markdown

@whx-sjtu

whx-sjtu commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Part of the GPU qualification question: peer/poll/replay and numerical/fullgraph checks pass; native FULL model accuracy covers the merged front. Isolated overlap benefit, perplexity and MI300 timing remain unmeasured.

Results and scope

ff9e8922, exercised within 9b9c8706, with AITER b9e08daca8c45dd758f4fa1fbb7d0da027f399c9 on gfx950:

  • Eight-rank peer stress passes 15 token/bank pairs and 50 graph replays per pair, including real publish/poll kernels and normal collective close.
  • Ten original column-tail nodes pass with zero skips: T=1–64, all eight rank slices, original ≤1 ULP bound, add-before-rounding controls, changed-input replay and fullgraph normalization. Relevant producer/test code matches this PR.
  • A4W4, TP8/DCP8, DSpark7, native FULL: all eight ranks execute 91 deferred peer/residual chains per step at 16/32 rows. Full three-shot GSM8K is 1280/1319 flexible and 1281/1319 strict. Same-recipe repeat whitespace differences remain; model shutdown was forced, so normal model peer close is not proved.
  • On MI350/gfx950, summed complete norm/column-tail-through-peer/residual GPU spans are 2.228548/2.535528 ms at 16/32 rows: maximum rank per step, then median of ten steps. These are absolute costs without a matched overlap baseline.

whx-sjtu pushed a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
The token-graph hunks of ROCm#3636's integration commit 80ae966
("Integrate Kimi prefill graphs and explicit residual storage contracts"),
verbatim:

- `_KimiMLAGDNCommon.supports_token_graph` also accepts a target MLA layer
  that is sparse and carries a bound unscaled BF16 query layout
  (`TokenGraphQueryLayout`), so Kimi-K3.1 at DP1/PCP1 records its prefill
  buckets. Quantized or unknown query layouts keep eager execution.
- The layout check moves from `_attention` into `_attention_region`, so a
  plain eager call never enters the token-graph helper.
- docs: ATOM_TOKEN_GRAPH_SIZES names the K3.1 regions.
- tests: the gate's accept/refuse cases and the plain-call bypass.

Left out, because this head has none of the code they integrate with:
the row tail's in-graph guard and the KDA in_proj split on buckets
(ROCm#3587), ColumnTail materialization at tensor-only boundaries
(ROCm#3637/ROCm#3638), and the native eager residual's absent addends (the ROCm#3317
part, which exists only on a row-sharded step). Whoever merges those
stacks with this one needs those hunks of 80ae966 too.

Co-authored-by: Cursor <cursoragent@cursor.com>
whx-sjtu added a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
(cherry picked from commit c24b52a)
Conflict in atom/models/kimi_k3/model.py (this commit was written against
main without ROCm#3637) resolved as in upstream merge 931b22b ("Merge Category A
interfaces for local tail integration") of ROCm#3638.

Ported from ROCm#3638.

Co-authored-by: Cursor <cursoragent@cursor.com>
whx-sjtu added a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
whx-sjtu added a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
whx-sjtu added a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
whx-sjtu added a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
whx-sjtu added a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
whx-sjtu added a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
(cherry picked from commit ff9e892)
Ported from ROCm#3638.
whx-sjtu pushed a commit to whx-sjtu/ATOM that referenced this pull request Nov 23, 2026
…ROCm#3637 ROCm#3638) k31-opt2/PT4@2c68a46f

Conflicts resolved as ROCm#3636 does for PT3 (ROCm#3577/ROCm#3582/ROCm#3587) + PT4:
- kimi_k3/attention_residual.py: PT4's kernel with PT3's num_blocks bound;
  PT3's int64 bank offsets (71a6aba) moved into PT4's _mix_tile and kernel.
- model.py: column tail first (decode, 1-64 tokens), then PT3's dispatch op;
  row tail (>= ATOM_KIMI_K3_MOE_ROW_SHARD_MIN_TOKENS) before PT4's one-AR
  split; aggregate materializes column pendings; per-phase token_graph.
@valarLip valarLip removed the ci:atom label Nov 25, 2026

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

agent-team/hold-landing Holds landing only; development and review go on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants