Skip to content

Kimi k3 - #481

Closed
baoqian426 wants to merge 53 commits into
baidu:v0.25.1-devfrom
baoqian426:kimi-k3
Closed

Kimi k3#481
baoqian426 wants to merge 53 commits into
baidu:v0.25.1-devfrom
baoqian426:kimi-k3

Conversation

@baoqian426

Copy link
Copy Markdown
Contributor

PR Description

kimi-k3 w4a16/w4a8_int8/pd disaggregate/dp/ep/pp/tp/mooncake


Checklist (Required)

Before submitting this PR, please ensure that all the following items are completed:

  • All code changes pass the pre-commit checks.
  • Commits are signed off using git commit -s.
  • The PR title is properly classified (see below).

PR Type

Please prefix the PR title with one or more of the following labels to help reviewers quickly understand the nature of the change:

  • [Feature] – New features or enhancements (e.g. Attention, Communicator, Kernel, Worker, etc.)
  • [Bugfix] – Bug fixes
  • [CI/Build] – CI, build system, or infrastructure improvements
  • [Doc] – Documentation updates or fixes
  • [Misc] – Other changes that do not fit the above categories (use sparingly)

Note: If the PR spans multiple categories, include all relevant prefixes.


Detailed Checklist (Click to Expand)

Thank you for contributing to vLLM Kunlun! To help us maintain high code quality and streamline the review process, please ensure your PR meets the following requirements.

1. Code Quality

  • All linting and formatting checks pass (pre-commit).
  • The code is well-structured and sufficiently documented.
  • The change is designed with maintainability and readability in mind.

2. Testing

  • Relevant unit tests are added or updated.
  • Integration tests are included when applicable.
  • Existing tests continue to pass.

3. DCO Compliance

This project follows the Developer Certificate of Origin (DCO).

  • All commits include a Signed-off-by: line.
  • Use git commit -s to automatically add the sign-off.

4. Review Expectations

During the review process, maintainers may:

  • Request code refactoring or additional tests.
  • Ask for clarifications on design decisions.
  • Suggest performance, stability, or maintainability improvements.

We appreciate your patience and collaboration throughout the review process!

baoqian426 and others added 30 commits July 31, 2026 05:30
…ng on P800

- fused_moe_ct_w4a16: moe_sigmoid_group_topk_norm and moe_pre_sorted only
  support expert_num <= 512 on P800 (the former returns ret=1 and leaves its
  outputs untouched, so the uninitialized topk ids made the pre-sort kernels
  read out of bounds). Add torch fallbacks for >512 experts, verified
  bit-exact against the kernels at expert_num=512.
- compressed_tensors_moe: probe the expert quant scheme with the checkpoint's
  projection names (Kimi-K3 uses w1/w3/w2) as well, otherwise the scheme
  lookup misses and the MoE silently falls back to UnquantizedFusedMoEMethod.
- kunlun_communicator: stop forwarding use_all2all to DeviceCommunicatorBase,
  which derives it itself and rejects the kwarg.

Co-authored-by: Kiro
use xspeedgate_ops.situ_and_mul_kernel
SugerFREEee and others added 23 commits August 13, 2026 13:56
…nto kimi-k3

# Conflicts:
#	vllm_kunlun/ops/kda.py
Replace the temporary torch implementations of causal_conv1d_fn and
causal_conv1d_update with kunlun_ops.causal_conv1d_fwd /
causal_conv1d_update.

Both kernels write in place, so the prefill path hands them a private
contiguous buffer (callers pass strided views into the packed QKV tensor and
still expect their input to survive) and the decode path runs on the caller's
`out` buffer.

K3 stores conv1d weights in fp32 (ColumnParallelLinear(params_dtype=
torch.float32)) against fp16 activations. The 20260818 kunlun_ops build
accepts that combination and accumulates in fp32, which matches an fp64
reference to 5.99e-04 on prefill and 9.21e-08 on decode -- an order of
magnitude tighter than casting the weight down to fp16 first.

Padded cuda-graph lanes carry conv_state_indices == -1; pad_slot_id=-1 makes
the kernel skip them instead of writing a real conv-state row, which is what
the previous clamp-to-slot-0 workaround had to do.

_conv1d_query_start_loc_cpu prefers the CPU mirror the GDN metadata already
keeps over .tolist(), to avoid a device sync on every layer.
@github-actions github-actions Bot added needs review Issue or pull request is ready for maintainer review kunlun-xpu Kunlun XPU runtime, build, or integration code tests Unit, integration, or end-to-end tests labels Sep 10, 2026
@baoqian426 baoqian426 closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kunlun-xpu Kunlun XPU runtime, build, or integration code needs review Issue or pull request is ready for maintainer review tests Unit, integration, or end-to-end tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants