Skip to content

[II] Encode Kimi precomputed padding as safe zero-weight routes - #416

Closed
voipmonitor wants to merge 1 commit into
dev/infernal-invocationfrom
agent/ii-kimi-precomputed-padding-routes-20260817
Closed

[II] Encode Kimi precomputed padding as safe zero-weight routes#416
voipmonitor wants to merge 1 commit into
dev/infernal-invocationfrom
agent/ii-kimi-precomputed-padding-routes-20260817

Conversation

@voipmonitor

Copy link
Copy Markdown

Kimi-K3 precomputed routing now represents CUDA Graph padding slots with expert ID 0 and route weight 0. This keeps every speculative weight address valid while preserving an exact zero contribution from padding.

The previous representation used expert ID -1. B12X native ModelOpt W4A16 small-M execution indexes route IDs directly, so padded graph inputs could produce cudaErrorIllegalAddress during DSpark graph warmup. Disabling padding skipping on the same checkpoint and launch geometry completed graph capture, isolating the failure to that representation.

Compatibility: the precomputed payload remains zero-copy; only padding rows are mutated. Active route IDs and weights are unchanged. Kernels that already understand negative inactive IDs are unaffected because they receive an equivalent zero-weight route.

Validation:

  • five focused Kimi router tests pass;
  • payload view identity remains unchanged;
  • padding rows contain addressable IDs and exact zero weights;
  • the unmodified B12X W4A16 kernel retains its 22.54 microsecond Kimi TP16 M=1 hot path instead of adding per-route bounds checks.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@voipmonitor

Copy link
Copy Markdown
Author

Superseded by local-inference-lab/b12x#227.

vLLM padding routes use -1 as an inactive-route sentinel. Replacing that sentinel with expert ID zero in vLLM makes the route addressable, but it also converts an inactive slot into executable expert-zero work and duplicates the framework boundary mapping previously removed by local-inference-lab/b12x#214.

B12X #227 extends the existing inactive-route contract to MoEMicroKernelW4A16SmallMDirect, the native path that lacked the contract. Each CTA stages the bounded route table once, preserves valid IDs and weights, and represents invalid IDs with an addressable placeholder plus an exact-zero effective weight. The inner FC1 and FC2 path remains unchecked, caller tensors are not mutated, and CUDA Graph replay is covered.

Focused validation includes the native E8M0 W4A16 corpus, ModelOpt E4M3 direct execution, invalid negative and positive IDs, fully inactive rows, and CUDA Graph replay. At the Kimi-K3 TP16 decode shape, the M=1 median is unchanged within measurement noise: 22.5367 us on B12X master and 22.5365 us with B12X #227.

The vLLM change is therefore not required once B12X #227 is merged.

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