Repository navigation
Conversation
…e pool's state dtype - Load flydsl_kda_decode_with_f_b from aiter.ops.flydsl.linear_attention_kernels when the FlyDSL source is aiter. - Fail closed with a one-time warning when AITER lacks that kernel or the FlyDSL import fails. - Take the recurrent-state dtypes the bound kernel advertises; the vendored kernel stays FP32-only. - available() and warmup() take the mamba pool's state dtype; a kernel that cannot take it is not armed and warns once. - Arm the gfx950 kernel only for an FP32 pool, so a BF16 pool no longer arms it. - Mirror AITER's cache-slot and stride checks in covered(), so an unsupported layout falls back instead of raising. - Warm only the pool's state dtype before graph capture and log the armed kernel and dtype. - Test the bindings, BF16 state, SGLang's cache pool layouts, warmup, arming, and vendored-vs-AITER agreement. - End test_kimi_k3_kda_decode.py with the __main__ block test/README.md prescribes. - Document the state-dtype arming rule, the backend default, and the aiter source in the Kimi-K3 cookbook.
- The fused KDA decode takes a dense BF16 f_b with no weight scale; Quark stores f_b as per-channel FP8. - Dequantize it once to a BF16 copy for the fused kernel only; the FP8 layer keeps serving the unfused path. - The helper lives in the ROCm-only kimi_k3_rocm_quant.py and runs only once a fused backend is available. - ShardedStateLoader and RemoteModelLoader transpose the FP8 weight before post_load_weights. - Skip the dequant for such a weight and warn once; the layer keeps the unfused path instead of failing the load. - Add CPU tests for the dequant, the BF16 pass-through, and the post-processed weight. - Note the BF16 dequant in the Kimi-K3 cookbook. - Define SGLANG_USE_HIP_K3_KDA_FUSED_BACKEND and SGLANG_USE_HIP_K3_FLYDSL_SOURCE in Envs. - Keep SGLANG_ROCM_K3_KDA_FUSED_BACKEND and SGLANG_K3_FLYDSL_SOURCE as deprecated aliases. - Read both through envs in the two fused-decode adapters, the FlyDSL source loader and kimi_k3.py. - Switch the tests to envs overrides and cover the two aliases. - Document both in the AMD & ROCm table; the cookbook keeps the old names for its pinned image.
# Conflicts: # python/sglang/kernels/ops/attention/kda_fused_decode_gfx950.py
…fused KDA decode checks - Materialize the deferred f_b whenever it is deferred; the ReplaySSM ring path skipped it and got the raw f_a. - Split the gfx950 arch check from available(), so covered() no longer logs a "not armed" warning per step. - Restore the unset-default case in test_fused_kda_backend_is_opt_in. - Clarify in the env-var docs that a BF16 state needs SGLANG_USE_HIP_K3_FLYDSL_SOURCE=aiter. - Say in the cookbook which init failures log the one-time warning.
…fused decode arming - SGLANG_USE_HIP_K3_FLYDSL_SOURCE=auto still prefers the vendored kernel, but binds AITER's when only it takes the state - Cache the kernel binding per (source, state dtype); covered() and run() no longer re-import or probe the device - Warn separately when AITER lacks flydsl_kda_decode_with_f_b and when the op lacks the state_dtypes tag - Reset the HIP fused decode arming before re-arming, so a re-run that fails cannot keep a stale f_b in use - Take the merged BF16 f_b (block-FP8 and BF16 checkpoints) first; warn once when no BF16 f_b can be produced - Make the decode adapters' available() keyword-only and fix the gfx950 docstring that described an unused device - Re-wrap the new environ.py comments at clause boundaries and restore the decode test's -v main call - Tests: auto binds AITER for a BF16 pool, both AITER failure messages, failed re-arm, merged block-FP8 f_b - Tests: set the deprecated env names through temp_set_env(allow_sglang=True), as they have no descriptor - Docs: describe the dtype-aware auto source and the BF16 f_b requirement in the cookbook and env var reference
yuychang
requested review from
BBuf,
DarkSharpness,
Edwardf0t1,
Fridge003,
HaiShaw,
Ying1123,
celve,
ch-wan,
hanming-lu,
hebiao064,
ispobock,
merrymercy,
yizhang2077 and
yuan-luo
as code owners
November 5, 2026 19:36
yuychang
requested review from
HydraQYH,
JustinTong0323,
sogalin,
wisclmy0611 and
zijiexia
as code owners
November 5, 2026 19:36
- Document that host-only request-indexed ReplaySSM rings do not arm fused KDA verify. - Document that fused-accept verify batches keep the unfused path.
- Skip HIP fused decode preparation and warmup when ReplaySSM is enabled without fused verify. - Preserve shared static inputs and fused verify initialization without arming ring decode. - Add regression coverage for ReplaySSM gating and verify preservation, and update environment-variable docs.
2 of 6 tasks
- Main squash-merged the base PR 41794, so the branch diff now carries only the fused KDA verify - Resolve environ.py and the env doc to main's alias-free SGLANG_USE_HIP_K3_* selectors; keep this PR's verify entry - Drop test_pre_rename_names_still_select with the aliases main removed
…fy-backend aiter through a model-owned hook - Drop SGLANG_OPT_HIP_K3_KDA_FLYDSL_VERIFY; --linear-attn-verify-backend aiter selects the fused verify (C3) - KDA's aiter verify maps to the Triton chain for batches and models no fused hook covers; non-ROCm raises - Allow KDA's aiter verify with --enable-linear-replayssm-spec (it writes the ring); GDN's aiter stays rejected - KDAAttnBackend calls one declared KDAFusedVerify hook (RadixLinearAttention.kda_fused_verify) instead of K3 branches - Move the K3 layer unpacking and the deferred f_b projection into models/kimi_k3_rocm_kda_verify.py - Remove the seven _k3_* handoff fields this PR added to RadixLinearAttention.__init__ - Keep the kernel adapter tensor-only, register it as attention.kda_fused_verify_aiter_hip - Warm the wave counts AITER's verify op declares; drop the fallbacks for untagged pre-release ops - Drop the fused-accept rejection: fused accept needs the flashinfer verify, so it never meets the hook - Split the ROCm arming out of KimiK3DeltaAttention._prepare_fused_decode into _prepare_fused_decode_hip
Contributor
Author
|
@HaiShaw this is ready for review.
|
Closed
4 of 5 tasks
…and gate KDA aiter verify on its kernel's devices - move the PR's ROCm arming (_prepare_fused_decode_hip, _prepare_fused_verify_hip) to kimi_k3_amd/kda.py functions - models/kimi_k3_rocm_kda_verify.py becomes kimi_k3_amd/kda.py (KimiK3HipFusedVerify, build/prepare_fused_*_hip) - kimi_k3.py keeps main's `if _is_hip:` and calls prepare_fused_kda_hip; forward defers f_b when the hook is installed - drop _kda_hip_fused_verify_ready: layer.kda_fused_verify is not None says the same - KDAKernelDispatcher asks the registered kda_fused_verify KernelSpec's declared devices instead of is_hip() - attention_hook names the KDA-model aiter verify flag kda_chain_verify (was kda_aiter_verify) - tests: the dispatcher accepts aiter verify on a declared device only; arming tests call the moved functions
- Pick up main's ratchet fix (sgl-project#51311) so CI runs the PR against a main whose CPU suite passes
1 task done
- The ring_writing condition accepts aiter for KDA chain verify, but the ValueError text listed only triton or nv_cutedsl
yuychang
added a commit
to yuychang/sglang
that referenced
this pull request
Nov 20, 2026
- The KDA fused backend and FlyDSL source vars pick an implementation, so Rule 4 keeps USE_ - Restore the origin/main EnvStr definitions, REMOVED_ENVS hints, readers, tests and docs for both - Drop the two rows from the rename alias table in test_environ.py - Decouples this PR from sgl-project#48701, which reads the selector from models/kimi_k3_amd/kda.py
This was referenced Nov 20, 2026
- The kernel and the hook's unfused f_b GEMM take BF16 f_a, so --dtype float16 batches were rejected then hit a dtype error - build_fused_verify_hip takes activation_dtype and returns None with a one-time warning when it is not BF16 - Cover the dtype axis in the arming table and add a prepare_fused_kda_hip case with FP16 activations
…t its metadata - An early flydsl_kda_verify_with_f_b exports the op without num_warps; the adapter read it and failed at warmup - _op now checks state_dtypes, max_tokens and num_warps, warns once naming the missing ones, and returns None - Add a CPU test with stubbed aiter modules for the missing and the complete op
…thout the AITER kernel - Drop the AITER skipif from the covered() fallback test and stub the op's max_tokens; it uses meta tensors only - Add a hook-level case: an unsupported batch never reaches covered() or run() and the unfused gate matches F.linear - Leave the parity and warmup cases skipped; they need the real kernel, which no CI pin has yet
This was referenced Nov 21, 2026
…ts coverage - Decide verify arming from verify_wanted, so a decode kernel that rejects the state dtype no longer keeps it off - Drop the decode buffers when neither decode nor verify armed from them - Reject unsupported state dtypes and intermediate-state shapes in covered() - Skip the real-kernel tests through the adapter's own availability check - Move the meta-only covered() cases to a CPU unit test and cover ragged aiter verify for DSPARK and EAGLE
Collaborator
|
/rerun-failed-ci |
Collaborator
|
/approve-ci |
Contributor
Author
|
Closing: with sgl-amd-mono serving every verify step, only KDA layer 0 (wide steps) and layers 0-1 (one-request steps) of 69 still reach this path, measured with call counters on a Kimi-K3 c14 server; that is about 0.05% of the original gain. The K3 recipe no longer enables it. ROCm/aiter#7529, its kernel, is closed with it. |
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.
Motivation
f_btiny GEMM,causal_conv1d_update, Triton target verify andrms_norm_gated.--linear-attn-verify-backend aiter.Modifications
flowchart TD A["KDA _forward_target_verify"] --> B{"layer.kda_fused_verify installed?"} B -->|"no: verify backend not aiter, or hook not armed"| T["Triton chain verify"] B -->|"yes"| C["KimiK3HipFusedVerify.forward"] C --> D{"batch covered: no ragged, tree or request ring; dtypes, shapes, draft count"} D -->|"yes"| E["AITER flydsl_kda_verify_with_f_b: f_b, conv1d, verify, gated norm in one launch"] D -->|"no: warn once"| F["unfused_gate projects deferred f_b"] F --> Tpython/sglang/kernels/ops/attention/__init__.pyattention.kda_fused_verify_aiter_hippython/sglang/kernels/ops/attention/kda_fused_verify_aiter_hip.pyavailable,covered,run,warmuppython/sglang/srt/arg_groups/attention_hook.pyaiterverify allowed with ReplaySSM spec and ragged ring writespython/sglang/srt/arg_groups/fields/exec_.py--linear-attn-verify-backendpython/sglang/srt/layers/attention/linear/kda_backend.pyKDAFusedVerifyprotocol; verify calls the hookpython/sglang/srt/layers/radix_linear_attention.pykda_fused_verify = Nonefieldpython/sglang/srt/models/kimi_k3.pyf_bwith the hookpython/sglang/srt/models/kimi_k3_amd/kda.pyKimiK3HipFusedVerify,build_fused_verify_hip,prepare_fused_kda_hiptest/registered/...(5 files)covered(), dispatcher, arming and fallback--linear-attn-verify-backend aiternow accepted for KDA on ROCm (GDNaiterstays rejected).aiterdiffers from main's gfx950tritonpath: it also skips the HIP chain-verify kernel.Accuracy Tests
01514b730c(env var revision, [FlyDSL] [CI] [Kernel] Add a fused Kimi-K3 KDA target-verify kernel on gfx942 and gfx950 ROCm/aiter#7529 atc4f41fbce); not rerun on4c70b17841.test_kimi_k3_kda_decode.py34 passed incl. fused-vs-unfused parity on MI355X (7114ee36b1).4c70b17841the installed AITER lacks [FlyDSL] [CI] [Kernel] Add a fused Kimi-K3 KDA target-verify kernel on gfx942 and gfx950 ROCm/aiter#7529, so parity cases skip; CPU unit tests 33 passed.Speed Tests and Profiling
4c70b17841. Hour-to-hour spread up to ~4%.aiternow also bypasses the HIP chain-verify fallback, so the numbers may not carry over.Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #45570926009
Latest PR Test (Extra): ⊘ Skipped -- add the
run-ci-nv-extralabel to opt in.Latest PR Test (AMD ROCm 10): ❌ Run #45570928598
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: