Claude Opus 5 · Serving

S12 · Serving adapt

Valid

SGLang LFM2-1.2B model adapt serving 1dev · Model Adaptation

1.29×PERFORMANCE RATIO
151TOOL EVENTS
1TEXT PATCHES
0BINARY NAMES

01 / PROCESS MAP

Tool activity

Each row shows one agent’s tool events in its own recorded order. Colors show broad activities; bar widths do not represent duration.

Main agentClaude Opus 5 · 151 visible calls

InspectEditValidateExecuteBuildProfileRollbackOther
60Inspect
32Edit
2Build
31Validate
24Execute
2Other

02 / EVENT SEQUENCE

Event timeline

Requests are grouped by agent, activity and topic. Delegations open into child branches. Summaries describe visible requests; tool errors and missing responses are flagged. A recorded response does not establish command success or a performance improvement.

Show event timelineHide event timeline86 groups · 151 calls

Scroll within this panel to view all events. Command sketches retain familiar programs and options. Values become <val> or <n>; paths, addresses and script bodies are hidden as <path>, <url> and <script>.

Main agent

  1. Inspect · Source & workspace

    Requested workspace inspection related to source & workspace.

    1 call · #0001–#0001

    echo <val>ls -l -a <val> <n> > <path>
  2. Inspect · Task requirements

    Requested workspace inspection and file and log inspection related to task requirements.

    4 calls · #0002–#0005

    ls -l -a <path> <n> > <path>head -n <n>find <path> -maxdepth <n> -name <val> <flag> <args>Read <path>cd <path>ls -l -a <val> <val> <val> <val> <val> <path> <path>
    1 more command sketches
    wc -l <path> <path> <path>
  3. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0006–#0006

    Read <path>
  4. Inspect · Runtime processes

    Requested file and log inspection related to runtime processes.

    1 call · #0007–#0007

    Read <path>
  5. Validate · Benchmark & validation setup

    Requested file and log inspection related to benchmark & validation setup.

    1 call · #0008–#0008

    cd <path><command> <args>cat <val>
  6. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0009–#0009

    Read <path>
  7. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0010–#0010

    Read <path>
  8. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    3 calls · #0011–#0013

    Read <path>
  9. Validate · Batching & scheduling

    Requested script or workload execution and file and log inspection related to batching & scheduling.

    1 call · #0014–#0014

    cd <path>python3 -c <script>head -c <n> <path>echoecho <flag>head -c <n> <val>
  10. Inspect · Source & workspace

    Requested workspace inspection, repository inspection and file and log inspection related to source & workspace.

    1 call · #0015–#0015

    lsgit log --oneline <flag>echo <val>find <path> -iname <val> <flag> <args>head -n <n>grep -r -i -l <val> <path>
  11. Inspect · Device memory

    Requested runtime inspection, file and log inspection and script or workload execution related to device memory.

    1 call · #0016–#0016

    npu-smi info <n> >& <path>head -n <n>echo <val>python3 -c <script> <n> >& <path>tail -n <n>ls <path> <n> > <path>
    2 more command sketches
    find <path> -maxdepth <n> -iname <val> -type <val> <n> > <path>head
  12. Other · Parallelism & communication

    Requested environment setup or inspection and source searches related to parallelism & communication.

    1 call · #0017–#0017

    envgrep -i -E <val>sort
  13. Inspect · Source & workspace

    Requested source searches, file and log inspection and script or workload execution related to source & workspace.

    4 calls · #0018–#0021

    cd <path>grep -n <val> <path>head -n <n>sed -n <val> <path>timeout <n> <val> <path> > <path> <n> > <path>echo <val>
    3 more command sketches
    tail -n <n> <path>python3 -c <script> <n> > <path>head -c <n> <path>
  14. Inspect · Attention kernels

    Requested file and log inspection and workspace inspection related to attention kernels.

    1 call · #0022–#0022

    cat <path>ls <path>echo <val>wc -l <path> <path> <path> <path>
  15. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    2 calls · #0023–#0024

    sed -n <val> <path>grep -n <val> <path>head -n <n>echo <val>
  16. Validate · Benchmark & validation setup

    Requested environment setup or inspection, file and log inspection and script or workload execution related to benchmark & validation setup.

    1 call · #0025–#0025

    env <vars> timeout <n> <val> <path> > <path> <n> > <path>echo <val>tail -n <n> <path>python3 -c <script>
  17. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0026–#0026

    Read <path>
  18. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0027–#0027

    Read <path>
  19. Execute · Prefix caching

    Requested workspace file updates, environment setup or inspection and file and log inspection related to prefix caching.

    1 call · #0028–#0028

    mkdir -p <path>env <vars> timeout <n> <val> -m <val> <flag> <args>echo <val>tail -n <n> <path>
  20. Inspect · Attention kernels

    Requested file and log inspection, source searches and workspace inspection related to attention kernels.

    6 calls · #0029–#0034

    sed -n <val> <path>grep -n <val> <path>cd <path>lshead -n <n> <path>echo <val>
    5 more command sketches
    head -n <n>python3 -c <script> <n> >& <path>tail -n <n>pip list <n> > <path>grep -i -E <val>
  21. Inspect · Convolution & sequence boundaries

    Requested file and log inspection and environment setup or inspection related to convolution & sequence boundaries.

    1 call · #0035–#0035

    cd <path>cat > <path> <script>env <vars> timeout <n> <val> <path> <n> >& <path>tail -n <n>
  22. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0036–#0036

    sed -n <val> <path>
  23. Inspect · Convolution & sequence boundaries

    Requested source searches and file and log inspection related to convolution & sequence boundaries.

    1 call · #0037–#0037

    grep -n <val> -A <n> <path>sed -n <val>
  24. Inspect · Attention kernels

    Requested file and log inspection, environment setup or inspection and source searches related to attention kernels.

    2 calls · #0038–#0039

    cat > <path> <script>env <vars> timeout <n> <val> <path> <n> >& <path>grep -v <val>tail -n <n>cd <path>grep -r -n <val> <path>
    5 more command sketches
    head -n <n>echo <val>find <path> -name <val>grep -n <val> <path>grep -i <val>
  25. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    1 call · #0040–#0040

    sed -n <val> <path>echo <val>grep -n <val> <path>head -n <n>
  26. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    2 calls · #0041–#0042

    cd <path>wc -l <path>echo <val>cat <path>sed -n <val> <path>
  27. Edit · Attention kernels

    Requested code edits related to attention kernels.

    2 calls · #0043–#0044

    Write <path>Edit <path>
  28. Inspect · Attention kernels

    Requested file and log inspection, environment setup or inspection and source searches related to attention kernels.

    1 call · #0045–#0045

    cat > <path> <script>env <vars> timeout <n> <val> <path> <n> >& <path>grep -v -i -E <val>tail -n <n>
  29. Inspect · Device memory

    Requested file and log inspection and source searches related to device memory.

    1 call · #0046–#0046

    sed -n <val> <path> <n> > <path>head -n <n>echo <val>grep -n <val> -A <n> <path>
  30. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0047–#0047

    sed -n <val> <path>
  31. Inspect · Device memory

    Requested source searches and file and log inspection related to device memory.

    1 call · #0048–#0048

    date -uecho <val>grep -n <val> -A <n> <path>head -n <n>echo <path>grep -n <val> <path>
  32. Edit · Attention kernels

    Requested code edits related to attention kernels.

    3 calls · #0049–#0051

    Edit <path>
  33. Inspect · Attention kernels

    Requested file and log inspection, environment setup or inspection and source searches related to attention kernels.

    1 call · #0052–#0052

    cat > <path> <script>env <vars> timeout <n> <val> <path> <n> >& <path>grep -v -i -E <val>tail -n <n>
  34. Edit · Attention kernels

    Requested code edits related to attention kernels.

    4 calls · #0053–#0056

    Write <path>Edit <path>
  35. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0057–#0057

    Edit <path>
  36. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0058–#0058

    Edit <path>
  37. Inspect · Convolution & sequence boundaries

    Requested source searches and file and log inspection related to convolution & sequence boundaries.

    1 call · #0059–#0059

    grep -n <val> <path> <path>head -n <n>
  38. Edit · Attention kernels

    Requested code edits related to attention kernels.

    2 calls · #0060–#0061

    Edit <path>
  39. Execute · Prefix caching

    Requested environment setup or inspection, execution waits and source searches related to prefix caching.

    1 call · #0062–#0062

    cd <path>env <vars> timeout <n> <val> -m <val> <flag> <args>env <vars><command> <args>sleep <n>grep -i -E <val> <path>
    2 more command sketches
    head -n <n>tail -n <n> <path>
  40. Inspect · Batching & scheduling

    Requested file and log inspection and environment setup or inspection related to batching & scheduling.

    1 call · #0063–#0063

    cd <path>cat > <path> <script>env <vars> timeout <n> <val> <path> <n> >& <path>tail -n <n>
  41. Validate · Batching & scheduling

    Requested file and log inspection and environment setup or inspection related to batching & scheduling.

    1 call · #0064–#0064

    cd <path>cat > <path> <script>env <vars> timeout <n> <val> <path> <n> >& <path>tail -n <n>
  42. Validate · Benchmark & validation setup

    2 tool errors

    Requested process termination, execution waits and script or workload execution related to benchmark & validation setup.

    6 calls · #0065–#0070

    pkill -f <val> <n> > <path>sleep <n>pkill <flag> <args>timeout <n> <val> <path> > <path> <n> > <path>echo <val>cat <path>
    13 more command sketches
    head -n <n>tail -n <n> <path>cat <path> <n> > <path>tail -n <n> <path> <n> > <path>ls -l -a <path> <n> > <path>ps <val>grep -c <val>date -ucd <path>nohup <val> -c <path> > <path> <n> >& <path>ls -l -a <path>tail -n <n>echo <path>
  43. Validate · Batching & scheduling

    Requested tool activity related to batching & scheduling.

    1 call · #0071–#0071

    cd <path><command> <args>
  44. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0072–#0072

    sed -n <val> <path>
  45. Validate · Benchmark & validation setup

    Requested workspace file updates, workspace inspection and script or workload execution related to benchmark & validation setup.

    4 calls · #0073–#0076

    rm -f <path>ls <path> <n> > <path>echo <val>nohup <val> -c <path> > <path> <n> >& <path>sleep <n>date -u
    7 more command sketches
    ls -l -a <path>tail -n <n>echo <path>tail -n <n> <path> <n> > <path>python3 -c <script>mkdir -p <path>cp <path> <path>
  46. Execute · Benchmark & validation setup

    Requested execution waits and file and log inspection related to benchmark & validation setup.

    1 call · #0077–#0077

    sleep <n>date -ucat <path> <n> > <path>echo <flag>tail -c <n> <path> <n> > <path>
  47. Execute · Attention kernels

    Requested source searches, execution waits and file and log inspection related to attention kernels.

    1 call · #0078–#0078

    cd <path>echo <path>grep -n <val> <path> <path>echo <val>sleep <n>date -u
    3 more command sketches
    cat <path> <n> > <path>echo <flag>tail -c <n> <path>
  48. Execute · Benchmark & validation setup

    Requested execution waits, file and log inspection and workspace inspection related to benchmark & validation setup.

    2 calls · #0079–#0080

    sleep <n>date -ucat <path> <n> > <path>echo <flag>tail -c <n> <path>ls -l -a <path>
    2 more command sketches
    ls -l -a <path> <n> > <path>echo <val>
  49. Execute · Task requirements

    Requested script or workload execution and source searches related to task requirements.

    1 call · #0081–#0081

    cd <path>python3 -c <script> <n> >& <path>grep -v <path>
  50. Execute · Attention kernels

    Requested workspace file updates, script or workload execution and workspace inspection related to attention kernels.

    2 calls · #0082–#0083

    cd <path>cp <path> <path>echo <val>python3 -c <script> <n> > <path>find <path> -name <val> -path <val> <n> > <path>head -n <n>
    5 more command sketches
    cat -n <path>sed -n <val>cat > <path> <script>timeout <n> <val> <path> <n> >& <path>grep -v <val>
  51. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0084–#0084

    cd <path>cat -n <path>
  52. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0085–#0085

    cd <path>grep -n <val> -A <n> <path>head -n <n>
  53. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0086–#0086

    cd <path>sed -n <val> <path>cat -necho <val>
  54. Execute · Precision & numerical checks

    Requested file and log inspection, script or workload execution and source searches related to precision & numerical checks.

    1 call · #0087–#0087

    cat > <path> <script>timeout <n> <val> <path> <n> >& <path>grep -v <val>
  55. Edit · Attention kernels

    Requested code edits related to attention kernels.

    6 calls · #0088–#0093

    Edit <path>
  56. Inspect · Attention kernels

    Requested source searches and file and log inspection related to attention kernels.

    2 calls · #0094–#0095

    cd <path>grep -n <val> <path>head -n <n>echo <val>grep -r -n <val> <path> <path> <n> > <path>sed -n <val> <path>
    1 more command sketches
    cat -n
  57. Edit · Attention kernels

    Requested code edits related to attention kernels.

    3 calls · #0096–#0098

    Edit <path>
  58. Validate · Attention kernels

    Requested file and log inspection, script or workload execution and source searches related to attention kernels.

    1 call · #0099–#0099

    cd <path>date -ucat > <path> <script>timeout <n> <val> <path> <n> >& <path>grep -v <val>
  59. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0100–#0100

    Edit <path>
  60. Validate · Benchmark & validation setup

    Requested script or workload execution and source searches related to benchmark & validation setup.

    1 call · #0101–#0101

    cd <path>date -utimeout <n> <val> <path> <n> >& <path>grep -v <val>
  61. Inspect · Source & workspace

    Requested source searches related to source & workspace.

    1 call · #0102–#0102

    grep -E <val> <path>
  62. Validate · Attention kernels

    Requested file and log inspection, script or workload execution and source searches related to attention kernels.

    1 call · #0103–#0103

    cd <path>date -ucat > <path> <script>timeout <n> <val> <path> <n> >& <path>grep -E <val>
  63. Inspect · Attention kernels

    Requested source searches and file and log inspection related to attention kernels.

    1 call · #0104–#0104

    cd <path>echo <path>grep -n <val> -A <n> <path>grep -n <val>head -n <n>
  64. Validate · Attention kernels

    Requested file and log inspection, script or workload execution and source searches related to attention kernels.

    1 call · #0105–#0105

    cd <path>date -ucat > <path> <script>timeout <n> <val> <path> <n> >& <path>grep -E <val>
  65. Inspect · Attention kernels

    Requested file and log inspection, script or workload execution and source searches related to attention kernels.

    1 call · #0106–#0106

    cd <path>date -ucat > <path> <script>timeout <n> <val> <path> <n> >& <path>grep -E <val>grep -v <val>
  66. Edit · Convolution & sequence boundaries

    Requested code edits, script or workload execution and source searches related to convolution & sequence boundaries.

    1 call · #0107–#0107

    cd <path>date -used -i <path> <path>timeout <n> <val> <path> <n> >& <path>grep -E <val>
  67. Execute · Benchmark & validation setup

    Requested workspace inspection, repository inspection and workspace file updates related to benchmark & validation setup.

    6 calls · #0108–#0113

    ls -l -a <path> <n> > <path>echo <val>git status <flag>rm -f <path>nohup <val> -c <path> > <path> <n> >& <path>sleep <n>
    7 more command sketches
    date -ucd <path>headcat <path> <n> > <path>tail -c <n> <path>find <val> -maxdepth <n>head -n <n>
  68. Execute · Latency & request handling

    Requested script or workload execution related to latency & request handling.

    1 call · #0114–#0114

    cd <path>python3 -c <script>
  69. Validate · Benchmark & validation setup

    Requested workspace file updates, source searches and file and log inspection related to benchmark & validation setup.

    1 call · #0115–#0115

    cd <path>date -ucp <path> <path>echo <val>grep -r -n <val> <path> <n> > <path>head -n <n>
    2 more command sketches
    ls -l -a <path>python3 -c <script>
  70. Inspect · Attention kernels

    Requested source searches and file and log inspection related to attention kernels.

    2 calls · #0116–#0117

    cd <path>echo <path>grep -n <val> <path>echoecho <val>sed -n <val> <path>
    3 more command sketches
    cat -nhead -n <n>grep -r -n <val> <path>
  71. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0118–#0118

    Edit <path>
  72. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0119–#0119

    Read <path>
  73. Edit · Attention kernels

    Requested code edits related to attention kernels.

    6 calls · #0120–#0125

    Edit <path>
  74. Validate · Attention kernels

    Requested file and log inspection, script or workload execution and source searches related to attention kernels.

    1 call · #0126–#0126

    cd <path>date -ucat > <path> <script>timeout <n> <val> <path> <n> >& <path>grep -E <val>
  75. Edit · Attention kernels

    Requested code edits, script or workload execution and file and log inspection related to attention kernels.

    1 call · #0127–#0127

    cd <path>date -used -i <path> <path>timeout <n> <val> <val> <script>echo <val>cat > <path> <script>
    2 more command sketches
    timeout <n> <val> <path> <n> >& <path>grep -E <val>
  76. Execute · Benchmark & validation setup

    Requested workspace file updates, repository inspection and workspace inspection related to benchmark & validation setup.

    7 calls · #0128–#0134

    cd <path>rm -rf <val>git status <flag>ls -l -a <path> <n> > <path>echo <val>rm -f <path>
    6 more command sketches
    nohup <val> -c <path> > <path> <n> >& <path>sleep <n>date -ucat <path> <n> > <path>tail -c <n> <path>python3 -c <script>
  77. Validate · Benchmark & validation setup

    Requested workspace inspection, workspace file updates and script or workload execution related to benchmark & validation setup.

    4 calls · #0135–#0138

    cd <path>date -uls -l -a <path> <n> > <path>echo <val>rm -f <path>nohup <val> -c <path> > <path> <n> >& <path>
    4 more command sketches
    sleep <n>cat <path> <n> > <path>tail -c <n> <path>python3 -c <script>
  78. Inspect · Source & workspace

    Requested script or workload execution and file and log inspection related to source & workspace.

    1 call · #0139–#0139

    cd <path>date -utimeout <n> <val> <path> <n> >& <path>tail -n <n>echo <val>
  79. Inspect · Device memory

    Requested runtime inspection, source searches and workspace inspection related to device memory.

    1 call · #0140–#0140

    cd <path>date -uecho <path>ps <flag> <args>grep -E <val>grep -v <val>
    8 more command sketches
    echo <val><command> <args>ls -l -a <path> <n> > <path>grep -i -E <val>head <flag>git status <flag>git status <flag> <args>grep <val>
  80. Inspect · Attention kernels

    Requested repository inspection, workspace inspection and source searches related to attention kernels.

    1 call · #0141–#0141

    cd <path>date -uecho <val>git diff --statgit diff <path> <path>find <path> -path <path> <flag> <args>
    2 more command sketches
    xargs <val> <flag> <args>grep -i <val>
  81. Validate · Benchmark & validation setup

    Requested script or workload execution and file and log inspection related to benchmark & validation setup.

    1 call · #0142–#0142

    cd <path>date -utimeout <n> <val> -m <val> <path> -x -q <n> >& <path>tail -n <n>
  82. Validate · Attention kernels

    Requested repository inspection, file and log inspection and script or workload execution related to attention kernels.

    2 calls · #0143–#0144

    cd <path>date -uecho <val>git diff <path>head -n <n>echo
    10 more command sketches
    python3 -c <script>python3 -m <module> <script> <script> <script> <script> <script>find <path> -name <val> <flag> <args>find <path> -name <val> <n> > <path>rm -rf <path> <n> > <path>echo <path>git status <flag>git status <flag> <args>truewc -l
  83. Validate · Benchmark & validation setup

    Requested workspace file updates, script or workload execution and execution waits related to benchmark & validation setup.

    3 calls · #0145–#0147

    cd <path>date -urm -f <path>nohup <val> -c <path> > <path> <n> >& <path>sleep <n>cat <path> <n> > <path>
    8 more command sketches
    echo <val>tail -c <n> <path> <n> > <path>python3 -c <script>ps <flag> <args>grep -E <val>grep -v <val>ls -l -a <path> <n> > <path>git status <flag>
  84. Build · Source & workspace

    Requested workspace inspection, file and log inspection and source searches related to source & workspace.

    2 calls · #0148–#0149

    cd <path>date -uls <path>echo <val>sed -n <val> <path> <n> > <path>grep -v -E <val>
    4 more command sketches
    grep -v <val>head -n <n>timeout <n> <val> <path> <n> >& <path>tail -n <n>
  85. Inspect · Attention kernels

    Requested repository inspection, file and log inspection and source searches related to attention kernels.

    1 call · #0150–#0150

    cd <path>date -uecho <val>git status <flag> <args>head -n <n>echo <path>
    4 more command sketches
    grep -n <val> <path> <path>grep <flag> <args>sort -utr <val> <val>
  86. Other · Attention kernels

    Requested source searches, runtime inspection and workspace inspection related to attention kernels.

    1 call · #0151–#0151

    cd <path>date -uecho <val>grep -n <val> <path>echoecho <path>
    9 more command sketches
    ps <flag> <args>grep -E <val>grep -v <val><command> <args>ls <path> <n> > <path>git status <flag> <args>grep -v <path>truegit status <flag>

