Skip to content

perf: Prefill-path kernels for GDN hybrid deciders (PPLX/Clef) — align with vLLM/SGLang #173

Open

Description

@hsliuustc0106

Goal

Optimize the prefill path for GDN hybrid deciders (classification C1 has no decode). Owner direction: mirror proven vLLM / SGLang kernel choices for the same model family; do not replace our serving runtime wholesale.

Assignee: @psv666

Why prefill

Public231 C1 on L20X is dominated by backbone forward (prefill-like). PPLX profile @ 1ba07d15 (in-process ~136 tok):

  • total ~89 ms; forward CUDA ~87.7 ms (~98%)
  • missing causal_conv1d → HF fallback to generic depthwise F.conv1d
  • HF-SDPA + GDN; no CUDA graphs; short-seq floor ~88–91 ms

Baselines (L20X, c=1, 231/231, no-thinking where needed)

PR Model SHA p50 p95
#166 PPLX-27B 1ba07d15 98.777 ms 341.202 ms
#165 Clef 9030065 247.518 ms 413.025 ms
#164 StartLux 4B (contrast) 5bb25be 6.785 ms 51.432 ms

Scope (prefill first)

  1. Required: causal_conv1d on sm_89 — no “falling back to reference PyTorch” warning on ready; worker may fail closed if unbound.
  2. GDN prefill kernels: follow vLLM/SGLang (Triton default / FlashInfer GDN prefill where applicable on our arch).
  3. Full-attn prefill: FlashInfer / SDPA as appropriate; document what actually binds on L20X.
  4. Optional later: short-seq CUDA graphs — only if profile still shows launch overhead after (1)–(3).

Out of scope for this issue: decode-only kernels; merging draft PRs without separate owner yes.

Evidence rule

Profile → tip on the draft PR branch → L20X Public231 C1 remeasure → keep only verified p50/p95 gains. Tips with 0 samples are not wins.

Related tips (unverified until remeasured): #166 7233620 (causal_conv1d gate); #165 033685b7 (FLA + causal_conv1d).

Related

Activity

  1. hsliuustc0106 commented on Oct 25, 2026

    @hsliuustc0106
    ContributorAuthor

    Kernel mapping from Clef CloudAgent (no new tip commit; tip still 033685b7, 0 L20X samples)

    Serve path: eager text prefill (use_cache false, c=1) on L20X sm_89. Decode schedulers / CUDA graphs from vLLM/SGLang do not fit this C1 path.

    Choice Follow on HF path
    Packages flash-linear-attention==0.5.2 + causal-conv1d>=1.5, import before modeling_qwen3_5. Do not vendor vLLM/SGLang kernels.
    Prefill GDN Stay on Triton/FLA chunk (chunk_gated_delta_rule). FlashInfer GDN prefill is SM90+ (or SM100 constraints); CuteDSL SM100-only — not for sm_89.
    Short seq C1 = full-prompt prefill → chunk path (pads to 64). Do not add fused-recurrent / causal_conv1d_update branch.
    Fallback Target /health linear_attention = fla+causal_conv1d. After remeasure, refuse startup if still torch_chunk / F.conv1d.
    CUDA graphs Leave eager. Ada sm_89 hybrid GDN graph capture can hang (SGLang reports). No torch.compile.
    sm_89 Need causal-conv1d wheel that loads on 8.9; GDN prefill is Triton JIT (not gencode-selected).
    State dtype Keep checkpoint mamba_ssm_dtype float32.

    Baseline still 9030065 p50 247.518 / p95 413.025. Remeasure tip before counting any win.

    Cross-ref: InferRSI#141.

  2. hsliuustc0106 commented on Oct 25, 2026

    @hsliuustc0106
    ContributorAuthor

    @psv666 Owner (system1): go — wire prefill ops first (causal_conv1d + FLA chunk on sm_89 / L20X). Mapping note above. Keep draft PRs; verified Public231 C1 deltas only.

  3. hsliuustc0106 commented on Oct 25, 2026

    @hsliuustc0106
    ContributorAuthor

    Owner correction: target GPU is H200 (sm_90 / Hopper), not L20X sm_89.

    @psv666 Please retarget prefill ops for Hopper:

    • FlashInfer GDN prefill is in scope (SM90 path from vLLM/SGLang).
    • causal_conv1d / FLA still required; gencode/cubin for sm_90 as needed.
    • Prior “stay Triton-only because sm_89” guidance no longer primary.

    Evidence still: Public231 C1 on H200, keep only verified p50/p95 deltas.

  4. hsliuustc0106 commented on Oct 25, 2026

    @hsliuustc0106
    ContributorAuthor

    Progress: #165 tip 4e430e18 (H200 / sm_90)

    CloudAgent wired Clef prefill ops on draft #165:

    • Import causal-conv1d ≥1.5, flash-linear-attention==0.5.2, flashinfer-python==0.6.16.post3 before Transformers builds Qwen3.5
    • Prefill: FlashInfer chunk_gated_delta_rule (use_cp=false); conv via causal_conv1d_fn; FLA for FusedRMSNormGated + Q/K l2norm_fwd
    • /health linear_attention must be flashinfer+fla+causal_conv1d; refuse torch_chunk / F.conv1d / non-9.0
    • No CuteDSL / CUDA graphs / torch.compile

    No H200 Public231 C1 yet — prior L20X numbers at 9030065 are not same-device baseline. @psv666 next: measure on H200.

  5. hsliuustc0106 commented on Oct 25, 2026

    @hsliuustc0106
    ContributorAuthor

    #166 tip 0b20933 (ops in, device target wrong)

    PPLX draft now has causal-conv1d 1.7.0 + FLA 0.5.2 Triton chunk; /health → fla-chunk. 0 samples.

    Still oriented to sm_89 cubin. Owner target is H200 sm_90 — CloudAgent queued to retarget like #165 4e430e18 (FlashInfer GDN prefill + FLA + causal_conv1d). @psv666 FYI.

  6. hsliuustc0106 commented on Oct 25, 2026

    @hsliuustc0106
    ContributorAuthor

    #165 tip now 594528a9: L20X reported 8.9 can start (FLA+causal_conv1d); FlashInfer only if major 9/10/12. Remeasure in progress vs 9030065.

  7. hsliuustc0106 commented on Oct 25, 2026

    @hsliuustc0106
    ContributorAuthor

    Verified Public231 C1 (L20X-labeled target, 231/231)

    PR Tip p50 p95 vs baseline health
    #165 594528a9 164.969 216.755 vs 9030065 247.518/413.025 → −33% / −48% fla+causal_conv1d
    #166 f968e576 98.037 302.569 vs 1ba07d15 98.777/341.202 → −0.7% / −11% fla-chunk

    Keep tips; drafts not merged. @psv666 Clef op path is a clear win; PPLX mainly p95.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions