GPT-6 Astra · Serving

S10 · SGLang 14B

Valid

SGLang Qwen3-14B system serving 2dev · Joint Optimization

2.64×PERFORMANCE RATIO
210TOOL 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 agentGPT-6 Astra · 210 visible calls

InspectEditValidateExecuteBuildProfileRollbackOther
124Inspect
18Edit
1Build
16Validate
11Execute
12Profile
28Other

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 timeline176 groups · 210 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 · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0001–#0001

    printf <val> <val>cat <path>
  2. Build · Task requirements

    Requested workspace inspection and source searches related to task requirements.

    1 call · #0002–#0002

    pwdrg --files -g <val> -g <path> -g <path> <path> <n> > <path>
  3. Inspect · Benchmark & validation setup

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

    1 call · #0003–#0003

    cat <path> <path> <path> <path>cat <path> <path>
  4. Inspect · Task requirements

    1 tool error

    Requested file and log inspection, source searches and repository inspection related to task requirements.

    2 calls · #0004–#0005

    cat <path> <path>rg --files <path>cat <path> <path> <path>git status --shortcat <path><command> <args>
    1 more command sketches
    printf <val> <val>
  5. Validate · Task requirements

    Requested source searches related to task requirements.

    1 call · #0006–#0006

    rg -n <val> <path>rg --files <val> -g <val> -g <val> -g <val> -g <val><command> <args>printf <val> <val>
  6. Inspect · Benchmark & validation setup

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

    1 call · #0007–#0007

    cat <path> <path> <path> <path> <path> <path>
  7. Other · Task requirements

    Requested script or workload execution related to task requirements.

    1 call · #0008–#0008

    python - <script>
  8. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0009–#0009

    sed -n <val> <path>
  9. Inspect · Task requirements

    Requested source searches related to task requirements.

    1 call · #0010–#0010

    rg -n <val> <path>rg --files <path>rg <val>
  10. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0011–#0011

    python - <script>
  11. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0012–#0012

    cat <path>
  12. Inspect · Task requirements

    1 tool error

    Requested file and log inspection related to task requirements.

    1 call · #0013–#0013

    sed -n <val> <path>tail -n <n> <path>cat <path>
  13. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0014–#0014

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

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

    1 call · #0015–#0015

    bash <script>
  15. Inspect · Benchmark & validation setup

    Requested runtime inspection, source searches and workspace inspection related to benchmark & validation setup.

    1 call · #0016–#0016

    ps <flag> <args>rg <val>ls -l <val>tail -n <n> <path>
  16. Inspect · Attention kernels

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

    1 call · #0017–#0017

    rg -n <val> <path>tail -n <n>rg --files <val>rg <val>head -n <n>
  17. Profile · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0018–#0018

    cat > <path> <script>cat <path>tail -n <n> <path>
  18. Inspect · Runtime processes

    Requested source searches and file and log inspection related to runtime processes.

    1 call · #0019–#0019

    rg -n <val> <path>rg --files <val>sortsed -n <val> <path>cat <path>
  19. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0020–#0020

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

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

    1 call · #0021–#0021

    cat <path> <n> > <path>rg -n <val> <path> <path> <path>tail -n <n>npu-smi info
  21. Inspect · Attention kernels

    Requested file and log inspection related to attention kernels.

    1 call · #0022–#0022

    sed -n <val> <path>cat <path>
  22. Inspect · Source & workspace

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

    1 call · #0023–#0023

    cat <path>rg -n <val> <path>
  23. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0024–#0024

    tail -n <n> <path>cut -c <val>cat <path>
  24. Profile · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0025–#0025

    cat > <path> <script>tail -n <n> <path>cut -c <val>
  25. Inspect · Attention kernels

    1 tool error

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

    1 call · #0026–#0026

    rg -n <val> <path>sed -n <val> <path>
  26. Inspect · Batching & scheduling

    Requested source searches and file and log inspection related to batching & scheduling.

    1 call · #0027–#0027

    rg --files <path>rg <val>rg -n <val> <path>head -n <n>tail -n <n> <path>cut -c <val>
  27. Inspect · Runtime processes

    Requested file and log inspection and source searches related to runtime processes.

    2 calls · #0028–#0029

    sed -n <val> <path>cat <path> <path>rg -n <val> <path> <path>
  28. Inspect · Attention kernels

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

    1 call · #0030–#0030

    sed -n <val> <path>cat <path>head -n <n>rg -n <val> <path>
  29. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0031–#0031

    tail -n <n> <path>cut -c <val>sed -n <val> <path>
  30. Inspect · Attention kernels

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

    2 calls · #0032–#0033

    rg -n <val> <path> <path> <path> <path> <path>head -n <n>sed -n <val> <path>rg -n <val> <path> -g <path>rg -n <val> <path> <path> -g <path>
  31. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0034–#0034

    sed -n <val> <path>tail -n <n> <path>cut -c <val>
  32. Inspect · Attention kernels

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

    4 calls · #0035–#0038

    rg -n <val> <path> <path>rg -n <val> <path>head -n <n>sed -n <val> <path>head -n <n> <path>rg -n <val> <path> -g <path>
    6 more command sketches
    python - <script>ps <flag> <args>rg <val>cut -c <val>tail -n <n> <path>cat <path>
  33. Inspect · Batching & scheduling

    Requested repository inspection, source searches and file and log inspection related to batching & scheduling.

    1 call · #0039–#0039

    git status --shortrg -n <val> <path>head -n <n>
  34. Inspect · Parallelism & communication

    Requested source searches and file and log inspection related to parallelism & communication.

    1 call · #0040–#0040

    rg --files <val>rg <val>head -n <n>rg -n <val> <path> <path> <path>
  35. Inspect · Device memory

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

    1 call · #0041–#0041

    tail -n <n> <path>cut -c <val>python - <script>
  36. Inspect · Attention kernels

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

    1 call · #0042–#0042

    rg -n <val> <path>sed -n <val> <path>rg --files <val>rg <path>head -n <n>rg <val>
    2 more command sketches
    tail -n <n> <path>cut -c <val>
  37. Inspect · Runtime processes

    Requested source searches and file and log inspection related to runtime processes.

    1 call · #0043–#0043

    rg --files <path>rg <val>head -n <n>sed -n <val> <path>tail -n <n> <path>cut -c <val>
  38. Inspect · Dependencies & build setup

    Requested file and log inspection related to dependencies & build setup.

    1 call · #0044–#0044

    sed -n <val> <path>
  39. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0045–#0045

    tail -n <n> <path>cut -c <val>
  40. Inspect · Attention kernels

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

    1 call · #0046–#0046

    sed -n <val> <path>rg -n <val> <path>head -n <n>tail -n <n> <path>cut -c <val>
  41. Inspect · Benchmark & validation setup

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

    1 call · #0047–#0047

    tail -n <n> <path>cut -c <val>ps <flag> <args>rg <val>
  42. Validate · Dependencies & build setup

    Requested environment setup or inspection related to dependencies & build setup.

    1 call · #0048–#0048

    env <vars> python -m <module> -q <script> <script>
  43. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0049–#0049

    bash <script>
  44. Other · Runtime processes

    1 tool error

    Requested script or workload execution related to runtime processes.

    1 call · #0050–#0050

    python - <script>
  45. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0051–#0051

    tail -n <n> <path>cut -c <val>
  46. Inspect · Task requirements

    1 tool error

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

    1 call · #0052–#0052

    sed -n <val> <path>ls -l <path>
  47. Inspect · Source & workspace

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

    1 call · #0053–#0053

    tail -n <n> <path>cut -c <val>test <val> -f <path>python - <script>
  48. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0054–#0054

    Apply patch <patch>
  49. Inspect · Source & workspace

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

    1 call · #0055–#0055

    git diff --checkgit status --shorttail -n <n> <path>cut -c <val>
  50. Inspect · Device memory

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

    1 call · #0056–#0056

    npu-smi infops <flag> <args>rg <val>rg -n <val> <path> <path> <path>head -n <n>
  51. Validate · Benchmark & validation setup

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

    1 call · #0057–#0057

    bash <script> > <path>bash <script>env <vars> python -m <module> --help
  52. Inspect · Source & workspace

    1 tool error

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

    1 call · #0058–#0058

    tail -n <n> <path>cut -c <val>git diff <flag> <args>
  53. Inspect · Batching & scheduling

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

    1 call · #0059–#0059

    python - <script>rg -n <val> <path> <path> <path>head -n <n>
  54. Inspect · Attention kernels

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

    1 call · #0060–#0060

    rg --files <path>cat > <path> <script>tail -n <n> <path>cut -c <val>
  55. Inspect · Runtime processes

    Requested source searches and file and log inspection related to runtime processes.

    1 call · #0061–#0061

    rg -n <val> <path> -g <val>sed -n <val> <path>
  56. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0062–#0062

    python - <script>
  57. Inspect · Source & workspace

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

    1 call · #0063–#0063

    tail -n <n> <path>cut -c <val>python - <script>
  58. Inspect · Batching & scheduling

    Requested file and log inspection related to batching & scheduling.

    1 call · #0064–#0064

    cat >> <path> <script>sed -n <val> <path>tail -n <n> <path>cut -c <val>
  59. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0065–#0065

    tail -n <n> <path>cut -c <val>
  60. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0066–#0066

    python - <script>
  61. Inspect · Source & workspace

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

    1 call · #0067–#0067

    tail -n <n> <path>cut -c <val>python - <script>
  62. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0068–#0068

    python -B <script> <path>
  63. Inspect · Source & workspace

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

    7 calls · #0069–#0075

    tail -n <n> <path>cut -c <val>cat <path>python - <script>cat > <path> <script>python -B <script> > <path> <n> >& <path>
    5 more command sketches
    rg -n <val> <path>tail -n <n>tail -c <n> <path>tr <val> <val>git diff --check
  64. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0076–#0076

    python - <script>
  65. Execute · Runtime processes

    Requested file and log inspection and script or workload execution related to runtime processes.

    1 call · #0077–#0077

    cat > <path> <script>python -B <script>
  66. Inspect · Attention kernels

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

    1 call · #0078–#0078

    sed -n <val> <path>python - <script>
  67. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0079–#0079

    Apply patch <patch>
  68. Other · Source & workspace

    Requested environment setup or inspection related to source & workspace.

    1 call · #0080–#0080

    env <vars> bash <script>
  69. Inspect · Source & workspace

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

    1 call · #0081–#0081

    cat <path>git diff --statgit diff --check
  70. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0082–#0082

    Apply patch <patch>
  71. Inspect · Source & workspace

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

    1 call · #0083–#0083

    tail -n <n> <path>git diff --check
  72. Validate · Attention kernels

    Requested environment setup or inspection related to attention kernels.

    1 call · #0084–#0084

    env <vars> python -m <module> -q <flag> <args>
  73. Execute · Runtime processes

    Requested file and log inspection related to runtime processes.

    1 call · #0085–#0085

    cat > <path> <script>tail -n <n> <path>
  74. Inspect · Attention kernels

    Requested repository inspection related to attention kernels.

    1 call · #0086–#0086

    git diff <flag> <args>
  75. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0087–#0087

    Apply patch <patch>
  76. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0088–#0088

    tail -c <n> <path>tr <val> <val>tail -n <n>
  77. Validate · Attention kernels

    Requested environment setup or inspection related to attention kernels.

    1 call · #0089–#0089

    env <vars> python -m <module> -q <flag> <args>
  78. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0090–#0090

    tail -n <n> <path>cut -c <val>
  79. Other · Runtime processes

    1 tool error

    Requested script or workload execution related to runtime processes.

    1 call · #0091–#0091

    python -B <script> <val>
  80. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0092–#0092

    tail -n <n> <path>cut -c <val>
  81. Inspect · Batching & scheduling

    Requested source searches and file and log inspection related to batching & scheduling.

    1 call · #0093–#0093

    rg -n <val> <path>tail -n <n>cat <path>head -n <n>
  82. Inspect · Device memory

    Requested runtime inspection and source searches related to device memory.

    1 call · #0094–#0094

    npu-smi infops <flag> <args>rg <val>command -v <val>
  83. Other · Source & workspace

    Requested tool activity related to source & workspace.

    1 call · #0095–#0095

    <command> <args>
  84. Inspect · Batching & scheduling

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

    1 call · #0096–#0096

    sed -n <val> <path>python - <script>
  85. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0097–#0097

    Apply patch <patch>
  86. Other · Source & workspace

    Requested environment setup or inspection related to source & workspace.

    1 call · #0098–#0098

    env <vars> bash <script>
  87. Inspect · Source & workspace

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

    3 calls · #0099–#0101

    tail -n <n> <path><command> <args>cut -c <val>git status --shortsed -n <val> <path>rg -n <val> <path> <path>
    3 more command sketches
    tail -c <n> <path>tr <val> <val>tail -n <n>
  88. Inspect · Attention kernels

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

    3 calls · #0102–#0104

    rg -n <val> <path> <path>head -n <n>sed -n <val> <path>rg -n <val> <path>tail -n <n>
  89. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    2 calls · #0105–#0106

    tail -n <n> <path>cut -c <val>
  90. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0107–#0107

    python - <script>
  91. Profile · Source & workspace

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

    1 call · #0108–#0108

    python - <script>tail -n <n> <path>cut -c <val>
  92. Validate · Attention kernels

    Requested environment setup or inspection and script or workload execution related to attention kernels.

    1 call · #0109–#0109

    env <vars> python -m <module> -q <flag> <args>python -B <script> <val>
  93. Profile · Task requirements

    Requested file and log inspection and script or workload execution related to task requirements.

    1 call · #0110–#0110

    cat > <path> <script>python -B <script>
  94. Profile · Source & workspace

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

    2 calls · #0111–#0112

    python - <script>tail -n <n> <path>cut -c <val>
  95. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0113–#0113

    Apply patch <patch>
  96. Profile · Source & workspace

    1 tool error

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

    2 calls · #0114–#0115

    python - <script>tail -n <n> <path>cut -c <val>
  97. Inspect · Parallelism & communication

    Requested file and log inspection and source searches related to parallelism & communication.

    1 call · #0116–#0116

    tail -n <n> <path>cut -c <val>rg -n <val> <path> <val> -g <path> -g <val> -g <val>head -n <n>
  98. Inspect · Source & workspace

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

    2 calls · #0117–#0118

    tail -c <n> <path>tr <val> <val>tail -n <n>tail -n <n> <path>cut -c <val>rg -n <val> <path>
    2 more command sketches
    head -n <n>sed -n <val> <path>
  99. Inspect · Attention kernels

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

    1 call · #0119–#0119

    python - <script>sed -n <val> <path>git diff --check
  100. Other · Runtime processes

    Requested environment setup or inspection and script or workload execution related to runtime processes.

    1 call · #0120–#0120

    env <vars> bash <script>python -B <script> <val>
  101. Inspect · Task requirements

    1 tool error

    Requested file and log inspection and script or workload execution related to task requirements.

    1 call · #0121–#0121

    cat > <path> <script>python -B <script> <val>
  102. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0122–#0122

    python - <script>
  103. Inspect · Source & workspace

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

    1 call · #0123–#0123

    tail -n <n> <path>cut -c <val>python - <script>
  104. Inspect · Checkpoints & weight state

    Requested workspace file updates and file and log inspection related to checkpoints & weight state.

    1 call · #0124–#0124

    mkdir -p <path>cp <path> <path> <path> <path> <path>tail -n <n> <path>cut -c <val>
  105. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0125–#0125

    Apply patch <patch>
  106. Inspect · Checkpoints & weight state

    Requested repository inspection, source searches and workspace inspection related to checkpoints & weight state.

    1 call · #0126–#0126

    git status --shortrg -n <val> <path> <path> <path> <path>ls -l <path>
  107. Inspect · Source & workspace

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

    1 call · #0127–#0127

    ls -l <path>cat <path>
  108. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0128–#0128

    cat <path>
  109. Inspect · Attention kernels

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

    1 call · #0129–#0129

    git diff --statgit diff <flag> <args>cat <path>
  110. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    2 calls · #0130–#0131

    cat <path>tail -n <n> <path>sed -n <val> <path>
  111. Inspect · Attention kernels

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

    1 call · #0132–#0132

    sed -n <val> <path>rg -n -C <n> <val> <path>
  112. Inspect · Source & workspace

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

    2 calls · #0133–#0134

    sed -n <val> <path>rg -n <val> <flag> <args>ls -l <path>tail -n <n> <path>rg -n <val> <path> <path> <path>
  113. Inspect · Attention kernels

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

    1 call · #0135–#0135

    sed -n <val> <path>rg -n <val> <path>cat <path>
  114. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0136–#0136

    python -B - <script>
  115. Inspect · Attention kernels

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

    1 call · #0137–#0137

    rg --files <path>head -n <n>sed -n <val> <path>
  116. Other · Source & workspace

    1 tool error

    Requested script or workload execution and source searches related to source & workspace.

    1 call · #0138–#0138

    python -B - <script>rg -n <val> <path> <path>
  117. Inspect · Attention kernels

    1 tool error

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

    1 call · #0139–#0139

    sed -n <val> <path>rg -n <val> <path>
  118. Edit · Attention kernels

    Requested code edits related to attention kernels.

    1 call · #0140–#0140

    Apply patch <patch>
  119. Inspect · Source & workspace

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

    1 call · #0141–#0141

    tail -n <n> <path>rg -n <val> <path>git diff --check
  120. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0142–#0142

    sed -n <val> <path>
  121. Profile · Runtime processes

    Requested file and log inspection, environment setup or inspection and script or workload execution related to runtime processes.

    1 call · #0143–#0143

    cat > <path> <script>env <vars> bash <script>python -B <script>
  122. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0144–#0144

    Apply patch <patch>
  123. Validate · Benchmark & validation setup

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

    1 call · #0145–#0145

    bash <script>
  124. Inspect · Attention kernels

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

    1 call · #0146–#0146

    ls -d <path>tail -n <n> <path>python -B - <script>
  125. Profile · Source & workspace

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

    1 call · #0147–#0147

    python -B - <script>tail -n <n> <path>
  126. Inspect · Source & workspace

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

    2 calls · #0148–#0149

    rg -n <val> <path> <path>head -n <n>sed -n <val> <path>cat <path>tail -n <n> <path>
  127. Execute · Task requirements

    Requested script or workload execution related to task requirements.

    1 call · #0150–#0150

    python -B - <script>
  128. Validate · Attention kernels

    1 tool error

    Requested environment setup or inspection related to attention kernels.

    1 call · #0151–#0151

    env <vars> python -B -m <module> -q <script> <script> <script> <script> > <path> <args>
  129. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    2 calls · #0152–#0153

    cat <path>tail -n <n> <path>sed -n <val> <path>
  130. Inspect · Attention kernels

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

    1 call · #0154–#0154

    git diff --statrg -n <val> <path> <path> <path>cat <path>sed -n <val> <path>
  131. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0155–#0155

    tail -n <n> <path>
  132. Validate · Checkpoints & weight state

    Requested script or workload execution, repository inspection and environment setup or inspection related to checkpoints & weight state.

    1 call · #0156–#0156

    python -B - <script>git diff --checkenv <vars> python -B -m <module> -q <script> <script> <script> <script> > <path> <args>
  133. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0157–#0157

    tail -n <n> <path>cat <path>
  134. Inspect · Runtime processes

    Requested script or workload execution related to runtime processes.

    1 call · #0158–#0158

    python -B - <script>
  135. Inspect · Source & workspace

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

    1 call · #0159–#0159

    tail -n <n> <path>ls <val>head -n <n>
  136. Inspect · Batching & scheduling

    Requested runtime inspection, source searches and file and log inspection related to batching & scheduling.

    1 call · #0160–#0160

    ps <flag> <args>rg <val>head -n <n>git status --short
  137. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0161–#0161

    Apply patch <patch>
  138. Inspect · Source & workspace

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

    1 call · #0162–#0162

    tail -n <n> <path>cat <path>tail -n <n>git diff --check
  139. Inspect · Attention kernels

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

    1 call · #0163–#0163

    sed -n <val> <path>git diff --numstatpython -B - <script>
  140. Inspect · Source & workspace

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

    1 call · #0164–#0164

    tail -n <n> <path>ls -l <path>
  141. Other · Attention kernels

    Requested script or workload execution related to attention kernels.

    1 call · #0165–#0165

    python -B - <script>
  142. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0166–#0166

    tail -n <n> <path>
  143. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0167–#0167

    python -B - <script>
  144. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0168–#0168

    tail -n <n> <path>cat <path>
  145. Inspect · Attention kernels

    Requested workspace inspection related to attention kernels.

    1 call · #0169–#0169

    stat -c <val> <path> <path> <path> <path> <path>
  146. Other · Attention kernels

    Requested workspace file updates related to attention kernels.

    1 call · #0170–#0170

    chmod <n> <path> <path> <path> <path> <path> <path>
  147. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0171–#0171

    tail -n <n> <path>
  148. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0172–#0172

    python -B - <script>
  149. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0173–#0173

    Apply patch <patch>
  150. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0174–#0174

    tail -n <n> <path>cat <path>
  151. Inspect · Runtime processes

    Requested source searches and file and log inspection related to runtime processes.

    1 call · #0175–#0175

    rg -n <val> <path>sed -n <val> <path>
  152. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0176–#0176

    tail -n <n> <path>cat <path>
  153. Other · Runtime processes

    Requested script or workload execution related to runtime processes.

    1 call · #0177–#0177

    python -B <script> <val> > <path> <n> >& <path>
  154. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0178–#0178

    python -B <script> <val> > <path> <n> >& <path>
  155. Inspect · Source & workspace

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

    1 call · #0179–#0179

    cat <path>ls -l <path>
  156. Validate · Benchmark & validation setup

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

    1 call · #0180–#0180

    python -B - <script>cat <path>tail -n <n> <path>
  157. Profile · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0181–#0181

    python -B - <script>
  158. Edit · Source & workspace

    Requested code edits related to source & workspace.

    2 calls · #0182–#0183

    Apply patch <patch>
  159. Inspect · Benchmark & validation setup

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

    1 call · #0184–#0184

    tail -n <n> <path>git diff --checkgit status --short
  160. Inspect · Source & workspace

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

    1 call · #0185–#0185

    python -B - <script>git rev-parse <val>
  161. Validate · Benchmark & validation setup

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

    1 call · #0186–#0186

    tail -n <n> <path>python -B - <script>
  162. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0187–#0187

    Apply patch <patch>
  163. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0188–#0188

    python -B - <script>
  164. Validate · Benchmark & validation setup

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

    2 calls · #0189–#0190

    env <vars> bash <script> > <path> <n> >& <path>bash <script> > <path> <n> >& <path>tail -n <n> <path>python -B - <script>
  165. Execute · Benchmark & validation setup

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

    1 call · #0191–#0191

    python -B - <script>
  166. Inspect · Runtime processes

    Requested script or workload execution related to runtime processes.

    1 call · #0192–#0192

    python -B - <script>
  167. Execute · Benchmark & validation setup

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

    1 call · #0193–#0193

    python -B - <script>
  168. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    2 calls · #0194–#0195

    python -B - <script>
  169. Edit · Source & workspace

    Requested code edits related to source & workspace.

    3 calls · #0196–#0198

    Apply patch <patch>
  170. Execute · Benchmark & validation setup

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

    6 calls · #0199–#0204

    python -B - <script>env <vars> bash <script> > <path> <n> >& <path>
  171. Validate · Benchmark & validation setup

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

    1 call · #0205–#0205

    python -B - <script>
  172. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0206–#0206

    bash <script> > <path> <n> >& <path>
  173. Profile · Attention kernels

    Requested script or workload execution related to attention kernels.

    1 call · #0207–#0207

    python -B - <script>
  174. Edit · Source & workspace

    Requested code edits related to source & workspace.

    1 call · #0208–#0208

    Apply patch <patch>
  175. Other · Device memory

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

    1 call · #0209–#0209

    python -B - <script>git diff --checknpu-smi infocat <path>
  176. Validate · Benchmark & validation setup

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

    1 call · #0210–#0210

    git status --shortgit diff --checkpython -B - <script>

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 · 10 changed files