03 / CANDIDATE ARTIFACT

Text patches & binary names

Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.

sglang · 5 changed files

Base commit: 340db9201005fc64635bb25db1d2538f955761c3

diff --git a/python/sglang/srt/hardware_backend/npu/attention/ascend_short_conv_backend.py b/python/sglang/srt/hardware_backend/npu/attention/ascend_short_conv_backend.pynew file mode 100644index 0000000000000000000000000000000000000000..9f67d8c1d637879aa4f2f34ed3fe014ab15dac9c--- /dev/null+++ b/python/sglang/srt/hardware_backend/npu/attention/ascend_short_conv_backend.py@@ -0,0 +1,213 @@+# Copyright 2023-2026 SGLang Team+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+#     http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ==============================================================================+"""Ascend conv-state sidecar for hybrid short-conv models (LFM2 / LFM2-MoE).++``ShortConvAttnBackend`` owns the portable per-request conv-state plumbing (slot+ids, ``has_initial_state`` prefix mask, cu-seqlens) and hands it to the model via+``conv_state_metadata``; the model then runs ``causal_conv1d_fn`` /+``causal_conv1d_update`` itself. On Ascend that second half has no working+implementation -- see the module docstring of :mod:`ascend_short_conv_ops` -- so+this subclass additionally resolves the *kernels* for the step and publishes them+on the metadata as :class:`AscendShortConvKernels`.++The model asks the metadata for ``conv_kernels`` and, when present, calls+``forward()`` instead of the portable pair. That keeps the device dispatch in the+backend (which already knows the forward mode, slot ids and cu-seqlens) rather+than in the model, and keeps the Ascend token-major layout out of the model.++Cost model: the gather plan behind the extend kernel depends only on the step's+cu-seqlens and slot ids, so it is built **once per step** here and reused by all+12 conv layers of LFM2.5-1.2B, instead of once per layer.+"""++from __future__ import annotations++from typing import TYPE_CHECKING, Optional++import torch++from sglang.srt.hardware_backend.npu.attention.ascend_hybrid_linear_attn_backend import (+    AscendHybridLinearAttnBackend,+    AscendMambaAttnBackendBase,+)+from sglang.srt.layers.attention.hybrid_linear_attn_backend import (+    ShortConvHybridAttnBackend,+)+from sglang.srt.hardware_backend.npu.attention.ascend_short_conv_ops import (+    ShortConvIndexCache,+    ShortConvPlan,+    build_short_conv_plan,+    resolve_decode_slots,+    short_conv_decode,+    short_conv_extend,+)+from sglang.srt.layers.attention.linear.short_conv_backend import (+    ShortConvAttnBackend,+    ShortConvMetadata,+)+from sglang.srt.model_executor.forward_batch_info import ForwardBatch++if TYPE_CHECKING:+    from sglang.srt.model_executor.model_runner import ModelRunner+++class AscendShortConvKernels:+    """Step-bound Ascend short-conv kernels handed to the model's conv layers.++    Holds the resolved phase and the shared per-step gather plan / decode slots,+    so a conv layer only supplies its own weights and pool view. One instance per+    forward step, reused by every conv layer.+    """++    __slots__ = ("_plan", "_slots")++    def __init__(+        self, plan: Optional[ShortConvPlan], slots: Optional[torch.Tensor]+    ) -> None:+        # Exactly one is set: ``_plan`` for extend, ``_slots`` for decode.+        self._plan = plan+        self._slots = slots++    def forward(+        self,+        x: torch.Tensor,+        weight: torch.Tensor,+        bias: Optional[torch.Tensor],+        conv_state: torch.Tensor,+    ) -> torch.Tensor:+        """Run this step's causal short conv over token-major ``x`` ``(T, D)``.++        ``weight`` is ``(D, K)`` and ``conv_state`` the layer's+        ``(num_slots, K-1, D)`` pool view, updated in place. Returns ``(T, D)``.+        """+        if self._plan is not None:+            return short_conv_extend(x, weight, bias, conv_state, self._plan)+        return short_conv_decode(x, weight, bias, conv_state, self._slots)+++class AscendShortConvAttnBackend(ShortConvAttnBackend, AscendMambaAttnBackendBase):+    """Ascend conv-state sidecar: portable plumbing plus resolved NPU kernels.++    Inherits the portable short-conv plumbing from :class:`ShortConvAttnBackend`+    and the Ascend graph/metadata handling from+    :class:`AscendMambaAttnBackendBase` (int32 static index buffers, NPU+    capture/replay metadata). MRO puts ShortConv first so its per-step state+    hooks run, then defers to the Ascend base for graph state.+    """++    # The Ascend kernels are purely index-driven, with no host loop over the+    # batch, so the extend host mirrors (a device->host sync per extend step)+    # are dead weight here.+    needs_extend_host_mirrors: bool = False++    def __init__(self, model_runner: ModelRunner):+        super().__init__(model_runner)+        # conv[0] on NPU is (n_layers, n_slots, K-1, D) -- token-major with the+        # channel axis last (see memory_pool_npu._init_npu_conv_state).+        self._num_slots = int(self.conv_states_shape[1])+        self._conv_kernel = int(self.conv_states_shape[2]) + 1+        # Every conv layer shares one state dtype, so the plan pre-casts its+        # prefix mask once per step instead of once per layer.+        self._conv_dtype = self.req_to_token_pool.mamba_pool.mamba_cache.conv[0].dtype+        # Extend gather indices are a pure function of the step's shape, which+        # chunked prefill repeats every step; caching them keeps ~1.2 ms of index+        # launches off each extend step.+        self._index_cache = ShortConvIndexCache()+        self._kernels: Optional[AscendShortConvKernels] = None++    def _resolve_kernels(self, forward_batch: ForwardBatch) -> None:+        """Resolve this step's kernels once, before any conv layer runs."""+        indices = self._cache_indices+        if indices is None:+            self._kernels = None+            return+        mode = forward_batch.forward_mode+        if mode.is_decode_or_idle():+            self._kernels = AscendShortConvKernels(+                None, resolve_decode_slots(indices, self._num_slots)+            )+            return+        if mode.is_target_verify() or mode.is_draft_extend_v2():+            # These write several draft tokens per slot per step; the conv-state+            # window here is exactly K-1 wide, with no draft-step dimension.+            raise NotImplementedError(+                "Ascend short conv does not support speculative decoding "+                f"(forward mode {mode}); the conv-state sidecar has no "+                "draft-step state handling."+            )+        query_start_loc = self.forward_metadata.query_start_loc+        num_tokens = int(forward_batch.input_ids.shape[0])+        # ``extend_seq_lens_cpu`` is a host list the scheduler already filled, so+        # keying the cache on it costs no sync. It fully determines the indices+        # together with num_tokens and the kernel width.+        cached_indices = self._index_cache.get(+            query_start_loc,+            self._conv_kernel,+            num_tokens,+            forward_batch.extend_seq_lens_cpu,+        )+        plan = build_short_conv_plan(+            query_start_loc=query_start_loc,+            cache_indices=indices,+            kernel_size=self._conv_kernel,+            num_tokens=num_tokens,+            has_initial_state=self._has_initial_state,+            num_slots=self._num_slots,+            state_dtype=self._conv_dtype,+            indices=cached_indices,+        )+        self._kernels = AscendShortConvKernels(plan, None)++    def init_forward_metadata(self, forward_batch: ForwardBatch):+        super().init_forward_metadata(forward_batch)+        self._resolve_kernels(forward_batch)++    def init_forward_metadata_out_graph(+        self, forward_batch: ForwardBatch, in_capture: bool = False+    ):+        super().init_forward_metadata_out_graph(forward_batch, in_capture)+        self._resolve_kernels(forward_batch)++    def init_forward_metadata_capture_cpu_graph(self, *args, **kwargs):+        super().init_forward_metadata_capture_cpu_graph(*args, **kwargs)+        # Capture-time batches carry no ForwardBatch here; decode slots are the+        # only step state and are refreshed from the same persistent buffer at+        # replay (init_forward_metadata), so bind them directly.+        indices = self._cache_indices+        self._kernels = (+            None+            if indices is None+            else AscendShortConvKernels(+                None, resolve_decode_slots(indices, self._num_slots)+            )+        )++    def conv_state_metadata(+        self, layer_id: int, forward_batch: ForwardBatch+    ) -> ShortConvMetadata:+        return super().conv_state_metadata(layer_id, forward_batch)._replace(+            conv_kernels=self._kernels+        )+++class AscendShortConvHybridAttnBackend(+    ShortConvHybridAttnBackend, AscendHybridLinearAttnBackend+):+    """Hybrid wrapper pairing the Ascend full-attention backend with the Ascend+    conv-state sidecar.++    Composes the short-conv ``conv_state_metadata`` forwarding with the Ascend+    hybrid backend's NPU-specific state hooks. MRO puts the short-conv wrapper+    first so the model's ``conv_state_metadata`` call reaches the sidecar.+    """diff --git a/python/sglang/srt/hardware_backend/npu/attention/ascend_short_conv_ops.py b/python/sglang/srt/hardware_backend/npu/attention/ascend_short_conv_ops.pynew file mode 100644index 0000000000000000000000000000000000000000..647f341974f71c19b7713ceb294eabf521a065bf--- /dev/null+++ b/python/sglang/srt/hardware_backend/npu/attention/ascend_short_conv_ops.py@@ -0,0 +1,404 @@+# Copyright 2023-2026 SGLang Team+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+#     http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+# ==============================================================================+"""Ascend depthwise causal short-conv kernels for hybrid short-conv models.++Why this exists+---------------+The portable short-conv path (``sglang.srt.layers.attention.mamba.causal_conv1d``)+has two implementations: a CUDA ``sgl_kernel`` op and a Triton fallback. Neither+serves Ascend:++* ``sgl_kernel`` is a CUDA extension and is absent on NPU, so the wrapper always+  selects Triton.+* the Triton *varlen prefill* kernel (``causal_conv1d_fn``) does not compile+  through BiShengIR -- its per-program tile exceeds the 910B unified-buffer+  budget ("ub overflow, requires 2301952 bits while 1572864 bits available"),+  so every prefill step fails at JIT time.++Both phases are therefore expressed here as dense torch ops that map onto+fused Ascend primitives (``index_select`` / ``mul`` / ``sum`` / ``index_copy_``).++Layout+------+Tokens are kept **token-major** ``(T, D)``, the layout the model already has+after ``in_proj``. The portable CUDA path needs ``(D, T)`` and pays a transpose+on both sides of the conv; on Ascend a transpose of the ``(T, D)`` activation is+a real copy with a bad access pattern, so the varlen kernel here consumes and+produces ``(T, D)`` directly and the model skips both transposes.++Prefill (varlen extend)+-----------------------+For a request with cu-seqlens ``[s, e)`` and conv state ``S`` (its previous+``K-1`` tokens, oldest first), the causal conv over the *extended* sequence+``xext = concat(S, x[s:e])`` is::++    out[p] = sum_j w[:, j] * xext[p + j]      p in [0, e-s), j in [0, K)++Rather than materialize ``xext`` per request (a host loop over the batch, times+one call per conv layer), the batch is gathered in one shot. A source buffer+``src = concat(x, states_flat)`` holds every value any window can reference, and+a precomputed ``(T, K)`` index picks each window element -- from the token region+when the tap lands inside the request, from the state region when it reaches+behind the request start. One ``index_select`` + one fused multiply-reduce covers+the whole step, with no dependence on batch size or ragged lengths.++The same trick extracts the next conv state: the trailing ``K-1`` values of each+``xext`` are just another gather from ``src``, which stays correct when a chunk is+shorter than ``K-1`` (small chunked-prefill chunks, where the new state still+straddles the old state and the chunk).++Because the index plan depends only on the cu-seqlens and the slot ids, it is+built once per forward step by the backend (:class:`ShortConvPlan`) and shared by+every conv layer in the model -- 12 of the 16 layers for LFM2.5-1.2B.+"""++from __future__ import annotations++import weakref+from typing import NamedTuple, Optional, Sequence++import torch++# Per-weight cache of the fp32 conv taps. ``weight`` is a persistent (D, K)+# parameter, but the taps the kernels reduce against are (1, K, D) fp32; deriving+# them per call cost a transpose plus a cast on every layer of every step (~0.6+# ms/step over the 12 conv layers of LFM2.5-1.2B) to rebuild a tensor that never+# changes. Keyed on ``id`` -- tensor keys cannot go in a WeakKeyDictionary or a+# plain dict, because both compare keys with ``==``, which is elementwise for+# tensors. A finalizer drops the entry when the weight dies, so a recycled ``id``+# can never return another layer's taps.+_TAPS_CACHE: "dict[int, torch.Tensor]" = {}+++def conv_taps(weight: torch.Tensor) -> torch.Tensor:+    """Return this conv weight's ``(1, K, D)`` fp32 taps, cached per weight.++    Kept fp32 so the reduction accumulates in fp32 (matching the reference CUDA+    kernel) while the activation stays bf16: ``bf16 * fp32`` promotes to an fp32+    multiply-reduce without materializing a cast of the much larger window.+    """+    key = id(weight)+    taps = _TAPS_CACHE.get(key)+    if taps is None:+        taps = weight.t().unsqueeze(0).float().contiguous()+        _TAPS_CACHE[key] = taps+        weakref.finalize(weight, _TAPS_CACHE.pop, key, None)+    return taps+++class ShortConvPlan(NamedTuple):+    """Per-step, layer-independent gather plan for the varlen extend conv.++    Built once per forward step from the cu-seqlens and slot ids, then shared by+    every short-conv layer. ``window_index`` and ``state_index`` address the+    concatenated ``[tokens ; states]`` source buffer described in the module+    docstring.+    """++    # (T * K,) int32/int64 -- flattened per-token conv window source rows.+    window_index: torch.Tensor+    # (n * (K-1),) -- source rows holding each request's next conv state.+    state_index: torch.Tensor+    # (n,) int64 conv-state slot ids, already clamped to a writable row.+    slots: torch.Tensor+    # (n, 1, 1) {0,1} mask zeroing the state rows of requests that start fresh,+    # already in the conv-state dtype when ``state_dtype`` was supplied.+    # None when every request in the step starts fresh (nothing to mask).+    prefix_mask: Optional[torch.Tensor]+    # Number of tokens in the step (rows of the token region).+    num_tokens: int+    # Number of requests in the step.+    batch_size: int+    # Conv kernel width.+    kernel_size: int+++def build_short_conv_indices(+    query_start_loc: torch.Tensor,+    kernel_size: int,+    num_tokens: int,+) -> tuple[torch.Tensor, torch.Tensor]:+    """Build the ``(window_index, state_index)`` gather indices for one step.++    Split out from :func:`build_short_conv_plan` because these two tensors are a+    pure function of the cu-seqlens and ``num_tokens`` -- they do not depend on+    the slot ids or the prefix mask, which are the only parts that change between+    two steps of the same shape. Under chunked prefill the scheduler emits the+    same shape every step, so the backend caches the result (see+    :class:`ShortConvIndexCache`); building them costs ~1.2 ms of launch overhead+    for ~20 tiny elementwise ops, more than the 12 conv layers that consume them.+    """+    device = query_start_loc.device+    width = int(kernel_size)+    win = width - 1+    total = int(num_tokens)+    starts = query_start_loc[:-1]+    ends = query_start_loc[1:]+    batch_size = int(starts.shape[0])++    # Which request each flat token belongs to, and where that request starts.+    positions = torch.arange(total, device=device, dtype=torch.int64)+    seq_id = torch.searchsorted(+        ends.contiguous().to(torch.int64), positions, right=True+    )+    seq_id = seq_id.clamp_(max=max(batch_size - 1, 0))+    seq_start = starts.to(torch.int64).index_select(0, seq_id)++    # Window taps: tap j of token t reads extended position (t - s) + j, i.e.+    # token row t + j - (K-1) when that stays inside the request, else the+    # state row (t - s) + j of this request's state block.+    taps = torch.arange(width, device=device, dtype=torch.int64)+    token_src = positions.unsqueeze(1) + taps.unsqueeze(0) - win+    state_base = total + seq_id.unsqueeze(1) * win+    state_src = state_base + (positions - seq_start).unsqueeze(1) + taps.unsqueeze(0)+    window_index = torch.where(+        token_src >= seq_start.unsqueeze(1), token_src, state_src+    ).reshape(-1)++    # Next conv state: trailing K-1 values of each extended sequence. Extended+    # position L+c is token row e + c - (K-1) when it lands in the chunk, else+    # state row L + c of the incoming state block.+    lengths = (ends - starts).to(torch.int64)+    cols = torch.arange(win, device=device, dtype=torch.int64)+    ext_pos = lengths.unsqueeze(1) + cols.unsqueeze(0)+    state_token_src = ends.to(torch.int64).unsqueeze(1) + cols.unsqueeze(0) - win+    state_state_src = (+        total+        + torch.arange(batch_size, device=device, dtype=torch.int64).unsqueeze(1) * win+        + ext_pos+    )+    state_index = torch.where(+        ext_pos >= win, state_token_src, state_state_src+    ).reshape(-1)+    return window_index, state_index+++class ShortConvIndexCache:+    """Per-backend cache of extend gather indices, keyed on the step's shape.++    The cached tensors depend only on ``(num_tokens, kernel_size, seq_lens)``, so+    the key must pin all three. ``seq_lens`` comes from the host-side mirror the+    scheduler already fills (``ForwardBatch.extend_seq_lens_cpu``), so a lookup+    costs no device->host sync; when that mirror is absent the cache declines to+    answer and the caller rebuilds, because the device cu-seqlens cannot be+    inspected without a sync.++    Bounded because the key space is bounded in practice (chunked prefill emits+    one dominant shape, and the tail chunk a handful more); past the cap it stops+    inserting rather than evicting, so a pathological workload degrades to the+    uncached cost instead of growing without limit.+    """++    __slots__ = ("_cache", "_capacity")++    def __init__(self, capacity: int = 64) -> None:+        self._cache: dict[tuple, tuple[torch.Tensor, torch.Tensor]] = {}+        self._capacity = int(capacity)++    def get(+        self,+        query_start_loc: torch.Tensor,+        kernel_size: int,+        num_tokens: int,+        seq_lens_cpu: Optional[Sequence[int]],+    ) -> Optional[tuple[torch.Tensor, torch.Tensor]]:+        """Return cached indices for this step's shape, building them on a miss.++        Returns ``None`` when the shape cannot be keyed safely, meaning the caller+        must build the indices itself.+        """+        if seq_lens_cpu is None:+            return None+        key = (int(num_tokens), int(kernel_size), tuple(int(v) for v in seq_lens_cpu))+        hit = self._cache.get(key)+        if hit is not None:+            return hit+        built = build_short_conv_indices(query_start_loc, kernel_size, num_tokens)+        if len(self._cache) < self._capacity:+            self._cache[key] = built+        return built+++def build_short_conv_plan(+    query_start_loc: torch.Tensor,+    cache_indices: torch.Tensor,+    kernel_size: int,+    num_tokens: int,+    has_initial_state: Optional[torch.Tensor] = None,+    num_slots: Optional[int] = None,+    state_dtype: Optional[torch.dtype] = None,+    indices: Optional[tuple[torch.Tensor, torch.Tensor]] = None,+) -> ShortConvPlan:+    """Build the per-step gather plan for :func:`short_conv_extend`.++    ``query_start_loc`` is the ``(n+1,)`` cu-seqlens tensor and ``cache_indices``+    the ``(n,)`` conv-state slot ids. Everything is computed on device from+    shapes that are already known, so this adds no device->host sync.+    """+    device = query_start_loc.device+    width = int(kernel_size)+    win = width - 1+    starts = query_start_loc[:-1]+    ends = query_start_loc[1:]+    batch_size = int(starts.shape[0])+    total = int(num_tokens)++    # Slot ids may carry -1 padding rows (cuda-graph padding). Clamp them to a+    # real row so gathers stay in bounds; padded requests contribute no tokens,+    # and their state write is redirected below to a scratch row when available.+    slots = cache_indices.to(torch.int64)+    valid_slot = slots >= 0+    slots = torch.where(valid_slot, slots, torch.zeros_like(slots))+    if num_slots is not None:+        # The mamba pool over-allocates one trailing row; park padding there so a+        # padded request can never clobber a live request's state.+        scratch = torch.full_like(slots, max(int(num_slots) - 1, 0))+        slots = torch.where(valid_slot, slots, scratch)++    if indices is not None:+        window_index, state_index = indices+    else:+        window_index, state_index = build_short_conv_indices(+            query_start_loc, width, total+        )++    # A request that starts fresh must not read a previous tenant's state rows.+    # Cast to the state dtype here, not per layer: every conv layer shares one+    # state dtype, so the bool->bf16 cast is step work, not per-layer work.+    prefix_mask = None+    if has_initial_state is not None:+        prefix_mask = has_initial_state.reshape(batch_size, 1, 1)+        if state_dtype is not None:+            prefix_mask = prefix_mask.to(state_dtype)++    return ShortConvPlan(+        window_index=window_index,+        state_index=state_index,+        slots=slots,+        prefix_mask=prefix_mask,+        num_tokens=total,+        batch_size=batch_size,+        kernel_size=width,+    )+++def resolve_decode_slots(+    cache_indices: torch.Tensor, num_slots: Optional[int] = None+) -> torch.Tensor:+    """Clamp decode slot ids to a writable row (see ``build_short_conv_plan``)."""+    slots = cache_indices.to(torch.int64)+    valid = slots >= 0+    if num_slots is not None:+        scratch = torch.full_like(slots, max(int(num_slots) - 1, 0))+    else:+        scratch = torch.zeros_like(slots)+    return torch.where(valid, slots, scratch)+++def short_conv_extend(+    x: torch.Tensor,+    weight: torch.Tensor,+    bias: Optional[torch.Tensor],+    conv_state: torch.Tensor,+    plan: ShortConvPlan,+) -> torch.Tensor:+    """Varlen causal depthwise short conv over a token-major extend batch.++    ``x`` is ``(T, D)`` (token-major, as produced by the model's ``in_proj``),+    ``weight`` is ``(D, K)``, and ``conv_state`` is the layer's ``(num_slots, D,+    K-1)`` pool view, updated in place with each request's trailing ``K-1``+    tokens. Returns ``(T, D)`` in ``x``'s dtype.++    Accumulation is fp32 to match the reference CUDA kernel, which also reduces+    in fp32 before writing back bf16.+    """+    width = plan.kernel_size+    num_tokens = plan.num_tokens+    hidden = x.shape[-1]++    # Incoming state rows, flattened oldest-first per request, appended to the+    # token rows so one gather can serve both regions. The NPU conv pool is+    # already token-major ``(slots, K-1, D)``, so this is a reshape, not a copy.+    _check_state_window(conv_state, width)+    states = conv_state.index_select(0, plan.slots)+    if plan.prefix_mask is not None:+        mask = plan.prefix_mask+        if mask.dtype != states.dtype:+            mask = mask.to(states.dtype)+        states = states * mask+    src = torch.cat((x, states.reshape(-1, hidden)), dim=0)++    # (T, K, D) conv windows -> fused multiply-reduce against the cached (1, K, D)+    # fp32 taps. The window is left in its native dtype: bf16 * fp32 promotes to+    # an fp32 multiply-reduce internally, which is bit-identical to casting the+    # window first but skips materializing a (T, K, D) fp32 copy -- the single+    # largest tensor in the step.+    window = src.index_select(0, plan.window_index).view(num_tokens, width, hidden)+    out = torch.sum(window * conv_taps(weight), dim=1)+    if bias is not None:+        out = out + bias.float()+    out = out.to(x.dtype)++    # Next conv state: trailing K-1 extended positions of every request, already+    # in the pool's (K-1, D) per-slot layout.+    new_state = src.index_select(0, plan.state_index).view(+        plan.batch_size, width - 1, hidden+    )+    conv_state.index_copy_(0, plan.slots, new_state)+    return out+++def short_conv_decode(+    x: torch.Tensor,+    weight: torch.Tensor,+    bias: Optional[torch.Tensor],+    conv_state: torch.Tensor,+    slots: torch.Tensor,+) -> torch.Tensor:+    """Single-token causal depthwise short conv, one token per request.++    ``x`` is ``(n, D)``, ``weight`` ``(D, K)``, ``conv_state`` the layer's+    ``(num_slots, K-1, D)`` pool view. The state holds the previous ``K-1``+    tokens oldest-first, so the current window is ``concat(state, x)`` along the+    token axis; the window shifted by one becomes the new state. Returns+    ``(n, D)``.+    """+    _check_state_window(conv_state, weight.shape[-1])+    states = conv_state.index_select(0, slots)+    # (n, K, D): previous K-1 tokens then the current one.+    window = torch.cat((states, x.unsqueeze(1)), dim=1)+    # See short_conv_extend: fp32 taps promote the bf16 window in place.+    out = torch.sum(window * conv_taps(weight), dim=1)+    if bias is not None:+        out = out + bias.float()+    conv_state.index_copy_(0, slots, window[:, 1:])+    return out.to(x.dtype)+++def _check_state_window(conv_state: torch.Tensor, width: int) -> None:+    """Guard the ``(slots, K-1, D)`` conv-state layout these kernels assume.++    The NPU mamba pool stores conv state token-major with the channel axis last+    (``_init_npu_conv_state``), and widens the token axis by+    ``speculative_num_draft_tokens - 1`` when speculative decoding is on. These+    kernels address exactly ``K-1`` history tokens, so a widened window would+    silently mix draft slots into the history.+    """+    win = conv_state.shape[1]+    if win != width - 1:+        raise NotImplementedError(+            f"Ascend short conv expects a conv-state window of kernel_size-1="+            f"{width - 1} tokens, got {win}. A widened window (speculative "+            "decoding) needs the draft-aware state handling these kernels omit."+        )diff --git a/python/sglang/srt/layers/attention/attention_registry.py b/python/sglang/srt/layers/attention/attention_registry.pyindex 9af985d73765d55f812d40af43986ebdeb783619..4a1814cdbc5f2eb0ec6c00048eea74e4d416b7d2 100644--- a/python/sglang/srt/layers/attention/attention_registry.py+++ b/python/sglang/srt/layers/attention/attention_registry.py@@ -436,27 +436,42 @@ def attn_backend_wrapper(runner: "ModelRunner", full_attn_backend: "AttentionBac             )             if isinstance(mamba2_config(runner.model_config), short_conv_cfgs):                 if is_npu():-                    # The model conv layers call-                    # get_attn_backend().conv_state_metadata() unconditionally,-                    # but the Ascend hybrid/mamba backend has no such method.-                    # Fail here (before model execution) with a clear message-                    # rather than an AttributeError deep in the first conv layer.-                    raise NotImplementedError(-                        "Short-conv hybrid models (ZAYA1 CCA, LFM2 / LFM2-MoE) "-                        "are not yet supported on NPU: the conv-state sidecar "-                        "(ShortConvAttnBackend.conv_state_metadata) has no Ascend "-                        "implementation. Add an Ascend conv-state backend before "-                        "serving these models on NPU."+                    # Ascend has its own conv-state sidecar: neither portable+                    # conv implementation runs on NPU (the sgl_kernel op is+                    # CUDA-only, and the Triton varlen prefill kernel exceeds the+                    # 910B unified-buffer budget), so the Ascend backend also+                    # resolves the kernels and publishes them on the metadata.+                    # Only the models whose conv layer consumes that handle are+                    # wired up; the rest still fail here, before model+                    # execution, rather than deep inside the first conv layer.+                    npu_short_conv_cfgs = (Lfm2Config, Lfm2VlConfig)+                    if not isinstance(+                        mamba2_config(runner.model_config), npu_short_conv_cfgs+                    ):+                        raise NotImplementedError(+                            "This short-conv hybrid model is not yet supported "+                            "on NPU: ZAYA1 CCA (grouped conv + prev_hs lag) and "+                            "LFM2-MoE run their own conv kernels that do not "+                            "consume the Ascend conv-state handle. LFM2 / "+                            "LFM2-VL are supported."+                        )+                    from sglang.srt.hardware_backend.npu.attention.ascend_short_conv_backend import (+                        AscendShortConvAttnBackend,+                        AscendShortConvHybridAttnBackend,+                    )++                    linear_attn_backend = AscendShortConvAttnBackend(runner)+                    hybrid_backend_cls = AscendShortConvHybridAttnBackend+                else:+                    from sglang.srt.layers.attention.hybrid_linear_attn_backend import (+                        ShortConvHybridAttnBackend,+                    )+                    from sglang.srt.layers.attention.linear.short_conv_backend import (+                        ShortConvAttnBackend,                     )-                from sglang.srt.layers.attention.hybrid_linear_attn_backend import (-                    ShortConvHybridAttnBackend,-                )-                from sglang.srt.layers.attention.linear.short_conv_backend import (-                    ShortConvAttnBackend,-                ) -                linear_attn_backend = ShortConvAttnBackend(runner)-                hybrid_backend_cls = ShortConvHybridAttnBackend+                    linear_attn_backend = ShortConvAttnBackend(runner)+                    hybrid_backend_cls = ShortConvHybridAttnBackend             else:                 linear_attn_backend = Mamba2AttnBackend(runner)         elif kimi_linear_config(runner.model_config) is not None:diff --git a/python/sglang/srt/layers/attention/linear/short_conv_backend.py b/python/sglang/srt/layers/attention/linear/short_conv_backend.pyindex 42c8a51935831bcbb5a6977e90c6dbcac18bfd0c..c0d242837734116c1a571790051bd33c4cabcea9 100644--- a/python/sglang/srt/layers/attention/linear/short_conv_backend.py+++ b/python/sglang/srt/layers/attention/linear/short_conv_backend.py@@ -75,6 +75,14 @@ class ShortConvMetadata(NamedTuple):     slot_ids_cpu: Optional[List[int]] = None     # Host mirror of has_initial_state for extend host loops. None on decode.     has_prefix_cpu: Optional[List[bool]] = None+    # Device-specific step-bound conv kernels, when the device needs its own+    # implementation instead of the portable causal_conv1d pair. ``None`` on+    # CUDA, where the model calls causal_conv1d_fn / causal_conv1d_update+    # directly. Set on Ascend (AscendShortConvAttnBackend) because neither+    # portable implementation runs there -- the sgl_kernel op is CUDA-only and+    # the Triton varlen prefill kernel exceeds the 910B unified-buffer budget.+    # Exposes ``forward(x, weight, bias, conv_state)`` over token-major ``x``.+    conv_kernels: Optional[Any] = None   class ShortConvAttnBackend(MambaAttnBackendBase):diff --git a/python/sglang/srt/models/lfm2.py b/python/sglang/srt/models/lfm2.pyindex 765bc6b39dd9b9aa95784f906aa89db9f8ded0ea..5947d73cd949fcbd99a09d8cf94805ffe013945d 100644--- a/python/sglang/srt/models/lfm2.py+++ b/python/sglang/srt/models/lfm2.py@@ -279,6 +279,17 @@ class Lfm2ShortConv(nn.Module):         B_gate, C_gate, x = proj.chunk(3, dim=-1)         Bx = B_gate * x +        if meta.conv_kernels is not None:+            # Device without a working portable causal_conv1d (Ascend): the+            # backend resolved the phase and the shared per-step index plan, so+            # one call covers both prefill and decode. Token-major throughout,+            # so no transpose on either side.+            conv_out = meta.conv_kernels.forward(+                Bx, self.conv_weight, self.conv_bias, conv_state+            )+            output, _ = self.out_proj(C_gate * conv_out)+            return output+         if forward_batch.forward_mode.is_decode():             # Decode: single token per request, use optimized update kernel             conv_out = causal_conv1d_update(