Skip to content

perf(custom-ar): add graph-safe Kimi-K3 dual-input all-reduce - #4

Closed
JohnQinAMD wants to merge 1 commit into
mainfrom
perf/kimi-k3-dual-input-allreduce
Closed

JohnQinAMD wants to merge 1 commit into
mainfrom
perf/kimi-k3-dual-input-allreduce

Conversation

@JohnQinAMD

@JohnQinAMD JohnQinAMD commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

Add a one-stage custom-all-reduce path that reduces two contiguous tensors
without first materializing their concatenation. The first input is copied
into AITER's existing registered staging allocation; the second input is
registered once for graph replay. A single kernel reduces the logical
concatenation and writes two independent output tensors.

The public contract passes the staging pointer and capacity explicitly. The
C++ object does not retain implicit "last registered input" state.

Scope and fallback

The fast path requires:

  • a fully connected 2-, 4-, 6-, or 8-GPU group;
  • FP32, FP16, or BF16 contiguous inputs on the same device;
  • non-empty inputs whose individual byte sizes are multiples of 16;
  • a total size inside the configured custom-AR range;
  • less than 160 KiB for TP2/TP4 or less than 80 KiB for TP6/TP8; and
  • CUDA/HIP graph capture.

Unsupported inputs return None from the high-level capability path so the
framework can use its existing collective fallback. Output tensors must be
contiguous, match the corresponding input size and dtype, and must not alias
either input or one another.

gfx1250 explicitly leaves this optional operation unavailable. Existing
single-input all-reduce, all-gather, reduce-scatter, and fused operations are
unchanged.

Performance

MI355X/gfx950, TP8, BF16, routed [1, 3584] plus shared [1, 7168], CUDA
graph, rotating measurement order:

Complete boundary p50
concatenate + production custom all-reduce 18.0336 us
dual-input custom all-reduce 13.5974 us

This is a 1.3263x boundary speedup and projects 0.4081 ms/token across 92
Kimi-K3 MoE layers.

The isolated endpoint checkpoint moved from 47.6439 to 48.0416 decode tok/s,
or +0.835% and 0.1737 ms/token. It did not clear the campaign's independently
declared 48.3 tok/s major-uplift floor, so this PR does not attribute the
subsequent stacked KDA gain to the collective.

Those performance results were collected before the final API-only hardening
that made the staging pointer explicit. The device kernel is unchanged, and
the cleaned branch passed the exact TP8 correctness harness, but its endpoint
performance rebaseline is still pending.

Correctness and validation

  • revised binding compiled for gfx950 and exposes the explicit seven-argument
    staging contract;
  • focused contract suite: 8 passed;
  • exact vLLM TP8 harness: eager fallback, AITER graph dispatch, first replay,
    changed-input replay, input immutability, independent outputs, and all eight
    ranks passed;
  • graph registration count: one external address per rank for the dual call;
  • candidate matches the production concatenate/custom-AR result bit-for-bit
    and remains inside the declared BF16 envelope versus RCCL;
  • Ruff check, Ruff format check, Python AST parsing, and git diff --check
    passed.

Branch

  • base: ROCm/aiter main 4a1cc773f3
  • branch: perf/kimi-k3-dual-input-allreduce
  • commit: 861bc77230ac989e4c74d4aa8acf3a32d5cccbc0

Companion integration

The endpoint integration requires the companion vLLM change that exposes a
typed two-tensor collective with concatenate/all-reduce fallback and uses it
from the AMD Kimi-K3 latent-MoE tail. The AITER PR itself contains no
model-specific dispatch.

Disclosure

AI assistance was used for implementation and review. All GPU tests and
measurements reported above were run on the stated MI355X system.

@github-actions

Copy link
Copy Markdown

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4 --add-label <label>

@JohnQinAMD

Copy link
Copy Markdown
Owner Author

Superseded by DCO-clean, patch-equivalent replacement #26. The replacement adds the required Signed-off-by trailers without force-pushing this reviewed branch; performance, correctness, and accuracy evidence is preserved.

@JohnQinAMD JohnQinAMD closed this Jul 31, 2026
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.

1 participant