Base commit: 340db9201005fc64635bb25db1d2538f955761c3

diff --git a/python/sglang/srt/deployment/README.md b/python/sglang/srt/deployment/README.mdnew file mode 100644index 0000000000000000000000000000000000000000..0d62b8c90cf92193fc74ab75c181002aa36214d5--- /dev/null+++ b/python/sglang/srt/deployment/README.md@@ -0,0 +1,84 @@+The Qwen3-14B entrypoint improves aggregate request throughput by 2.67 times+in the task-owned measurement. It runs the standard SGLang HTTP server on+two Ascend 910B devices with BF16 weights and TP=2. It accepts the supervisor's+model, tokenizer, served name, address, device IDs, and runtime directory.+It writes the resolved execution plan into that directory, then uses `exec`+so the supervisor retains ownership of the server's PID and process group.++The main bottleneck was eager decode dispatch: batches of 32 produced roughly+375 tokens/s despite spare NPU capacity. Full decode graphs remove much of+that dispatch overhead. The entrypoint captures every batch size from 1 to+32, keeping the eager path's matrix shapes when requests finish. Prefill,+FCFS scheduling, the 32,768-token KV pool, context length, seed, and disabled+radix cache retain the reference settings.++Ascend's existing graph path uses fused infer attention, whose BF16 rounding+can change greedy completions relative to eager paged attention. The opt-in+`SGLANG_NPU_PAGED_ATTENTION_GRAPH` path captures `_npu_paged_attention` itself.+Graph replay updates its CPU int32 `context_lens` binding. Dummy sequences+use length 1, and the device-to-host length synchronization is retained to+order replay after work on the overlap stream. The option defaults off for+other deployments and excludes speculative, diffusion, MLA, sliding-window,+encoder-decoder, and compiled configurations.++On the supplied formal workloads, complete runs measured:++| Configuration | Mixed requests/s | Balanced requests/s | Geometric mean |+| --- | ---: | ---: | ---: |+| Reference eager | 0.9227 | 1.3862 | 1.1310 |+| Reference eager repeat | 0.9368 | 1.3755 | 1.1351 |+| Paged-attention graphs | 2.1134 | 4.3988 | 3.0490 |+| Paged-attention graphs repeat | 2.0395 | 4.1596 | 2.9126 |+| Task-owned graph measurement | 2.0680 | 4.4028 | 3.0174 |++These are host-observed complete-request rates with the task's disjoint+warmups and concurrency 32. Each profile completed all 256 requests, with+the original input/output token counts and finite output log probabilities.+The graph runs improve the equal-weight aggregate by 2.58 to 2.70 times over+the first reference run. Startup and graph capture are outside the task's+throughput timing boundary.++The eight formal HTTP cases (22 responses) matched their declared token and+response projections against the full reference responses saved before+editing. The final replay also matched the complete text and every output+token ID in all 22 responses. The regression tests check bitwise attention+parity over changing page tables and sequence lengths, graph-update+synchronization, device limits, and the supervisor ABI. The two new test+modules and 39 upstream graph setup/buffer tests passed together (43 tests).+The complete shortest probe is preserved in+[the S1 evidence file](../../test/ascend/evidence/qwen3_14b_s1.json).+OpenAI completions also passed text, finish-reason, token-usage, and streaming+parity checks. Peak sampled HBM in the public measurement was 22,644/22,579 MiB+on the two 65,536 MiB devices, and supervisor cleanup released the service port.+The task's describe, smoke, correctness, measurement, and cleanup commands+all passed. The measurement passed its JSON schema and all five runtime+gates. The [validation report](../../test/ascend/evidence/qwen3_14b_validation.json)+preserves the task-owned result, reference metrics, source hashes, and+semantic comparisons.++The concurrent performance streams do not have a stable token digest even+under the reference deployment: two eager runs differed in 33/256 mixed+and 1/256 balanced projected sequences. Graph runs also differ on these+streams. This is a limitation of whole-stream equivalence evidence;+the formal HTTP cases and operator comparisons are checked independently.+No request work, seeds, precision, or sampling parameters are changed to+accommodate these differences.++Validation uses the task's `describe.sh`, `smoke.sh`, `correctness.sh`,+`benchmark_once.sh`, and `cleanup.sh`. For the measurement, point+`TASK_EXTERNAL_INPUT_ROOT` at a directory containing the unchanged formal+`performance.json` under the manifest name+`sglang-qwen3-14b-performance.json`. The expected SHA-256 is+`f930c614d3ac00640f264fffd60e5fe1a8c638d13bb91a110ad5f28ebdbb23fa`.+No native operator sources or installed packages are changed, so the task's+candidate build reports a successful skip.++Run the focused and upstream regression tests from the source root:++```sh+ASCEND_RT_VISIBLE_DEVICES=0,1 PYTHONDONTWRITEBYTECODE=1 python -B -m pytest -q \+  python/sglang/test/ascend/test_paged_attention_graph.py \+  python/sglang/test/ascend/test_qwen3_14b_deployment.py \+  test/registered/unit/model_executor/model_runner_components/test_cuda_graph_setup.py \+  test/registered/unit/model_executor/test_cuda_graph_buffer_registry.py+```diff --git a/python/sglang/srt/deployment/__init__.py b/python/sglang/srt/deployment/__init__.pynew file mode 100644index 0000000000000000000000000000000000000000..e31a7fa80862b9426ae301112279487da6aa9a32--- /dev/null+++ b/python/sglang/srt/deployment/__init__.py@@ -0,0 +1 @@+"""Model-specific serving deployment entrypoints."""diff --git a/python/sglang/srt/deployment/qwen3_14b.py b/python/sglang/srt/deployment/qwen3_14b.pynew file mode 100644index 0000000000000000000000000000000000000000..b2afe7772eee3c2b952ed65feb433cca8c5f3e7d--- /dev/null+++ b/python/sglang/srt/deployment/qwen3_14b.py@@ -0,0 +1,127 @@+"""Serve BF16 Qwen3-14B on two Ascend 910B devices.++The entrypoint accepts the deployment supervisor's outer ABI and execs the+standard SGLang HTTP server. Keeping the supervisor's PID and process group+lets its normal shutdown path own every server worker.+"""++import argparse+import json+import os+import sys+from pathlib import Path+++def device_ids(value: str) -> tuple[int, int]:+    try:+        devices = tuple(int(item) for item in value.split(","))+    except ValueError as exc:+        raise argparse.ArgumentTypeError("device IDs must be integers") from exc+    if len(devices) != 2 or len(set(devices)) != 2 or min(devices) < 0:+        raise argparse.ArgumentTypeError(+            "two distinct nonnegative device IDs are required"+        )+    return devices+++def parse_args(argv=None):+    parser = argparse.ArgumentParser(description=__doc__)+    parser.add_argument("--model-path", required=True)+    parser.add_argument("--tokenizer-path", required=True)+    parser.add_argument("--served-model-name", required=True)+    parser.add_argument("--host", default="127.0.0.1")+    parser.add_argument("--port", type=int, required=True)+    parser.add_argument("--device-ids", type=device_ids, required=True)+    parser.add_argument("--runtime-dir", type=Path, required=True)+    args = parser.parse_args(argv)+    if not 1 <= args.port <= 65535:+        parser.error("port must be between 1 and 65535")+    return args+++def server_argv(args) -> list[str]:+    return [+        sys.executable,+        "-B",+        "-m",+        "sglang.launch_server",+        "--model-path",+        args.model_path,+        "--tokenizer-path",+        args.tokenizer_path,+        "--served-model-name",+        args.served_model_name,+        "--host",+        args.host,+        "--port",+        str(args.port),+        "--dtype",+        "bfloat16",+        "--context-length",+        "4096",+        "--random-seed",+        "20260819",+        "--tp-size",+        "2",+        "--dp-size",+        "1",+        "--pp-size",+        "1",+        "--schedule-policy",+        "fcfs",+        "--chunked-prefill-size",+        "8192",+        "--max-running-requests",+        "32",+        "--max-total-tokens",+        "32768",+        "--mem-fraction-static",+        "0.8",+        "--disable-radix-cache",+        "--cuda-graph-backend-decode",+        "full",+        "--cuda-graph-max-bs-decode",+        "32",+        # Capture exact batch sizes, avoiding padded GEMMs for the tail of a+        # batch and preserving the eager path's matrix shapes.+        "--cuda-graph-bs-decode",+        *(str(size) for size in range(1, 33)),+        "--cuda-graph-backend-prefill",+        "disabled",+        "--cuda-graph-max-bs-prefill",+        "32",+        "--attention-backend",+        "ascend",+        "--device",+        "npu",+    ]+++def main(argv=None) -> None:+    args = parse_args(argv)+    environment = dict(os.environ)+    environment["ASCEND_RT_VISIBLE_DEVICES"] = ",".join(map(str, args.device_ids))+    defaults = {+        "HCCL_OP_EXPANSION_MODE": "AIV",+        "HCCL_BUFFSIZE": "200",+        "SGLANG_ENABLE_OVERLAP_PLAN_STREAM": "1",+        "SGLANG_NPU_PAGED_ATTENTION_GRAPH": "1",+        "PYTORCH_NPU_ALLOC_CONF": "expandable_segments:True",+    }+    for name, value in defaults.items():+        environment.setdefault(name, value)+    command = server_argv(args)+    plan = {+        "argv": command,+        "device_ids": args.device_ids,+        "environment": {name: environment[name] for name in defaults},+    }+    runtime_dir = args.runtime_dir.resolve(strict=True)+    temporary = runtime_dir / "qwen3-14b-plan.json.tmp"+    temporary.write_text(json.dumps(plan, indent=2) + "\n", encoding="utf-8")+    temporary.replace(runtime_dir / "qwen3-14b-plan.json")+    os.execvpe(command[0], command, environment)+++if __name__ == "__main__":+    main()diff --git a/python/sglang/srt/environ.py b/python/sglang/srt/environ.pyindex 81cbfc18ddf28f9cf3d458c4f141f9ec1c9ac66a..c460777650a3484b602f122e27f9c1a9ce8c6ab3 100644--- a/python/sglang/srt/environ.py+++ b/python/sglang/srt/environ.py@@ -634,6 +634,9 @@ class Envs:     SGLANG_NPU_DISABLE_ACL_FORMAT_WEIGHT = EnvBool(False)     SGLANG_NPU_USE_MULTI_STREAM = EnvBool(False)     SGLANG_NPU_USE_MLAPO = EnvBool(False)+    # Keep the eager paged-attention operator in non-speculative MHA graphs.+    # Requires torch_npu's NPUGraph handler for _npu_paged_attention.+    SGLANG_NPU_PAGED_ATTENTION_GRAPH = EnvBool(False)     # Forward native implementation for activation gelu tanh for model Skywork-Reward-Gemma-2-27B-v0.2     SGLANG_NPU_FORWARD_NATIVE_GELUTANH = EnvBool(False)     # Forward native implementation for gemma rms norm for model Skywork-Reward-Gemma-2-27B-v0.2diff --git a/python/sglang/srt/hardware_backend/npu/attention/ascend_backend.py b/python/sglang/srt/hardware_backend/npu/attention/ascend_backend.pyindex 89e9de06db1cb0350cb55b83dbaffc15c100fff9..47041740942c12b48f4bce5889ab6b22dd4991cc 100644--- a/python/sglang/srt/hardware_backend/npu/attention/ascend_backend.py+++ b/python/sglang/srt/hardware_backend/npu/attention/ascend_backend.py@@ -12,6 +12,7 @@ from sgl_kernel_npu.attention.sinks_attention import (  from sglang.srt.configs.model_config import AttentionArch from sglang.srt.dllm.config import DllmConfig+from sglang.srt.environ import envs from sglang.srt.hardware_backend.npu.attention.ascend_torch_native_backend import (     AscendTorchNativeAttnBackend, )@@ -358,6 +359,21 @@ class AscendAttnBackend(AttentionBackend):             isinstance(self.token_to_kv_pool, SWAKVPool)             and self.token_to_kv_pool.swa_layer_nums > 0         )+        # FIA and paged attention can round differently in BF16. Opt in to+        # capturing the same operator used by eager dense decoding when the+        # runtime supports its CPU context_lens update handler.+        self.use_paged_attention_graph = (+            envs.SGLANG_NPU_PAGED_ATTENTION_GRAPH.get()+            and not self.use_mla+            and not self.use_fia+            and not self.use_fa+            and not self.use_alibi+            and not self.is_hybrid_swa+            and not model_runner.model_config.is_encoder_decoder+            and not model_runner.spec_algorithm.is_speculative()+            and model_runner.server_args.dllm_algorithm is None+            and not self.enable_torch_compile+        )          # head num padding         self.padding_size_list = [1, 2, 4, 8, 16, 32, 64, 128]@@ -614,6 +630,10 @@ class AscendAttnBackend(AttentionBackend):             num_tokens = out_cache_loc.shape[0]             metadata.swa_out_cache_loc = self.swa_out_cache_loc_buf[:num_tokens]         metadata.seq_lens_cpu_list = seq_lens.cpu().int().tolist()+        if self.use_paged_attention_graph:+            metadata.seq_lens_cpu_int = torch.tensor(+                metadata.seq_lens_cpu_list, dtype=torch.int32, device="cpu"+            )         metadata.seq_lens = seq_lens         if forward_mode.is_target_verify() or forward_mode.is_draft_extend_v2():             metadata.actual_seq_lengths_q = torch.arange(@@ -758,7 +778,7 @@ class AscendAttnBackend(AttentionBackend):         return torch.cat([topk_indices, padding], dim=0)      def get_cuda_graph_seq_len_fill_value(self):-        return 0+        return 1 if self.use_paged_attention_graph else 0      def _generate_alibi_bias(         self,@@ -2328,6 +2348,25 @@ class AscendAttnBackend(AttentionBackend):         if not self.use_mla:             seq_lens_cpu_int = self.forward_metadata.seq_lens_cpu_int             seq_lens_cpu_list = self.forward_metadata.seq_lens_cpu_list+            if self.use_paged_attention_graph:+                query = q.reshape(-1, layer.tp_q_head_num, layer.qk_head_dim)+                output = torch.empty(+                    (query.shape[0], layer.tp_q_head_num, layer.v_head_dim),+                    dtype=query.dtype,+                    device=query.device,+                )+                torch_npu._npu_paged_attention(+                    query=query,+                    key_cache=self.token_to_kv_pool.get_key_buffer(layer.layer_id),+                    value_cache=self.token_to_kv_pool.get_value_buffer(layer.layer_id),+                    num_heads=layer.tp_q_head_num,+                    num_kv_heads=layer.tp_k_head_num,+                    scale_value=layer.scaling,+                    block_table=self.forward_metadata.block_tables,+                    context_lens=seq_lens_cpu_int,+                    out=output,+                )+                return output.view(-1, layer.tp_q_head_num * layer.v_head_dim)             if self._is_swa_layer(layer):                 # CUDA/NPU graph capture uses seq_len fill value 0 on Ascend.                 # Avoid dynamic window block-table construction during capture,diff --git a/python/sglang/srt/hardware_backend/npu/graph_runner/npu_graph_runner.py b/python/sglang/srt/hardware_backend/npu/graph_runner/npu_graph_runner.pyindex b82c973bc340c072ea79877ef4a0d183bd6af32d..17fa974c967fae995845290dc1a828d9bc51c1c0 100644--- a/python/sglang/srt/hardware_backend/npu/graph_runner/npu_graph_runner.py+++ b/python/sglang/srt/hardware_backend/npu/graph_runner/npu_graph_runner.py@@ -158,11 +158,15 @@ class NPUGraphRunner(DecodeCudaGraphRunner):         return out      def _get_update_attr_name(self):+        if getattr(self.attn_backend, "use_paged_attention_graph", False):+            return self.attr_name[AttentionArch.MHA]         if self.if_use_v2:             return self.attr_name["TARGET_VERIFY"]         return self.attr_name[AttentionArch.MLA]      def _get_update_attr_type(self):+        if getattr(self.attn_backend, "use_paged_attention_graph", False):+            return self.attr_type[AttentionArch.MHA]         if self.if_use_v2:             return self.attr_type["TARGET_VERIFY"]         return self.attr_type[AttentionArch.MLA]@@ -241,11 +245,13 @@ class NPUGraphRunner(DecodeCudaGraphRunner):         ):             if forward_batch.forward_mode.is_target_verify():                 seq_lens_cpu = forward_batch.seq_lens.cpu() + self.captured_req_width-                seq_lens = seq_lens_cpu.tolist() + [0] * (self.bs - self.raw_bs)             else:-                seq_lens = forward_batch.seq_lens.cpu().tolist() + [0] * (-                    self.bs - self.raw_bs-                )+                # This also orders graph updates after work on the plan stream.+                # The CPU mirror alone does not provide that synchronization.+                seq_lens_cpu = forward_batch.seq_lens.cpu()+            seq_lens = seq_lens_cpu.tolist() + [self.seq_len_fill_value] * (+                self.bs - self.raw_bs+            )             output = self.backend.replay_with_input_update(                 graph_key,                 seq_lens=seq_lens,diff --git a/python/sglang/test/ascend/evidence/qwen3_14b_s1.json b/python/sglang/test/ascend/evidence/qwen3_14b_s1.jsonnew file mode 100644index 0000000000000000000000000000000000000000..ad4baab660c558ccdaed063c77ebd1d45fb6c6da--- /dev/null+++ b/python/sglang/test/ascend/evidence/qwen3_14b_s1.json@@ -0,0 +1,334 @@+{+  "description": "Full shortest formal semantic probe, saved before edits and replayed with paged-attention graphs. Validation evidence only; serving code does not read this file.",+  "case": {+    "concurrency": 1,+    "id": "S1",+    "path": "/generate",+    "requests": [+      {+        "return_logprob": true,+        "sampling_params": {+          "ignore_eos": true,+          "max_new_tokens": 16,+          "temperature": 0.0+        },+        "text": "Independent validation case S1-0. Analyze the following engineering observations. Produce a detailed, non-repetitive report that compares explanations, identifies risks, and gives a staged validation plan. Continue the analysis until the requested response limit.\nEvidence S1-0-0001: at minute 251, the graph executor processed 808 operations and health signals stabilized. Trace group 400326 was independently reviewed.\nEvidence S1-0-0002: at minute 860, the router processed 817 operations and queue depth changed. Trace group 976815 was independently reviewed.\nEvidence S1-0-0003: at minute 20, the graph executor processed 1934 operations and batch sizes shifted. Trace group 431540 was independently reviewed.\nEvidence S1-0-0004: at minute 664, the request queue processed 1156 operations and batch sizes shifted. Trace group 853627 was independently reviewed.",+        "top_logprobs_num": 0+      }+    ],+    "response_projection": [+      {+        "pointer": "/meta_info/prompt_tokens"+      },+      {+        "pointer": "/meta_info/completion_tokens"+      },+      {+        "list_item_index": 1,+        "pointer": "/meta_info/output_token_logprobs"+      }+    ]+  },+  "reference": {+    "responses": [+      {+        "text": " \nEvidence S1-0-0005: at minute 1",+        "output_ids": [+          715,+          92602,+          328,+          16,+          12,+          15,+          12,+          15,+          15,+          15,+          20,+          25,+          518,+          9383,+          220,+          16+        ],+        "meta_info": {+          "id": "82c733b18f9443ae82e3d531d904cf06",+          "finish_reason": {+            "type": "length",+            "length": 16+          },+          "prompt_tokens": 227,+          "weight_version": "default",+          "num_retractions": 0,+          "input_token_logprobs": [],+          "output_token_logprobs": [+            [+              -0.9477066397666931,+              715,+              null+            ],+            [+              -0.1592065542936325,+              92602,+              null+            ],+            [+              -0.0019574069883674383,+              328,+              null+            ],+            [+              -2.145764938177308e-06,+              16,+              null+            ],+            [+              -7.748303323751315e-05,+              12,+              null+            ],+            [+              -0.00010048838157672435,+              15,+              null+            ],+            [+              -9.298280929215252e-06,+              12,+              null+            ],+            [+              -0.00017629499780014157,+              15,+              null+            ],+            [+              -1.2040065485052764e-05,+              15,+              null+            ],+            [+              -0.0003409996279515326,+              15,+              null+            ],+            [+              -0.004869387950748205,+              20,+              null+            ],+            [+              -0.00043478095903992653,+              25,+              null+            ],+            [+              -0.2114393562078476,+              518,+              null+            ],+            [+              -0.002964271232485771,+              9383,+              null+            ],+            [+              -0.00014637828280683607,+              220,+              null+            ],+            [+              -1.5610003471374512,+              16,+              null+            ]+          ],+          "output_token_logprobs_length": 16,+          "reasoning_tokens": 0,+          "completion_tokens": 16,+          "cached_tokens": 0,+          "cached_tokens_details": null,+          "dp_rank": null,+          "e2e_latency": 4.4622385781258345,+          "response_sent_to_client_ts": 1789354921.0543354+        }+      }+    ],+    "projection": [+      [+        227,+        16,+        [+          715,+          92602,+          328,+          16,+          12,+          15,+          12,+          15,+          15,+          15,+          20,+          25,+          518,+          9383,+          220,+          16+        ]+      ]+    ],+    "duration_s": 4.476208289153874+  },+  "candidate": {+    "responses": [+      {+        "text": " \nEvidence S1-0-0005: at minute 1",+        "output_ids": [+          715,+          92602,+          328,+          16,+          12,+          15,+          12,+          15,+          15,+          15,+          20,+          25,+          518,+          9383,+          220,+          16+        ],+        "meta_info": {+          "id": "4b134b51794c425eb72c0731e7f7eddc",+          "finish_reason": {+            "type": "length",+            "length": 16+          },+          "prompt_tokens": 227,+          "weight_version": "default",+          "num_retractions": 0,+          "input_token_logprobs": [],+          "output_token_logprobs": [+            [+              -0.9477066397666931,+              715,+              null+            ],+            [+              -0.1592065542936325,+              92602,+              null+            ],+            [+              -0.0019574069883674383,+              328,+              null+            ],+            [+              -2.145764938177308e-06,+              16,+              null+            ],+            [+              -7.748303323751315e-05,+              12,+              null+            ],+            [+              -0.00010048838157672435,+              15,+              null+            ],+            [+              -9.298280929215252e-06,+              12,+              null+            ],+            [+              -0.00017629499780014157,+              15,+              null+            ],+            [+              -1.2040065485052764e-05,+              15,+              null+            ],+            [+              -0.0003409996279515326,+              15,+              null+            ],+            [+              -0.004869387950748205,+              20,+              null+            ],+            [+              -0.00043478095903992653,+              25,+              null+            ],+            [+              -0.2114393562078476,+              518,+              null+            ],+            [+              -0.002964271232485771,+              9383,+              null+            ],+            [+              -0.00014637828280683607,+              220,+              null+            ],+            [+              -1.5610003471374512,+              16,+              null+            ]+          ],+          "output_token_logprobs_length": 16,+          "reasoning_tokens": 0,+          "completion_tokens": 16,+          "cached_tokens": 0,+          "cached_tokens_details": null,+          "dp_rank": null,+          "e2e_latency": 3.3284765910357237,+          "response_sent_to_client_ts": 1789359181.8909254+        }+      }+    ],+    "projection": [+      [+        227,+        16,+        [+          715,+          92602,+          328,+          16,+          12,+          15,+          12,+          15,+          15,+          15,+          20,+          25,+          518,+          9383,+          220,+          16+        ]+      ]+    ],+    "duration_s": 3.342400101944804+  }+}diff --git a/python/sglang/test/ascend/evidence/qwen3_14b_validation.json b/python/sglang/test/ascend/evidence/qwen3_14b_validation.jsonnew file mode 100644index 0000000000000000000000000000000000000000..3417e466453488c961c581ebc324291704a0cdc9--- /dev/null+++ b/python/sglang/test/ascend/evidence/qwen3_14b_validation.json@@ -0,0 +1,481 @@+{+  "kind": "qwen3_14b_deployment_validation",+  "runtime_id": "sglang_ascend_910b1_v0517_snapshot",+  "reference_source_revision": "340db9201005fc64635bb25db1d2538f955761c3",+  "source_sha256": {+    "python/sglang/srt/deployment/__init__.py": "sha256:3efb1efec8de4a49c07b7142e928708abd379072b10dc774790d5213b21d2210",+    "python/sglang/srt/deployment/qwen3_14b.py": "sha256:b435b637c59a8947bd8770240c2d0beaf578ef8f71dc94d0fbccfcf5bceaedc1",+    "python/sglang/srt/environ.py": "sha256:74ccceb7b9a3f933df070d9656c5f2b4a07252670299d77c83293212de1bb4fe",+    "python/sglang/srt/hardware_backend/npu/attention/ascend_backend.py": "sha256:edfce910ac12ed6a32ea8b5394100bae64ae1ee93107d05efda0a74cf7df1528",+    "python/sglang/srt/hardware_backend/npu/graph_runner/npu_graph_runner.py": "sha256:da906c751684d46147b416ded3a1ce7d42c815c690931ea259e47e7583e49a5f",+    "python/sglang/test/ascend/test_paged_attention_graph.py": "sha256:890235c188427f9bfa70ee1cdd06d001988c80fddf0cedf53a6c544d207b5e06",+    "python/sglang/test/ascend/test_qwen3_14b_deployment.py": "sha256:4a889c276672bdb8d75c3d56f0322be6d3fe0a578f1b269386e7c9ed56c60141"+  },+  "formal_input_sha256": "sha256:f930c614d3ac00640f264fffd60e5fe1a8c638d13bb91a110ad5f28ebdbb23fa",+  "http_cases_sha256": "sha256:fb946020d117deeacdb799f9ae56f1fde2c0141f437a55125dbc5d407fa8ce38",+  "runs": {+    "reference": {+      "profiles": {+        "mixed": {+          "completed": 256,+          "duration_s": 277.4347302131355,+          "request_throughput": 0.9227395568079435,+          "total_input_tokens": 278528,+          "total_output_tokens": 73728,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:725dc6f447e5dcc3f6e2b3f2c1edfd75f925fb86ec2b3d07477187518fcb7d2b",+          "validation_projection_digest": "sha256:c771c138a94ff891291f9c99a952c14831494093df52a4323a8822b94c89c9c2"+        },+        "balanced": {+          "completed": 256,+          "duration_s": 184.67550788726658,+          "request_throughput": 1.3862152211124432,+          "total_input_tokens": 131072,+          "total_output_tokens": 65536,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:e0912cae7df7ea0ea58373b9686f2ee8261171d9944c328afac503664c7d2efd",+          "validation_projection_digest": "sha256:af376f1d876b11b0d9301d00c587ad5e9a76388616ff046ea980a5720959cfb0"+        }+      },+      "hbm": {+        "available": true,+        "sample_count": 453,+        "devices": [+          {+            "logical_device": 0,+            "peak_used_mib": 22167,+            "total_mib": 65536+          },+          {+            "logical_device": 1,+            "peak_used_mib": 22099,+            "total_mib": 65536+          }+        ],+        "errors": []+      }+    },+    "reference_repeat": {+      "profiles": {+        "mixed": {+          "completed": 256,+          "duration_s": 273.277028108947,+          "request_throughput": 0.936778337248094,+          "total_input_tokens": 278528,+          "total_output_tokens": 73728,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:5af574961e3830415fb0fdc285b3a2ba1c8f7990e413ab41ab54ac9b4a3860ac",+          "validation_projection_digest": "sha256:02df133491d8eb355b8eb64658f14d49e9652db994ccf24a6bc7eaafc8c55f15"+        },+        "balanced": {+          "completed": 256,+          "duration_s": 186.1105387629941,+          "request_throughput": 1.3755266182212706,+          "total_input_tokens": 131072,+          "total_output_tokens": 65536,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:151edd3b859439ee6182b48a14f882b934c1a9e1f8c3889883a6bc33e9d5bfcb",+          "validation_projection_digest": "sha256:9f7ceab5dfed0b6d7faf3ad7b947275438d6ca6c69e11f12669647cc1d26ae1e"+        }+      },+      "hbm": {+        "available": true,+        "sample_count": 448,+        "devices": [+          {+            "logical_device": 0,+            "peak_used_mib": 23122,+            "total_mib": 65536+          },+          {+            "logical_device": 1,+            "peak_used_mib": 22102,+            "total_mib": 65536+          }+        ],+        "errors": []+      }+    },+    "candidate": {+      "profiles": {+        "mixed": {+          "completed": 256,+          "duration_s": 121.13459606468678,+          "request_throughput": 2.113351662668641,+          "total_input_tokens": 278528,+          "total_output_tokens": 73728,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:9a8db13476e7caffde83ec23c6de047fabd6ba14d09fa2b32d2832d6ffd25959",+          "validation_projection_digest": "sha256:f983093524ae575e7a0eed05d3d2ae8b56c2a71b5d777e10dc69c899c14d330f"+        },+        "balanced": {+          "completed": 256,+          "duration_s": 58.19802371971309,+          "request_throughput": 4.398774797455649,+          "total_input_tokens": 131072,+          "total_output_tokens": 65536,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:9cfd6a752e6912b1cc81b6fa292ab9a6268395ef5310357cb49d3bebbe183ded",+          "validation_projection_digest": "sha256:af376f1d876b11b0d9301d00c587ad5e9a76388616ff046ea980a5720959cfb0"+        }+      },+      "hbm": {+        "available": true,+        "sample_count": 176,+        "devices": [+          {+            "logical_device": 0,+            "peak_used_mib": 22643,+            "total_mib": 65536+          },+          {+            "logical_device": 1,+            "peak_used_mib": 22577,+            "total_mib": 65536+          }+        ],+        "errors": []+      }+    },+    "candidate_repeat": {+      "profiles": {+        "mixed": {+          "completed": 256,+          "duration_s": 125.52380585949868,+          "request_throughput": 2.0394537772902295,+          "total_input_tokens": 278528,+          "total_output_tokens": 73728,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:8d90c095611cbc53c8d068ddde0caf4bd94dbd5b4ed834b93f93e3a38a0ab876",+          "validation_projection_digest": "sha256:b054fd067722b0b3eabd660d7f1b2e93c086f12a550de052dfec8046805ce531"+        },+        "balanced": {+          "completed": 256,+          "duration_s": 61.54367626365274,+          "request_throughput": 4.159647514446448,+          "total_input_tokens": 131072,+          "total_output_tokens": 65536,+          "lengths_valid": true,+          "logprobs_finite": true,+          "output_digest": "sha256:5ceef2842314822cb9982c5aa0958c29e548ac1b02cf40df52bbb51ef1595ab5",+          "validation_projection_digest": "sha256:cf6ed4ec89ce099680530f7738cc42a388e101378002444a1322c615e9947aad"+        }+      },+      "hbm": {+        "available": true,+        "sample_count": 184,+        "devices": [+          {+            "logical_device": 0,+            "peak_used_mib": 22644,+            "total_mib": 65536+          },+          {+            "logical_device": 1,+            "peak_used_mib": 22580,+            "total_mib": 65536+          }+        ],+        "errors": []+      }+    }+  },+  "formal_correctness": {+    "S1": {+      "responses": 1,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    },+    "S2": {+      "responses": 1,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    },+    "S3": {+      "responses": 1,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    },+    "S4": {+      "responses": 1,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    },+    "B1": {+      "responses": 4,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    },+    "B2": {+      "responses": 8,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    },+    "W1": {+      "responses": 2,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    },+    "M1": {+      "responses": 4,+      "declared_projection_match": true,+      "full_text_match": true,+      "all_output_token_ids_match": true+    }+  },+  "performance_sequence_differences_vs_first_reference": {+    "reference_repeat": {+      "mixed": {+        "full_sequence_differences": 71,+        "projected_sequence_differences": 33,+        "total_sequences": 256+      },+      "balanced": {+        "full_sequence_differences": 10,+        "projected_sequence_differences": 1,+        "total_sequences": 256+      }+    },+    "candidate": {+      "mixed": {+        "full_sequence_differences": 128,+        "projected_sequence_differences": 67,+        "total_sequences": 256+      },+      "balanced": {+        "full_sequence_differences": 10,+        "projected_sequence_differences": 0,+        "total_sequences": 256+      }+    },+    "candidate_repeat": {+      "mixed": {+        "full_sequence_differences": 140,+        "projected_sequence_differences": 74,+        "total_sequences": 256+      },+      "balanced": {+        "full_sequence_differences": 13,+        "projected_sequence_differences": 3,+        "total_sequences": 256+      }+    }+  },+  "openai_completions": {+    "text_match": true,+    "finish_reason_match": true,+    "token_usage_match": true,+    "streaming_parity": true+  },+  "regression_tests": {+    "passed": 43,+    "log_sha256": "sha256:c5436542cd6e3387530d3851a4f26c1a01dc6cd396b996577e9494bcb913d8e8"+  },+  "task_command_status": {+    "describe": "passed",+    "smoke": "passed",+    "correctness": "passed",+    "cleanup": "passed"+  },+  "final_cleanup": {+    "attempted": true,+    "complete": true,+    "details": {+      "attempted": true,+      "complete": true,+      "ports_released": true,+      "state_found": false,+      "supervisor_stopped": true+    },+    "kind": "benchmark_task_cleanup",+    "runtime_id": "sglang_ascend_910b1_v0517_snapshot",+    "schema_version": 1,+    "status": "passed",+    "task_id": "sglang_qwen3_14b_sysopt_serving_2dev_v1"+  },+  "candidate_build": {+    "status": "passed",+    "action": "skipped",+    "reason": "No native sources changed"+  },+  "reference_geometric_mean_requests_per_second": 1.1309799373860356,+  "measured_geometric_mean_requests_per_second": 3.0174209866450754,+  "aggregate_speedup": 2.66797039178171,+  "measurement_schema_valid": true,+  "task_measurement_sha256": "sha256:52396b7808864f11aca6f9dda5bfd543eacbc03d217dfcf14c11e11800b3ab66",+  "task_measurement": {+    "cleanup": {+      "attempted": true,+      "complete": true,+      "ports_released": true,+      "state_found": true,+      "supervisor_stopped": true+    },+    "gates": {+      "cleanup_complete": true,+      "hardware_available": true,+      "npu_activity": true,+      "service_ready": true,+      "workload_complete": true+    },+    "kind": "benchmark_measurement",+    "launch_origin": "framework_entrypoint",+    "measurement_valid": true,+    "metrics": {+      "gates": {+        "cleanup_complete": true,+        "npu_activity": true,+        "workload_complete": true+      },+      "hbm": {+        "available": true,+        "devices": [+          {+            "logical_device": 0,+            "peak_used_mib": 22644,+            "total_mib": 65536+          },+          {+            "logical_device": 1,+            "peak_used_mib": 22579,+            "total_mib": 65536+          }+        ],+        "errors": [],+        "sample_count": 178+      },+      "profiles": {+        "balanced": {+          "completed": 256,+          "duration_s": 58.144994706846774,+          "id": "balanced-c32-i512-o256",+          "input_throughput": 2254.2267079192943,+          "lengths_valid": true,+          "logprobs_finite": true,+          "median_e2e_latency_ms": 7259.9139721132815,+          "median_tpot_ms": null,+          "median_ttft_ms": null,+          "output_digest": "sha256:ac5d12bf6b17890eb88b474af4e7ed1fc2113cb3177f421e27deb79923dc1aa0",+          "output_observation": {+            "longest_identical_token_run": 4,+            "maximum_single_token_share": 0.15234375,+            "minimum_unique_token_ratio": 0.17578125,+            "prefix_tokens": 16,+            "sequences": 256,+            "unique_prefixes": 248,+            "unique_sequences": 256+          },+          "output_throughput": 1127.1133539596472,+          "request_throughput": 4.402786538904872,+          "requests": 256,+          "total_input_tokens": 131072,+          "total_output_tokens": 65536,+          "validation_projection_digest": "sha256:af376f1d876b11b0d9301d00c587ad5e9a76388616ff046ea980a5720959cfb0"+        },+        "mixed": {+          "completed": 256,+          "duration_s": 123.79291287343949,+          "id": "mixed-pd-c32-v1",+          "input_throughput": 2249.9510960272414,+          "lengths_valid": true,+          "logprobs_finite": true,+          "median_e2e_latency_ms": 12730.377310421318,+          "median_tpot_ms": null,+          "median_ttft_ms": null,+          "output_digest": "sha256:f38320197987794cad3ace16e8020bbbfd22289eb16c366cb80ac00c64fe2221",+          "output_observation": {+            "longest_identical_token_run": 20,+            "maximum_single_token_share": 0.4140625,+            "minimum_unique_token_ratio": 0.04296875,+            "prefix_tokens": 16,+            "sequences": 256,+            "unique_prefixes": 247,+            "unique_sequences": 256+          },+          "output_throughput": 595.575290124858,+          "request_throughput": 2.067969757377979,+          "requests": 256,+          "total_input_tokens": 278528,+          "total_output_tokens": 73728,+          "validation_projection_digest": "sha256:a37c15ef050d5c3d7ba41595d144b30260af16f3d644f7111afa54928e8295b5"+        }+      },+      "runtime_observation": {+        "launch_origin": "framework_entrypoint",+        "service_ready": true,+        "state": {+          "kind": "sglang_deployment_state",+          "launch_origin": "framework_entrypoint",+          "public_port": 39125,+          "ready": true,+          "runtime_dir": "/evidence/private-run",+          "schema_version": 1,+          "startup_duration_s": 223.0262328069657,+          "supervisor": {+            "argv": [+              "/usr/local/python3.11.15/bin/python3.11",+              "-B",+              "-m",+              "sglang.srt.deployment.qwen3_14b",+              "--model-path",+              "/mnt/shared/models/Qwen3-14B-40c0698",+              "--tokenizer-path",+              "/mnt/shared/models/Qwen3-14B-40c0698",+              "--served-model-name",+              "Qwen/Qwen3-14B",+              "--host",+              "127.0.0.1",+              "--port",+              "39125",+              "--device-ids",+              "0,1",+              "--runtime-dir",+              "/evidence/private-run"+            ],+            "environment": {+              "ASCEND_RT_VISIBLE_DEVICES": "0,1",+              "HF_HOME": "/evidence/private-run",+              "HOME": "/evidence/private-run",+              "MODELSCOPE_CACHE": "/evidence/private-run",+              "NO_PROXY": "127.0.0.1,localhost,::1",+              "PYTHONDONTWRITEBYTECODE": "1",+              "PYTHONPATH": "/sgl-workspace/sglang/python:/usr/local/Ascend/cann-9.0.0/python/site-packages:/usr/local/Ascend/cann-9.0.0/opp/built-in/op_impl/ai_core/tbe:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe:/usr/local/Ascend/cann-9.0.0/python/site-packages:/usr/local/Ascend/cann-9.0.0/opp/built-in/op_impl/ai_core/tbe:",+              "PYTHONUNBUFFERED": "1",+              "TORCHINDUCTOR_CACHE_DIR": "/evidence/private-run",+              "TRITON_CACHE_DIR": "/evidence/private-run",+              "no_proxy": "127.0.0.1,localhost,::1"+            },+            "log": "/evidence/private-run",+            "pid": 103762,+            "start_time": 583807371+          }+        }+      }+    },+    "mode": "normal",+    "model": "Qwen/Qwen3-14B",+    "reason": null,+    "runtime_id": "sglang_ascend_910b1_v0517_snapshot",+    "schema_version": 1,+    "status": "passed",+    "task_id": "sglang_qwen3_14b_sysopt_serving_2dev_v1",+    "timings": {+      "startup_wall_time_s": 223.0262328069657,+      "total_wall_time_s": 462.2011751756072+    }+  }+}diff --git a/python/sglang/test/ascend/test_paged_attention_graph.py b/python/sglang/test/ascend/test_paged_attention_graph.pynew file mode 100644index 0000000000000000000000000000000000000000..6fde80d733790170ed413584c727668b7cdb5377--- /dev/null+++ b/python/sglang/test/ascend/test_paged_attention_graph.py@@ -0,0 +1,163 @@+"""Regression checks for dense Ascend paged-attention graph replay."""++import unittest+from types import SimpleNamespace++import torch++from sglang.srt.utils import is_npu+++@unittest.skipUnless(is_npu(), "requires Ascend")+class TestPagedAttentionGraph(unittest.TestCase):+    def test_replay_matches_eager_across_page_boundaries(self):+        import torch_npu++        from sglang.srt.hardware_backend.npu.attention.ascend_backend import (+            AscendAttnBackend,+            ForwardMetadata,+        )+        from sglang.srt.hardware_backend.npu.graph_runner.npu_cudagraph_backend import (+            NPUCudaGraphBackend,+        )+        from sglang.srt.model_executor.runner.shape_key import ShapeKey++        torch.npu.set_device(0)+        torch.npu.set_compile_mode(jit_compile=False)+        torch.manual_seed(138)+        for batch_size in (1, 4, 8, 32):+            with self.subTest(batch_size=batch_size):+                query = torch.randn(+                    batch_size, 20, 128, device="npu", dtype=torch.bfloat16+                )+                keys = torch.randn(+                    batch_size * 17,+                    128,+                    4,+                    128,+                    device="npu",+                    dtype=torch.bfloat16,+                )+                values = torch.randn(keys.shape, device="npu", dtype=keys.dtype)+                table = torch.arange(+                    batch_size * 17, device="npu", dtype=torch.int32+                ).reshape(batch_size, 17)+                layer = SimpleNamespace(+                    layer_id=0,+                    tp_q_head_num=20,+                    tp_k_head_num=4,+                    qk_head_dim=128,+                    v_head_dim=128,+                    scaling=128**-0.5,+                )+                attention = AscendAttnBackend.__new__(AscendAttnBackend)+                attention.use_mla = attention.is_hybrid_swa = False+                attention.use_paged_attention_graph = True+                attention.token_to_kv_pool = SimpleNamespace(+                    get_key_buffer=lambda _: keys,+                    get_value_buffer=lambda _: values,+                )+                attention.forward_metadata = ForwardMetadata(+                    block_tables=table,+                    seq_lens_cpu_int=torch.ones(batch_size, dtype=torch.int32),+                )+                runner = SimpleNamespace(+                    device_module=torch.npu,+                    model_runner=SimpleNamespace(+                        tp_group=SimpleNamespace(barrier=lambda: None)+                    ),+                )+                graph_backend = NPUCudaGraphBackend(runner)+                shape = ShapeKey(batch_size)+                stream = torch.npu.Stream()+                stream.wait_stream(torch.npu.current_stream())+                try:+                    with graph_backend.capture_session(stream):+                        graph_backend.capture_one(+                            shape,+                            lambda: attention.forward_decode_graph(+                                query, None, None, layer, None, save_kv_cache=False+                            ),+                        )+                    for length in (1, 127, 128, 129, 511, 2048):+                        lengths = [max(1, length - i) for i in range(batch_size)]+                        # Reuse storage with different queries and page mappings,+                        # as happens when scheduler slots move between requests.+                        query.normal_()+                        table.copy_(table.flip(0))+                        expected = torch.empty_like(query)+                        torch_npu._npu_paged_attention(+                            query=query,+                            key_cache=keys,+                            value_cache=values,+                            num_heads=20,+                            num_kv_heads=4,+                            scale_value=layer.scaling,+                            # Eager metadata only contains the active columns;+                            # graph metadata has a fixed capacity.+                            block_table=table[:, : (length + 127) // 128].contiguous(),+                            context_lens=torch.tensor(lengths, dtype=torch.int32),+                            out=expected,+                        )+                        actual = graph_backend.replay_with_input_update(+                            shape, lengths, "context_lens", torch.empty(0)+                        )+                        torch.npu.synchronize()+                        self.assertTrue(+                            torch.equal(actual.view_as(expected), expected)+                        )+                finally:+                    torch.npu.synchronize()+                    graph_backend.cleanup()++    def test_decode_refreshes_lengths_before_updating_graph(self):+        from sglang.srt.hardware_backend.npu.graph_runner.npu_graph_runner import (+            NPUGraphRunner,+        )+        from sglang.srt.layers.logits_processor import LogitsProcessorOutput+        from sglang.srt.model_executor.forward_batch_info import ForwardMode++        synchronizations = []++        class DeviceLengths:+            def cpu(self):+                synchronizations.append(True)+                return torch.tensor([129, 511])++        runner = NPUGraphRunner.__new__(NPUGraphRunner)+        runner.is_dllm = False+        runner._init_arch_map()+        runner.attn_backend = SimpleNamespace(use_paged_attention_graph=True)+        runner.model_runner = SimpleNamespace(+            model_config=SimpleNamespace(+                hf_config=SimpleNamespace(architectures=["Qwen3ForCausalLM"])+            )+        )+        runner.bs, runner.raw_bs, runner.raw_num_token = 4, 2, 2+        runner.seq_len_fill_value = 1+        runner.load_batch = lambda *args: None+        runner._make_graph_key = lambda size: size+        updates = []++        def replay(key, **kwargs):+            updates.append(kwargs)+            return LogitsProcessorOutput(next_token_logits=torch.zeros(4, 10))++        runner.backend = SimpleNamespace(replay_with_input_update=replay)+        batch = SimpleNamespace(+            needs_forward_metadata_init=lambda: True,+            forward_mode=ForwardMode.DECODE,+            spec_info=None,+            seq_lens=DeviceLengths(),+            seq_lens_cpu=torch.tensor([128, 510]),+        )+        output = runner.execute(batch)+        self.assertEqual(len(synchronizations), 1)+        self.assertEqual(updates[0]["seq_lens"], [129, 511, 1, 1])+        self.assertEqual(updates[0]["attr_name"], "context_lens")+        self.assertIsInstance(updates[0]["attr_type"], torch.Tensor)+        self.assertEqual(output.next_token_logits.shape, (2, 10))+++if __name__ == "__main__":+    unittest.main()diff --git a/python/sglang/test/ascend/test_qwen3_14b_deployment.py b/python/sglang/test/ascend/test_qwen3_14b_deployment.pynew file mode 100644index 0000000000000000000000000000000000000000..231556d6459822e977fb585d04e9bdf07138b6f2--- /dev/null+++ b/python/sglang/test/ascend/test_qwen3_14b_deployment.py@@ -0,0 +1,65 @@+"""Checks for the two-device deployment supervisor ABI."""++import argparse+import json+import os+import tempfile+import unittest+from pathlib import Path+from unittest.mock import patch++from sglang.srt.deployment import qwen3_14b+++class TestQwen3Deployment(unittest.TestCase):+    def test_requires_exactly_two_distinct_devices(self):+        for value in ("", "0", "0,0", "0,1,2", "-1,0", "a,1"):+            with self.subTest(value=value):+                with self.assertRaises(argparse.ArgumentTypeError):+                    qwen3_14b.device_ids(value)+        self.assertEqual(qwen3_14b.device_ids("4,7"), (4, 7))++    def test_exec_preserves_supervisor_ownership_and_records_plan(self):+        with tempfile.TemporaryDirectory() as directory:+            arguments = [+                "--model-path",+                "/models/Qwen 3",+                "--tokenizer-path",+                "/models/tokenizer",+                "--served-model-name",+                "Qwen/Qwen3-14B",+                "--host",+                "127.0.0.1",+                "--port",+                "12345",+                "--device-ids",+                "4,7",+                "--runtime-dir",+                directory,+            ]+            with (+                patch.dict(os.environ, {"HCCL_BUFFSIZE": "256"}, clear=True),+                patch.object(qwen3_14b.os, "execvpe") as execute,+            ):+                qwen3_14b.main(arguments)+                self.assertNotIn("ASCEND_RT_VISIBLE_DEVICES", os.environ)+            execute.assert_called_once()+            executable, command, environment = execute.call_args.args+            self.assertEqual(executable, command[0])+            self.assertEqual(command[1:4], ["-B", "-m", "sglang.launch_server"])+            self.assertEqual(+                command[command.index("--model-path") + 1], "/models/Qwen 3"+            )+            self.assertEqual(environment["ASCEND_RT_VISIBLE_DEVICES"], "4,7")+            self.assertEqual(environment["HCCL_BUFFSIZE"], "256")+            self.assertEqual(environment["SGLANG_NPU_PAGED_ATTENTION_GRAPH"], "1")+            sizes = command.index("--cuda-graph-bs-decode") + 1+            self.assertEqual(command[sizes : sizes + 32], list(map(str, range(1, 33))))+            plan = json.loads((Path(directory) / "qwen3-14b-plan.json").read_text())+            self.assertEqual(plan["argv"], command)+            self.assertEqual(plan["device_ids"], [4, 7])+            self.assertFalse((Path(directory) / "qwen3-14b-plan.json.tmp").exists())+++if __name__ == "__main__":+    unittest.main()