Inspect · Task requirements
Requested file and log inspection related to task requirements.
1 call · #0001–#0001
cat <path> <path>GPT-6 Astra · Serving
SGLang LFM2-1.2B model adapt serving 1dev · Model Adaptation
01 / PROCESS MAP
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 · 245 visible calls
02 / EVENT SEQUENCE
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.
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>.
Requested file and log inspection related to task requirements.
1 call · #0001–#0001
cat <path> <path>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>Requested repository inspection related to source & workspace.
1 call · #0003–#0003
git status --shortRequested file and log inspection related to task requirements.
1 call · #0004–#0004
cat <path> <path> <path> <path>Requested file and log inspection related to benchmark & validation setup.
1 call · #0005–#0005
cat <path> <path> <path> <path> <path> <path>Requested source searches related to convolution & sequence boundaries.
1 call · #0006–#0006
rg --files <path> <val>rg <val>Requested script or workload execution related to task requirements.
1 call · #0007–#0007
<command> <args>bash <script>Requested file and log inspection related to source & workspace.
1 call · #0008–#0008
sed -n <val> <path>Requested file and log inspection related to task requirements.
1 call · #0009–#0009
cat <path> <path> <path>Requested file and log inspection related to source & workspace.
1 call · #0010–#0010
cat <path>Requested file and log inspection and source searches related to attention kernels.
3 calls · #0011–#0013
cat <path> <path>rg -n <val> <path>cat <path>sed -n <val> <path>Requested script or workload execution related to task requirements.
1 call · #0014–#0014
python - <script>Requested environment setup or inspection related to source & workspace.
1 call · #0015–#0015
env <vars> bash <script>Requested file and log inspection related to attention kernels.
1 call · #0016–#0016
cat <path>Requested file and log inspection related to convolution & sequence boundaries.
1 call · #0017–#0017
cat <path>Requested source searches, file and log inspection and workspace inspection related to attention kernels.
3 calls · #0018–#0020
rg -n <val> <path> <path> <path> <path>rg -n <val> <path> <path>head -n <n>ls -l -t <val>sed -n <val> <path>Requested file and log inspection related to benchmark & validation setup.
1 call · #0021–#0021
tail -n <n> <path>Requested source searches and file and log inspection related to attention kernels.
2 calls · #0022–#0023
rg -n <val> <path> <path>rg -n <val> <path>cat <path>sed -n <val> <path>Requested file and log inspection, source searches and workspace inspection related to convolution & sequence boundaries.
2 calls · #0024–#0025
sed -n <val> <path>rg -n <val> <path> <path> <path> <path>ls -l -t <val>head -n <n>tail -n <n> <path>Requested file and log inspection and source searches related to attention kernels.
2 calls · #0026–#0027
sed -n <val> <path>rg -n <val> <path> <path> <path> <path> <n> > <path>rg -n <val> <path> <path>Requested file and log inspection related to benchmark & validation setup.
2 calls · #0028–#0029
tail -n <n> <path>cat <path>cut -c <val>Requested file and log inspection related to convolution & sequence boundaries.
1 call · #0030–#0030
sed -n <val> <path>Requested file and log inspection and source searches related to source & workspace.
1 call · #0031–#0031
sed -n <val> <path>rg -n <val> <path>tail -n <n>Requested source searches and file and log inspection related to convolution & sequence boundaries.
1 call · #0032–#0032
rg --files <val> <path>rg <val>rg -n <val> <path>tail -n <n>Requested file and log inspection related to source & workspace.
1 call · #0033–#0033
sed -n <val> <path>Requested file and log inspection related to benchmark & validation setup.
1 call · #0034–#0034
tail -n <n> <path>cut -c <val>Requested file and log inspection related to convolution & sequence boundaries.
1 call · #0035–#0035
sed -n <val> <path>Requested source searches and file and log inspection related to device memory.
1 call · #0036–#0036
rg -n <val> <path>head -n <n>sed -n <val> <path>Requested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0037–#0037
rg -n -A <n> <val> <path> <path>tail -n <n> <path>cut -c <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0038–#0038
bash <script>Requested file and log inspection and source searches related to convolution & sequence boundaries.
1 call · #0039–#0039
sed -n <val> <path>rg -n <val> <path>tail -n <n>Requested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0040–#0040
rg -n <path> <path>head -n <n>sed -n <val> <path>Requested file and log inspection and workspace file updates related to benchmark & validation setup.
1 call · #0041–#0041
tail -n <n> <path>cp <path> <path>Requested code edits related to attention kernels.
1 call · #0042–#0042
Apply patch <patch>Requested file and log inspection related to benchmark & validation setup.
1 call · #0043–#0043
tail -n <n> <path>cut -c <val>sed -n <val> <path>Requested file and log inspection and source searches related to source & workspace.
1 call · #0044–#0044
sed -n <val> <path>rg -n <val> <path>tail -n <n>rg --files <val>rg <val>head -n <n>Requested code edits related to convolution & sequence boundaries.
1 call · #0045–#0045
Apply patch <patch>Requested file and log inspection related to benchmark & validation setup.
1 call · #0046–#0046
tail -n <n> <path>cut -c <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0047–#0047
bash <script>Requested file and log inspection and workspace file updates related to benchmark & validation setup.
1 call · #0048–#0048
cat <path> <path>cp <path> <path>Requested source searches and file and log inspection related to attention kernels.
1 call · #0049–#0049
rg -n <val> <path>head -n <n>rg --files <path>Requested code edits related to convolution & sequence boundaries.
1 call · #0050–#0050
Apply patch <patch>Requested file and log inspection and workspace inspection related to benchmark & validation setup.
1 call · #0051–#0051
tail -n <n> <path> <n> > <path>cut -c <val>ls -l -t <val>head -n <n>Requested script or workload execution and repository inspection related to attention kernels.
1 call · #0052–#0052
python -m <module> -q <script> <script> <script> <script>git diff --statRequested file and log inspection, workspace inspection and repository inspection related to source & workspace.
1 call · #0053–#0053
tail -n <n> <path>cut -c <val>ls -l -t <val>head -n <n>git status --shortRequested file and log inspection and script or workload execution related to rollout generation.
1 call · #0054–#0054
cat > <path> <script>python <script> <val>Requested source searches and file and log inspection related to batching & scheduling.
1 call · #0055–#0055
rg -n <val> <path>head -n <n>sed -n <val> <path>tail -n <n>Requested source searches, file and log inspection and workspace inspection related to source & workspace.
3 calls · #0056–#0058
rg -n <val> <path> <path>sed -n <val> <path>cat <path> <n> > <path>ls -l -t <val>head -n <n>rg -n <val> <path>sed -n <val>Requested file and log inspection and source searches related to convolution & sequence boundaries.
1 call · #0059–#0059
sed -n <val> <path>rg -n <val> <path>head -n <n>rg --files <path>rg <path>Requested workspace inspection, file and log inspection and source searches related to source & workspace.
1 call · #0060–#0060
ls -l -t <val>head -n <n>rg -n <val> <path>tail -n <n>sed -n <val> <path>Requested script or workload execution, file and log inspection and source searches related to device memory.
1 call · #0061–#0061
python - <script>sed -n <val> <path>rg -n <val> <path> <path>tail -n <n>Requested file and log inspection related to device memory.
1 call · #0062–#0062
sed -n <val> <path>Requested source searches, file and log inspection and workspace inspection related to attention kernels.
4 calls · #0063–#0066
rg -n <val> <path> <path> <path>head -n <n>ls -l -t <val>rg -n <val> <path>tail -n <n>sed -n <val> <path>rg -n <val> <path> <path>rg --files <path>Requested workspace inspection, file and log inspection and source searches related to source & workspace.
1 call · #0067–#0067
ls -l -t <val>head -n <n>rg -n <val> <path>tail -n <n>Requested file and log inspection, source searches and workspace inspection related to attention kernels.
2 calls · #0068–#0069
sed -n <val> <path>rg -n <val> <path>head -n <n>ls -l -t <val>git diff <flag> <args>tail -n <n>Requested script or workload execution, file and log inspection and source searches related to batching & scheduling.
1 call · #0070–#0070
python - <script>sed -n <val> <path>rg -n <val> <path>Requested file and log inspection and source searches related to attention kernels.
1 call · #0071–#0071
sed -n <val> <path>cat <path>head -n <n>rg --files <path>rg <val>Requested code edits related to attention kernels.
1 call · #0072–#0072
Apply patch <patch>Requested workspace inspection, file and log inspection and source searches related to source & workspace.
3 calls · #0073–#0075
ls -l -t <val>head -n <n>rg -n <val> <path>tail -n <n>sed -n <val> <path>test <val> -f <path>tail -n <n> <path>Requested environment setup or inspection related to task requirements.
1 call · #0076–#0076
env <vars> bash <script>Requested workspace inspection and file and log inspection related to source & workspace.
1 call · #0077–#0077
ls -l -t <val>head -n <n>tail -n <n> <path>cut -c <val>test <val> -f <path>Requested script or workload execution related to convolution & sequence boundaries.
1 call · #0078–#0078
python - <script>Requested source searches and file and log inspection related to attention kernels.
1 call · #0079–#0079
rg -l <val> <path> <path>head -n <n>Requested file and log inspection and script or workload execution related to benchmark & validation setup.
1 call · #0080–#0080
tail -n <n> <path>python - <script>Requested file and log inspection and source searches related to source & workspace.
2 calls · #0081–#0082
sed -n <val> <path>rg -n -A <n> -B <n> <val> <path>tail -n <n>Requested code edits related to convolution & sequence boundaries.
1 call · #0083–#0083
Apply patch <patch>Requested file and log inspection and source searches related to source & workspace.
3 calls · #0084–#0086
tail -n <n> <path>rg -n <val> <path> <path> <path>head -n <n>rg -n <val> <path> <path>sed -n <val> <path>rg -n <val> <path>Requested script or workload execution related to benchmark & validation setup.
1 call · #0087–#0087
python -m <module> -q <script> <script> <script> <flag> <args>Requested file and log inspection related to source & workspace.
1 call · #0088–#0088
tail -n <n> <path>Requested file and log inspection, runtime inspection and source searches related to benchmark & validation setup.
1 call · #0089–#0089
wc -c <path>ps <flag> <args>rg <val>head -n <n>rg -n <val> <path>Requested file and log inspection and source searches related to source & workspace.
1 call · #0090–#0090
tail -c <n> <path>sed -n <val> <path>rg -n <val> <path>tail -n <n>Requested environment setup or inspection related to convolution & sequence boundaries.
1 call · #0091–#0091
env <vars> python -m <module> -q <script> -x <flag> <args>Requested code edits related to attention kernels.
1 call · #0092–#0092
Apply patch <patch>Requested script or workload execution related to source & workspace.
1 call · #0093–#0093
python <script> <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0094–#0094
bash <script>Requested file and log inspection related to benchmark & validation setup.
1 call · #0095–#0095
test <val> -f <path>cat <path>tail -n <n> <path>Requested file and log inspection and environment setup or inspection related to attention kernels.
1 call · #0096–#0096
tail -n <n> <path>cut -c <val>cat > <path> <script>env <vars> python <script> > <path> <n> >& <path>Requested workspace file updates and file and log inspection related to benchmark & validation setup.
1 call · #0097–#0097
cp <path> <path>tail -n <n> <path>Requested code edits related to source & workspace.
1 call · #0098–#0098
Apply patch <patch>Requested file and log inspection related to attention kernels.
1 call · #0099–#0099
sed -n <val> <path>tail -n <n> <path>Requested environment setup or inspection, file and log inspection and repository inspection related to source & workspace.
2 calls · #0100–#0101
env <vars> python - <script>cat <path>git diff --statgit status --shortRequested code edits related to convolution & sequence boundaries.
1 call · #0102–#0102
Apply patch <patch>Requested script or workload execution related to source & workspace.
1 call · #0103–#0103
python <script> <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0104–#0104
bash <script>Requested file and log inspection and source searches related to benchmark & validation setup.
1 call · #0105–#0105
tail -n <n> <path>cut -c <val>rg -n <val> <path> <path>head -n <n>sed -n <val> <path>Requested workspace file updates and source searches related to benchmark & validation setup.
1 call · #0106–#0106
cp <path> <path>rg -n -A <n> <val> <path>Requested source searches and file and log inspection related to batching & scheduling.
1 call · #0107–#0107
rg -n <val> <path>head -n <n>sed -n <val> <path>Requested environment setup or inspection related to source & workspace.
1 call · #0108–#0108
env <vars> python - <script>Requested source searches and file and log inspection related to runtime processes.
1 call · #0109–#0109
rg -n <val> <path>tail -n <n>sed -n <val> <path>head -n <n>cat <path>Requested source searches and file and log inspection related to attention kernels.
2 calls · #0110–#0111
rg --files <path>rg <val>head -n <n>cat <path>tail -n <n>sed -n <val> <path>Requested file and log inspection related to batching & scheduling.
1 call · #0112–#0112
cat <path>head -n <n>sed -n <val> <path>Requested source searches and file and log inspection related to source & workspace.
2 calls · #0113–#0114
rg -n -A <n> <val> <path>sed -n <val> <path>rg -n <val> <path>head -n <n>Requested file and log inspection and source searches related to attention kernels.
1 call · #0115–#0115
sed -n <val> <path>rg -n <val> <path>head -n <n>Requested source searches related to source & workspace.
1 call · #0116–#0116
rg -n -A <n> <val> <path>Requested code edits related to convolution & sequence boundaries.
1 call · #0117–#0117
Apply patch <patch>Requested file and log inspection and source searches related to attention kernels.
1 call · #0118–#0118
tail -n <n> <path>cat <path>tail -n <n>rg -n <val> <path>head -n <n>Requested environment setup or inspection related to convolution & sequence boundaries.
1 call · #0119–#0119
env <vars> python -m <module> -q <script> -x <flag> <args>Requested file and log inspection related to source & workspace.
1 call · #0120–#0120
tail -n <n> <path>Requested environment setup or inspection related to convolution & sequence boundaries.
1 call · #0121–#0121
env <vars> python - <script>Requested environment setup or inspection related to benchmark & validation setup.
1 call · #0122–#0122
env <vars> bash <script> > <path> <n> >& <path>Requested source searches and file and log inspection related to batching & scheduling.
1 call · #0123–#0123
rg -n <val> <path>tail -n <n>sed -n <val> <path>Requested file and log inspection and script or workload execution related to benchmark & validation setup.
1 call · #0124–#0124
tail -n <n> <path>cut -c <val>test <val> -f <path>python - <script>Requested script or workload execution related to source & workspace.
1 call · #0125–#0125
python <script> <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0126–#0126
bash <script>Requested code edits related to source & workspace.
1 call · #0127–#0127
Apply patch <patch>Requested source searches and file and log inspection related to runtime processes.
1 call · #0128–#0128
rg -n <val> <path>tail -n <n>cat <path>headRequested file and log inspection and environment setup or inspection related to convolution & sequence boundaries.
1 call · #0129–#0129
cat > <path> <script>env <vars> python <script> > <path> <n> >& <path>Requested file and log inspection related to source & workspace.
1 call · #0130–#0130
sed -n <val> <path>cat <path>Requested code edits related to convolution & sequence boundaries.
1 call · #0131–#0131
Apply patch <patch>Requested environment setup or inspection related to convolution & sequence boundaries.
1 call · #0132–#0132
env <vars> python -m <module> -q <script> -x <flag> <args>Requested script or workload execution related to source & workspace.
1 call · #0133–#0133
python <script> <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0134–#0134
bash <script>Requested file and log inspection related to benchmark & validation setup.
1 call · #0135–#0135
tail -n <n> <path>Requested file and log inspection related to source & workspace.
1 call · #0136–#0136
tail -n <n> <path>Requested file and log inspection related to convolution & sequence boundaries.
1 call · #0137–#0137
cat <path>Requested file and log inspection related to task requirements.
1 call · #0138–#0138
cat <path>Requested repository inspection related to source & workspace.
1 call · #0139–#0139
git status --shortgit diff --statgit diff --checkRequested repository inspection, file and log inspection and source searches related to attention kernels.
2 calls · #0140–#0141
git diff <flag> <args>cat <path>rg -n <val> <path>Requested file and log inspection related to task requirements.
1 call · #0142–#0142
cat <path>Requested file and log inspection related to attention kernels.
1 call · #0143–#0143
sed -n <val> <path>Requested file and log inspection and workspace inspection related to source & workspace.
1 call · #0144–#0144
tail -n <n> <path>ls -l <path>Requested source searches related to device memory.
1 call · #0145–#0145
rg -n <val> <path>rg -n <val> <path> <path> <path>Requested file and log inspection and source searches related to batching & scheduling.
1 call · #0146–#0146
sed -n <val> <path>rg -n <val> <path>Requested workspace inspection and file and log inspection related to source & workspace.
2 calls · #0147–#0148
ls -l -t <val>head -n <n>sed -n <val> <path>tail -n <n> <path>ls -l -t <path>Requested source searches and file and log inspection related to convolution & sequence boundaries.
1 call · #0149–#0149
rg --files <path>rg <val>sed -n <val> <path>Requested file and log inspection and source searches related to source & workspace.
3 calls · #0150–#0152
cat <path>head -c <n>sed -n <val> <path>rg -n <val> <path>Requested script or workload execution related to benchmark & validation setup.
1 call · #0153–#0153
python - <script>Requested file and log inspection and source searches related to attention kernels.
1 call · #0154–#0154
sed -n <val> <path>rg -n <val> <path>Requested file and log inspection related to source & workspace.
1 call · #0155–#0155
tail -n <n> <path>cut -c <val>cat <path>Requested source searches and file and log inspection related to attention kernels.
2 calls · #0156–#0157
rg -n <val> <path>sed -n <val> <path>cat <path>Requested script or workload execution related to rollout generation.
1 call · #0158–#0158
python - <script>Requested file and log inspection and workspace inspection related to source & workspace.
1 call · #0159–#0159
tail -n <n> <path>cut -c <val>ls -l -t <path>head -n <n>Requested file and log inspection and source searches related to attention kernels.
2 calls · #0160–#0161
sed -n <val> <path>rg -n <val> <path>head -n <n>Requested file and log inspection and workspace inspection related to source & workspace.
1 call · #0162–#0162
tail -n <n> <path>cut -c <val>ls -l -t <path>head -n <n>Requested source searches and file and log inspection related to attention kernels.
4 calls · #0163–#0166
rg -n <val> <path>head -n <n>cat <path>sed -n <val> <path>Requested script or workload execution and file and log inspection related to batching & scheduling.
1 call · #0167–#0167
python - <script>tail -n <n> <path>cut -c <val>Requested file and log inspection related to batching & scheduling.
1 call · #0168–#0168
tail -n <n> <path>cut -c <val>cat <path>Requested file and log inspection and source searches related to runtime processes.
1 call · #0169–#0169
sed -n <val> <path>rg -n <val> <path>Requested script or workload execution related to source & workspace.
1 call · #0170–#0170
python - <script>Requested file and log inspection, workspace inspection and source searches related to source & workspace.
2 calls · #0171–#0172
tail -n <n> <path>cut -c <val>ls -l -t <path>head -n <n>rg -n <val> <path>Requested script or workload execution and file and log inspection related to attention kernels.
1 call · #0173–#0173
python - <script>sed -n <val> <path>Requested script or workload execution related to batching & scheduling.
1 call · #0174–#0174
python - <script>Requested file and log inspection and workspace inspection related to source & workspace.
1 call · #0175–#0175
tail -n <n> <path>cut -c <val>ls -l -t <path>head -n <n>Requested script or workload execution related to attention kernels.
1 call · #0176–#0176
python - <script>Requested file and log inspection, workspace inspection and source searches related to source & workspace.
2 calls · #0177–#0178
tail -n <n> <path>cut -c <val>ls -l -t <path>head -n <n>rg -n <val> <path>sed -n <val> <path>Requested script or workload execution and environment setup or inspection related to task requirements.
1 call · #0179–#0179
python - <script>env <vars> bash <script>Requested file and log inspection and workspace inspection related to benchmark & validation setup.
1 call · #0180–#0180
tail -n <n> <path>cut -c <val>ls -l -t <path> <path>Requested file and log inspection related to attention kernels.
1 call · #0181–#0181
sed -n <val> <path>Requested file and log inspection related to source & workspace.
1 call · #0182–#0182
tail -n <n> <path>cut -c <val>Requested script or workload execution related to source & workspace.
1 call · #0183–#0183
python <script> > <path> <n> >& <path>Requested file and log inspection related to source & workspace.
1 call · #0184–#0184
tail -n <n> <path>cut -c <val>Requested file and log inspection and workspace inspection related to source & workspace.
1 call · #0185–#0185
tail -n <n> <path>cut -c <val>ls <path> <n> > <path>trueRequested source searches and file and log inspection related to attention kernels.
1 call · #0186–#0186
rg -n <val> <path> <path> <n> > <path>head -n <n>rg -n <val> <path>sed -n <val> <path>Requested script or workload execution related to batching & scheduling.
1 call · #0187–#0187
python - <script>python <script> > <path> <n> >& <path>Requested script or workload execution, file and log inspection and source searches related to runtime processes.
1 call · #0188–#0188
python - <script>tail -n <n> <path>rg --files <path> <n> > <path>head -n <n>Requested file and log inspection and source searches related to source & workspace.
1 call · #0189–#0189
cat <path>rg --files <path>rg <val>head -n <n>tail -n <n> <path>cut -c <val>Requested script or workload execution related to source & workspace.
1 call · #0190–#0190
python - <script>Requested script or workload execution related to source & workspace.
2 calls · #0191–#0192
python - <script>Requested file and log inspection related to source & workspace.
1 call · #0193–#0193
tail -n <n> <path>cut -c <val>Requested file and log inspection related to attention kernels.
1 call · #0194–#0194
sed -n <val> <path>Requested file and log inspection related to source & workspace.
1 call · #0195–#0195
tail -n <n> <path>cut -c <val>cat <path>Requested source searches and file and log inspection related to attention kernels.
1 call · #0196–#0196
rg -n <val> <path> <path>sed -n <val> <path>Requested file and log inspection, source searches and script or workload execution related to source & workspace.
2 calls · #0197–#0198
tail -n <n> <path>cut -c <val>cat <path>rg --files <path> <n> > <path>rg <val>python - <script>Requested script or workload execution related to runtime processes.
1 call · #0199–#0199
python - <script>python <script> > <path> <n> >& <path>Requested source searches and file and log inspection related to source & workspace.
1 call · #0200–#0200
rg --files <path>rg <val>head -n <n>rg -n <val> <path>Requested source searches and file and log inspection related to source & workspace.
1 call · #0201–#0201
rg -n <val> <path> <path> <path> <n> > <path>rg -n <val> <path>head -n <n>cat <path>Requested code edits related to attention kernels.
1 call · #0202–#0202
Apply patch <patch>Requested file and log inspection, source searches and repository inspection related to attention kernels.
1 call · #0203–#0203
sed -n <val> <path>rg -n <val> <path>git diff --checkRequested code edits related to attention kernels.
1 call · #0204–#0204
Apply patch <patch>Requested file and log inspection related to benchmark & validation setup.
1 call · #0205–#0205
cat <path>head -n <n>tail -n <n> <path>cut -c <val>Requested source searches, file and log inspection and repository inspection related to source & workspace.
2 calls · #0206–#0207
rg -n <flag> <args>tail -n <n> <path>git diff --numstatsed -n <val> <path>rg --files <path>rg <path>head -n <n>Requested file and log inspection related to benchmark & validation setup.
1 call · #0208–#0208
tail -n <n> <path>cut -c <val>Requested environment setup or inspection related to attention kernels.
1 call · #0209–#0209
env <vars> python -m <module> -q <script> <path> -x <flag> <args>Requested file and log inspection and source searches related to attention kernels.
1 call · #0210–#0210
tail -n <n> <path>cut -c <val>rg -n <flag> <args>Requested script or workload execution related to source & workspace.
1 call · #0211–#0211
python <script> <val>Requested file and log inspection and repository inspection related to attention kernels.
1 call · #0212–#0212
head -n <n> <path>sed -n <val> <path>git diff --checkRequested script or workload execution related to benchmark & validation setup.
1 call · #0213–#0213
bash <script>Requested file and log inspection related to benchmark & validation setup.
1 call · #0214–#0214
tail -n <n> <path>cut -c <val>Requested script or workload execution, file and log inspection and source searches related to attention kernels.
1 call · #0215–#0215
python - <script>sed -n <val> <path>rg -n <val> <path>Requested code edits related to attention kernels.
1 call · #0216–#0216
Apply patch <patch>Requested repository inspection and source searches related to attention kernels.
1 call · #0217–#0217
git diff --checkrg -n <val> <path>Requested environment setup or inspection related to attention kernels.
1 call · #0218–#0218
env <vars> python -m <module> -q <script> -x <flag> <args>Requested file and log inspection related to attention kernels.
1 call · #0219–#0219
tail -n <n> <path>cut -c <val>Requested script or workload execution related to attention kernels.
2 calls · #0220–#0221
python - <script>python <script> > <path> <n> >& <path>python <script> <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0222–#0222
bash <script>Requested code edits related to convolution & sequence boundaries.
1 call · #0223–#0223
Apply patch <patch>Requested file and log inspection and repository inspection related to attention kernels.
1 call · #0224–#0224
tail -n <n> <path>git diff --statgit status --shortRequested script or workload execution related to runtime processes.
1 call · #0225–#0225
python - <script>Requested script or workload execution related to benchmark & validation setup.
1 call · #0226–#0226
python -m <module> -q <script> <script> <flag> <args>Requested environment setup or inspection related to attention kernels.
1 call · #0227–#0227
env <vars> python -m <module> -q <script> -k <val> <flag> <args>Requested file and log inspection and repository inspection related to attention kernels.
2 calls · #0228–#0229
tail -n <n> <path>cut -c <val>git diff <flag> <args>cat <path>Requested source searches, file and log inspection and workspace inspection related to source & workspace.
2 calls · #0230–#0231
du <flag> <args>rg --files <flag> <args>head -n <n>tail -n <n> <path>cut -c <val>ls -l -t <path>Requested file and log inspection and source searches related to attention kernels.
1 call · #0232–#0232
sed -n <val> <path>tail -n <n>rg -n <val> <path>head -n <n>Requested file and log inspection and workspace inspection related to source & workspace.
1 call · #0233–#0233
tail -n <n> <path>cut -c <val>ls -l -t <path>head -n <n>Requested script or workload execution and file and log inspection related to batching & scheduling.
1 call · #0234–#0234
python - <script>tail -n <n> <path>cut -c <val>Requested script or workload execution and file and log inspection related to batching & scheduling.
1 call · #0235–#0235
python - <script>tail -n <n> <path>cut -c <val>cat <path>head -c <n>Requested file and log inspection and workspace inspection related to benchmark & validation setup.
1 call · #0236–#0236
tail -n <n> <path>cut -c <val>ls -l -t <path> <path> <path>Requested script or workload execution and environment setup or inspection related to attention kernels.
1 call · #0237–#0237
python - <script>env <vars> bash <script>Requested file and log inspection related to benchmark & validation setup.
1 call · #0238–#0238
tail -n <n> <path>cut -c <val><command> <args>Requested file and log inspection, runtime inspection and source searches related to benchmark & validation setup.
1 call · #0239–#0239
tail -n <n> <path>cut -c <val>ps <flag> <args>rg <val>Requested repository inspection and script or workload execution related to runtime processes.
1 call · #0240–#0240
git diff --checkpython - <script>Requested file and log inspection and workspace inspection related to benchmark & validation setup.
1 call · #0241–#0241
tail -n <n> <path>cut -c <val>ls <flag> <args>Requested script or workload execution related to batching & scheduling.
1 call · #0242–#0242
python - <script>bash <script>Requested file and log inspection related to benchmark & validation setup.
1 call · #0243–#0243
tail -n <n> <path>cut -c <val>Requested script or workload execution, source searches and file and log inspection related to runtime processes.
1 call · #0244–#0244
bash <script>rg --files <flag> <args>head -n <n>ps <flag> <args>rg <val>cut -c <val>Requested script or workload execution, repository inspection and runtime inspection related to device memory.
1 call · #0245–#0245
python - <script>git diff --checkgit status --shortnpu-smi info03 / CANDIDATE ARTIFACT
Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.
Base commit: 340db9201005fc64635bb25db1d2538f955761c3
@@ -430,7 +430,9 @@ class AscendAttnBackend(AttentionBackend): def init_forward_metadata(self, forward_batch: ForwardBatch): """Init the metadata for a forward pass.""" self.forward_metadata = ForwardMetadata()- seq_lens_max = forward_batch.seq_lens.max()+ # The scheduler already maintains this host mirror. Reading a device+ # scalar as a slice bound would synchronize every eager forward step.+ seq_lens_max = forward_batch.seq_lens_cpu.max().item() if forward_batch.forward_mode.is_target_verify(): seq_lens_max += self.speculative_num_draft_tokens elif (@@ -460,7 +462,11 @@ class AscendAttnBackend(AttentionBackend): if forward_batch.extend_seq_lens is not None: self.forward_metadata.extend_seq_lens = forward_batch.extend_seq_lens self.forward_metadata.extend_seq_lens_cpu_int = (- forward_batch.extend_seq_lens.cpu().int()+ torch.tensor(+ forward_batch.extend_seq_lens_cpu, dtype=torch.int32, device="cpu"+ )+ if forward_batch.extend_seq_lens_cpu is not None+ else forward_batch.extend_seq_lens.cpu().int() ) if forward_batch.seq_lens is not None: self.forward_metadata.seq_lens = forward_batch.seq_lens.int()@@ -0,0 +1,14 @@+"""Ascend state metadata for LFM2's causal short convolution."""++import torch++from sglang.srt.layers.attention.linear.short_conv_backend import (+ ShortConvAttnBackend,+)+++class AscendShortConvAttnBackend(ShortConvAttnBackend):+ # The NPU convolution consumes device indices and cumulative lengths directly.+ # Avoid synchronizing the device to build unused per-step host slot mirrors.+ needs_extend_host_mirrors = False+ cache_indices_dtype = torch.int32@@ -0,0 +1,36 @@+"""Eager launches of the existing Ascend Q/K rotary kernel."""++import torch+from sgl_kernel_npu.norm.fused_rope_qk_mqa import fused_rope_qk_mqa_kernel_opt++from sglang.srt.hardware_backend.npu.triton_kernel import launch+++def fused_rope_qk_mqa(query, key, cos_sin, rotary_dim, is_neox_style):+ """Preserve the kernel's arithmetic while reusing its compiled launcher."""+ tokens, q_heads, head_dim = query.shape+ k_heads = key.shape[1]+ out_q = torch.empty_like(query)+ out_k = torch.empty_like(key)+ launch(+ fused_rope_qk_mqa_kernel_opt,+ (tokens,),+ (+ query,+ key,+ cos_sin,+ out_q,+ out_k,+ *query.stride(),+ *key.stride(),+ *cos_sin.stride(),+ *out_q.stride(),+ *out_k.stride(),+ ),+ Hq=q_heads,+ Hk=k_heads,+ D_HEAD=head_dim,+ D_ROPE=rotary_dim,+ IS_NEOX_STYLE=is_neox_style,+ )+ return out_q, out_k@@ -0,0 +1,227 @@+"""Gated causal short convolution on Ascend.++The cache stays in the NPU pool's [slot, window, channel] layout. Each program+owns a request and a channel tile, reads its history before overwriting it, and+processes the whole extension. No padded batch, cache gather/scatter, or host+inspection of device sequence lengths is needed.+"""++import torch+import triton+import triton.language as tl++from sglang.srt.hardware_backend.npu.triton_kernel import launch+++@triton.jit+def _gated_short_conv_decode(+ projection,+ weight,+ bias,+ state,+ indices,+ output,+ DIM: tl.constexpr,+ WIDTH: tl.constexpr,+ PROJ_STRIDE: tl.constexpr,+ WEIGHT_D: tl.constexpr,+ WEIGHT_K: tl.constexpr,+ STATE_B: tl.constexpr,+ STATE_K: tl.constexpr,+ STATE_D: tl.constexpr,+ HAS_BIAS: tl.constexpr,+ BLOCK_D: tl.constexpr,+):+ batch = tl.program_id(0)+ channel = tl.program_id(1) * BLOCK_D + tl.arange(0, BLOCK_D)+ slot = tl.load(indices + batch)+ active = (channel < DIM) & (slot >= 0)+ dtype = projection.dtype.element_ty+ base = projection + batch * PROJ_STRIDE + channel+ b = tl.load(base, active, 0).to(tl.float32)+ x = tl.load(base + 2 * DIM, active, 0).to(tl.float32)+ bx = (b * x).to(dtype)+ history = state + slot * STATE_B + channel * STATE_D+ acc = tl.full((BLOCK_D,), 0, tl.float32)+ for k in tl.static_range(WIDTH):+ if k < WIDTH - 1:+ value = tl.load(history + k * STATE_K, active, 0)+ else:+ value = bx+ w = tl.load(weight + channel * WEIGHT_D + k * WEIGHT_K, active, 0)+ # Match eager BF16 multiply followed by torch.sum in decode. Keeping+ # this rounding boundary also makes the fused gates numerically stable.+ product = (value.to(tl.float32) * w.to(tl.float32)).to(dtype)+ acc += product.to(tl.float32)+ if k > 0:+ tl.store(history + (k - 1) * STATE_K, value, active)+ if HAS_BIAS:+ acc = acc.to(dtype).to(tl.float32) + tl.load(bias + channel, active, 0)+ c = tl.load(base + DIM, active, 0).to(tl.float32)+ result = acc.to(dtype).to(tl.float32) * c+ tl.store(output + batch * DIM + channel, result, channel < DIM)+++@triton.jit+def _gated_short_conv_extend(+ projection,+ weight,+ bias,+ state,+ indices,+ query_start,+ has_initial_state,+ output,+ DIM: tl.constexpr,+ WIDTH: tl.constexpr,+ PROJ_STRIDE: tl.constexpr,+ WEIGHT_D: tl.constexpr,+ WEIGHT_K: tl.constexpr,+ STATE_B: tl.constexpr,+ STATE_K: tl.constexpr,+ STATE_D: tl.constexpr,+ HAS_BIAS: tl.constexpr,+ BLOCK_D: tl.constexpr,+ BLOCK_T: tl.constexpr,+):+ batch = tl.program_id(0)+ channel = tl.program_id(1) * BLOCK_D + tl.arange(0, BLOCK_D)+ slot = tl.load(indices + batch)+ start = tl.load(query_start + batch)+ end = tl.load(query_start + batch + 1)+ length = end - start+ has_prefix = tl.load(has_initial_state + batch).to(tl.int1)+ active = (channel < DIM) & (slot >= 0)+ dtype = projection.dtype.element_ty+ history = state + slot * STATE_B + channel * STATE_D+ for block in range(tl.cdiv(length, BLOCK_T)):+ token = block * BLOCK_T + tl.arange(0, BLOCK_T)+ acc = tl.full((BLOCK_T, BLOCK_D), 0, tl.float32)+ if HAS_BIAS:+ acc += tl.load(bias + channel, active, 0)[None, :].to(tl.float32)+ for k in tl.static_range(WIDTH):+ source = token + k - (WIDTH - 1)+ in_input = (source >= 0) & (source < length)+ mask = in_input[:, None] & active[None, :]+ ptr = (+ projection+ + (start + source[:, None]) * PROJ_STRIDE+ + channel[None, :]+ )+ b = tl.load(ptr, mask, 0).to(tl.float32)+ x = tl.load(ptr + 2 * DIM, mask, 0).to(tl.float32)+ bx = (b * x).to(dtype)+ in_history = (source < 0) & (source >= -(WIDTH - 1)) & has_prefix+ old = tl.load(+ history[None, :] + (source[:, None] + WIDTH - 1) * STATE_K,+ in_history[:, None] & active[None, :],+ 0,+ )+ value = tl.where(in_input[:, None], bx, old).to(tl.float32)+ w = tl.load(weight + channel * WEIGHT_D + k * WEIGHT_K, active, 0)+ acc += value * w[None, :].to(tl.float32)+ mask = (token[:, None] < length) & active[None, :]+ c = tl.load(+ projection+ + (start + token[:, None]) * PROJ_STRIDE+ + DIM+ + channel[None, :],+ mask,+ 0,+ ).to(tl.float32)+ result = acc.to(dtype).to(tl.float32) * c+ tl.store(+ output + (start + token[:, None]) * DIM + channel[None, :],+ result,+ (token[:, None] < length) & (channel[None, :] < DIM),+ )+ # This program has finished reading its history. Updating it here avoids+ # races between the first and last token tiles of a long extension.+ for k in tl.static_range(WIDTH - 1):+ source = length - (WIDTH - 1) + k+ ptr = projection + (start + source) * PROJ_STRIDE + channel+ mask = active & (length > 0) & (source >= 0)+ b = tl.load(ptr, mask, 0).to(tl.float32)+ x = tl.load(ptr + 2 * DIM, mask, 0).to(tl.float32)+ bx = (b * x).to(dtype)+ old = tl.load(+ history + (length + k) * STATE_K,+ active & (length > 0) & (source < 0) & has_prefix,+ 0,+ )+ value = tl.where(source >= 0, bx, old)+ tl.store(history + k * STATE_K, value, active & (length > 0))+++def gated_short_conv(+ projection: torch.Tensor,+ weight: torch.Tensor,+ bias: torch.Tensor | None,+ state: torch.Tensor,+ indices: torch.Tensor,+ query_start_loc: torch.Tensor | None = None,+ has_initial_state: torch.Tensor | None = None,+) -> torch.Tensor:+ """Apply LFM2's two gates and short convolution, updating selected slots.++ ``projection`` packs B, C, and x along the last dimension. Passing cumulative+ lengths selects varlen prefill; otherwise there is one token per request.+ Negative slot indices are padding and never read or modify the cache.+ """+ dim, width = weight.shape+ assert projection.ndim == 2 and projection.shape[1] == 3 * dim+ assert projection.stride(1) == 1+ assert state.shape[1:] == (width - 1, dim)+ assert projection.dtype in (torch.bfloat16, torch.float16)+ assert weight.dtype == projection.dtype+ assert width >= 2+ batch = indices.numel()+ output = projection.new_empty((projection.shape[0], dim))+ if batch == 0 or projection.shape[0] == 0:+ return output+ common = dict(+ DIM=dim,+ WIDTH=width,+ PROJ_STRIDE=projection.stride(0),+ WEIGHT_D=weight.stride(0),+ WEIGHT_K=weight.stride(1),+ STATE_B=state.stride(0),+ STATE_K=state.stride(1),+ STATE_D=state.stride(2),+ HAS_BIAS=bias is not None,+ disable_fma=True,+ )+ if query_start_loc is None:+ assert projection.shape[0] == batch+ block_d = min(+ triton.next_power_of_2(dim),+ max(64, triton.next_power_of_2(triton.cdiv(dim * batch, 40))),+ )+ launch(+ _gated_short_conv_decode,+ (batch, triton.cdiv(dim, block_d)),+ (projection, weight, bias, state, indices, output),+ BLOCK_D=block_d,+ **common,+ )+ else:+ assert has_initial_state is not None+ assert query_start_loc.numel() == batch + 1+ launch(+ _gated_short_conv_extend,+ (batch, triton.cdiv(dim, 64)),+ (+ projection,+ weight,+ bias,+ state,+ indices,+ query_start_loc,+ has_initial_state,+ output,+ ),+ BLOCK_D=64,+ BLOCK_T=16,+ **common,+ )+ return output@@ -0,0 +1,36 @@+"""Bounded cache of compiled NPU kernels for eager launches."""++from collections import OrderedDict++import torch++_kernels = OrderedDict()+_MAX_KERNELS = 128+++def launch(kernel, grid, args, **constants):+ """Reuse compiled code without repeating Triton's Python argument binding.++ Tensor dtype, device, and alignment and scalar argument values are part of+ the specialization key. Neither tensors nor results are retained here.+ """+ signature = tuple(+ (arg.dtype, arg.device, arg.data_ptr() % 16 == 0)+ if isinstance(arg, torch.Tensor)+ else (type(arg), arg)+ for arg in args+ )+ key = (kernel, signature, tuple(constants.items()))+ compiled = _kernels.get(key)+ if compiled is None:+ compiled = kernel.warmup(*args, grid=grid, **constants)+ _kernels[key] = compiled+ if len(_kernels) > _MAX_KERNELS:+ _kernels.popitem(last=False)+ else:+ # Another launching thread may have evicted this entry after get().+ try:+ _kernels.move_to_end(key)+ except KeyError:+ pass+ compiled[tuple(grid) + (1,) * (3 - len(grid))](*args)@@ -435,18 +435,11 @@ def attn_backend_wrapper(runner: "ModelRunner", full_attn_backend: "AttentionBac Lfm2VlConfig, ) 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.+ if is_npu() and isinstance(+ mamba2_config(runner.model_config), (ZayaConfig, Lfm2MoeConfig)+ ): 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."+ "ZAYA1 CCA and LFM2-MoE convolution are not yet supported on NPU." ) from sglang.srt.layers.attention.hybrid_linear_attn_backend import ( ShortConvHybridAttnBackend,@@ -455,7 +448,14 @@ def attn_backend_wrapper(runner: "ModelRunner", full_attn_backend: "AttentionBac ShortConvAttnBackend, ) - linear_attn_backend = ShortConvAttnBackend(runner)+ if is_npu():+ from sglang.srt.hardware_backend.npu.attention.ascend_short_conv_backend import (+ AscendShortConvAttnBackend,+ )++ linear_attn_backend = AscendShortConvAttnBackend(runner)+ else:+ linear_attn_backend = ShortConvAttnBackend(runner) hybrid_backend_cls = ShortConvHybridAttnBackend else: linear_attn_backend = Mamba2AttnBackend(runner)@@ -57,7 +57,7 @@ if _is_npu: # generic rope path. A warning is emitted so the missing kernel is # visible in logs instead of being silently swallowed. try:- from sgl_kernel_npu.norm.fused_rope_qk_mqa import fused_rope_qk_mqa+ from sglang.srt.hardware_backend.npu.rope import fused_rope_qk_mqa except ImportError: fused_rope_qk_mqa = None logger.warning(@@ -20,10 +20,6 @@ from torch import nn from sglang.srt.configs.lfm2 import Lfm2Config from sglang.srt.distributed import get_pp_group-from sglang.srt.layers.attention.mamba.causal_conv1d import (- causal_conv1d_fn,- causal_conv1d_update,-) from sglang.srt.layers.layernorm import RMSNorm from sglang.srt.layers.linear import ( ColumnParallelLinear,@@ -47,7 +43,16 @@ from sglang.srt.model_loader.weight_utils import ( sharded_weight_loader, ) from sglang.srt.runtime_context import get_parallel-from sglang.srt.utils import add_prefix, make_layers, set_weight_attrs+from sglang.srt.utils import add_prefix, is_npu, make_layers, set_weight_attrs++_is_npu = is_npu()+if _is_npu:+ from sglang.srt.hardware_backend.npu.short_conv import gated_short_conv+else:+ from sglang.srt.layers.attention.mamba.causal_conv1d import (+ causal_conv1d_fn,+ causal_conv1d_update,+ ) logger = logging.getLogger(__name__) @@ -75,20 +80,29 @@ class Lfm2MLP(nn.Module): // config.block_multiple_of ) - self.w1 = ColumnParallelLinear(- config.hidden_size,- intermediate_size,- bias=False,- quant_config=quant_config,- prefix=add_prefix("w1", prefix),- )- self.w3 = ColumnParallelLinear(- config.hidden_size,- intermediate_size,- bias=False,- quant_config=quant_config,- prefix=add_prefix("w3", prefix),- )+ self.merged_gate_up = _is_npu and quant_config is None+ if self.merged_gate_up:+ self.gate_up_proj = MergedColumnParallelLinear(+ config.hidden_size,+ [intermediate_size] * 2,+ bias=False,+ prefix=add_prefix("gate_up_proj", prefix),+ )+ else:+ self.w1 = ColumnParallelLinear(+ config.hidden_size,+ intermediate_size,+ bias=False,+ quant_config=quant_config,+ prefix=add_prefix("w1", prefix),+ )+ self.w3 = ColumnParallelLinear(+ config.hidden_size,+ intermediate_size,+ bias=False,+ quant_config=quant_config,+ prefix=add_prefix("w3", prefix),+ ) self.w2 = RowParallelLinear( intermediate_size, config.hidden_size,@@ -98,6 +112,11 @@ class Lfm2MLP(nn.Module): ) def forward(self, x: torch.Tensor) -> torch.Tensor:+ if self.merged_gate_up:+ gate_up, _ = self.gate_up_proj(x)+ gate, up = gate_up.chunk(2, dim=-1)+ out, _ = self.w2(F.silu(gate) * up)+ return out gate, _ = self.w1(x) up, _ = self.w3(x) out, _ = self.w2(F.silu(gate) * up)@@ -248,9 +267,16 @@ class Lfm2ShortConv(nn.Module): ) # Conv weights sharded along hidden dimension: (hidden_size/tp, kernel_size)- self.conv_weight = nn.Parameter(- torch.empty(self.hidden_size_per_partition, self.conv_kernel)- )+ # The NPU vector kernel reads one tap across channels. Keep that axis+ # contiguous while retaining the checkpoint's logical [channel, tap]+ # shape and the usual sharded weight loader.+ if _is_npu:+ conv_weight = torch.empty(+ self.conv_kernel, self.hidden_size_per_partition+ ).transpose(0, 1)+ else:+ conv_weight = torch.empty(self.hidden_size_per_partition, self.conv_kernel)+ self.conv_weight = nn.Parameter(conv_weight) set_weight_attrs(self.conv_weight, {"weight_loader": sharded_weight_loader(0)}) if self.use_bias: self.conv_bias = nn.Parameter(torch.empty(self.hidden_size_per_partition))@@ -276,6 +302,23 @@ class Lfm2ShortConv(nn.Module): # Project and split into gates: B (pre-conv), C (post-conv), x (input) proj, _ = self.in_proj(hidden_states)+ if _is_npu:+ gated_out = gated_short_conv(+ proj,+ self.conv_weight,+ self.conv_bias,+ conv_state,+ meta.cache_indices,+ query_start_loc=(+ None+ if forward_batch.forward_mode.is_decode()+ else meta.query_start_loc+ ),+ has_initial_state=meta.has_initial_state,+ )+ output, _ = self.out_proj(gated_out)+ return output+ B_gate, C_gate, x = proj.chunk(3, dim=-1) Bx = B_gate * x @@ -441,6 +484,7 @@ class Lfm2Model(nn.Module): ): super().__init__() self.config = config+ self.quant_config = quant_config self.embed_tokens = VocabParallelEmbedding( config.vocab_size,@@ -543,6 +587,11 @@ class Lfm2BidirectionalModel(Lfm2Model): ("qkv_proj", "k_proj", "k"), ("qkv_proj", "v_proj", "v"), ]+ if _is_npu and self.quant_config is None:+ stacked_params_mapping += [+ ("feed_forward.gate_up_proj", "feed_forward.w1", 0),+ ("feed_forward.gate_up_proj", "feed_forward.w3", 1),+ ] params_dict = dict(self.named_parameters()) loaded_params: Set[str] = set()@@ -642,6 +691,11 @@ class Lfm2ForCausalLM(nn.Module): ("qkv_proj", "k_proj", "k"), ("qkv_proj", "v_proj", "v"), ]+ if _is_npu and self.quant_config is None:+ stacked_params_mapping += [+ ("feed_forward.gate_up_proj", "feed_forward.w1", 0),+ ("feed_forward.gate_up_proj", "feed_forward.w3", 1),+ ] params_dict = dict(self.named_parameters()) loaded_params: Set[str] = set()@@ -0,0 +1,209 @@+"""Device tests for LFM2's Ascend convolution, metadata, and rotary launches."""++from types import SimpleNamespace++import pytest+import torch+import torch.nn.functional as F++torch_npu = pytest.importorskip("torch_npu")+pytestmark = pytest.mark.skipif(+ not torch.npu.is_available(), reason="requires an Ascend NPU"+)++from sglang.srt.hardware_backend.npu.short_conv import gated_short_conv+++def _rand(*shape):+ return torch.randn(*shape, device="npu", dtype=torch.bfloat16)+++def _extend_reference(projection, weight, bias, state, slots, lengths, prefixes):+ dim, width = weight.shape+ b, c, x = projection.chunk(3, dim=-1)+ bx = b * x+ output = torch.zeros_like(bx)+ start = 0+ for slot, length, prefix in zip(slots, lengths, prefixes):+ end = start + length+ if slot >= 0 and length:+ history = state[slot].transpose(0, 1)+ if not prefix:+ history = torch.zeros_like(history)+ joined = torch.cat((history, bx[start:end].T), dim=-1)+ conv = F.conv1d(+ joined.unsqueeze(0), weight.unsqueeze(1), bias, groups=dim+ ).squeeze(0).T+ output[start:end] = c[start:end] * conv+ state[slot] = joined[:, -(width - 1) :].T+ start = end+ return output+++@pytest.mark.parametrize("dim,width", [(67, 2), (2048, 3), (67, 4)])+@pytest.mark.parametrize("with_bias", [False, True])+def test_varlen_prefix_and_slot_isolation(dim, width, with_bias):+ torch.manual_seed(123)+ lengths = [1, 0, 2, 17, 129]+ slots = [6, 5, -1, 1, 3]+ prefixes = [True, False, True, False, True]+ projection = _rand(sum(lengths), dim * 3)+ weight = _rand(dim, width)+ if dim == 2048:+ weight = weight.T.contiguous().T+ bias = _rand(dim) if with_bias else None+ state = _rand(8, width - 1, dim)+ expected_state = state.clone()+ expected = _extend_reference(+ projection, weight, bias, expected_state, slots, lengths, prefixes+ )+ actual = gated_short_conv(+ projection,+ weight,+ bias,+ state,+ torch.tensor(slots, device="npu", dtype=torch.int64),+ torch.tensor([0] + lengths, device="npu", dtype=torch.int32).cumsum(+ 0, dtype=torch.int32+ ),+ torch.tensor(prefixes, device="npu", dtype=torch.bool),+ )+ torch.testing.assert_close(actual, expected, rtol=0, atol=0)+ torch.testing.assert_close(state, expected_state, rtol=0, atol=0)+++@pytest.mark.parametrize("batch", [1, 3, 32, 64])+def test_decode_reorders_slots_and_preserves_bf16_rounding(batch):+ torch.manual_seed(456)+ dim, width = 2048, 3+ weight = _rand(dim, width)+ state = _rand(batch + 4, width - 1, dim)+ expected_state = state.clone()+ slots = list(range(2, batch + 2))+ if batch > 1:+ slots[batch // 2] = -1+ for step in range(3):+ slots = slots[-1:] + slots[:-1]+ projection = _rand(batch, dim * 3)+ b, c, x = projection.chunk(3, dim=-1)+ bx = b * x+ expected = torch.zeros_like(bx)+ for row, slot in enumerate(slots):+ if slot < 0:+ continue+ joined = torch.cat((expected_state[slot], bx[row : row + 1]), dim=0)+ conv = (joined.T * weight).sum(-1)+ expected[row] = c[row] * conv+ expected_state[slot] = joined[1:]+ actual = gated_short_conv(+ projection,+ weight if step % 2 else weight.T.contiguous().T,+ None,+ state,+ torch.tensor(slots, dtype=torch.int64, device="npu"),+ )+ torch.testing.assert_close(actual, expected, rtol=0, atol=0)+ torch.testing.assert_close(state, expected_state, rtol=0, atol=0)+++def test_empty_extension_keeps_state():+ state = _rand(4, 2, 64)+ previous = state.clone()+ output = gated_short_conv(+ _rand(0, 192),+ _rand(64, 3),+ None,+ state,+ torch.tensor([2], device="npu"),+ torch.tensor([0, 0], device="npu"),+ torch.tensor([False], device="npu"),+ )+ assert output.shape == (0, 64)+ torch.testing.assert_close(state, previous, rtol=0, atol=0)+++@pytest.mark.parametrize("mode", ["decode", "extend", "extend_without_host_lengths"])+def test_ascend_metadata_uses_scheduler_lengths(mode):+ from sglang.srt.hardware_backend.npu.attention.ascend_backend import (+ AscendAttnBackend,+ )+ from sglang.srt.model_executor.forward_batch_info import ForwardMode++ backend = object.__new__(AscendAttnBackend)+ tokens = torch.arange(4 * 16, device="npu", dtype=torch.int32).reshape(4, 16)+ backend.req_to_token_pool = SimpleNamespace(req_to_token=tokens)+ backend.page_size = 4+ backend.device = "npu"+ backend.is_hybrid_swa = False+ backend.use_mla = False+ backend.use_sliding_window_kv_pool = False+ extending = mode != "decode"+ batch = SimpleNamespace(+ forward_mode=ForwardMode.EXTEND if extending else ForwardMode.DECODE,+ req_pool_indices=torch.tensor([2, 0], device="npu", dtype=torch.int32),+ seq_lens=torch.tensor([9, 5], device="npu", dtype=torch.int32),+ seq_lens_cpu=torch.tensor([9, 5], dtype=torch.int64),+ extend_seq_lens=(+ torch.tensor([1, 3], device="npu", dtype=torch.int32)+ if extending+ else None+ ),+ extend_seq_lens_cpu=[1, 3] if mode == "extend" else None,+ spec_info=None,+ )+ backend.init_forward_metadata(batch)+ metadata = backend.forward_metadata+ torch.testing.assert_close(+ metadata.block_tables.cpu(),+ torch.tensor([[8, 9, 10], [0, 1, 2]], dtype=torch.int32),+ )+ torch.testing.assert_close(metadata.seq_lens.cpu(), batch.seq_lens_cpu.int())+ if extending:+ assert metadata.extend_seq_lens_cpu_int.device.type == "cpu"+ torch.testing.assert_close(+ metadata.extend_seq_lens_cpu_int, torch.tensor([1, 3], dtype=torch.int32)+ )+ else:+ torch.testing.assert_close(+ metadata.actual_seq_lengths_q.cpu(), torch.tensor([1, 2], dtype=torch.int32)+ )+++@pytest.mark.parametrize("batch", [1, 32, 128])+@pytest.mark.parametrize("neox", [False, True])+def test_cached_rope_matches_original_kernel(batch, neox):+ from sgl_kernel_npu.norm.fused_rope_qk_mqa import (+ fused_rope_qk_mqa as original_rope,+ )++ from sglang.srt.hardware_backend.npu.rope import fused_rope_qk_mqa++ torch.manual_seed(789)+ projection = _rand(batch, 40, 64)+ cache = _rand(batch, 64)+ for contiguous in (False, True):+ q, k = projection[:, :32], projection[:, 32:]+ if contiguous:+ q, k = q.contiguous(), k.contiguous()+ expected = original_rope(q, k, cache, 64, neox)+ actual = fused_rope_qk_mqa(q, k, cache, 64, neox)+ for output, reference in zip(actual, expected):+ torch.testing.assert_close(output, reference, rtol=0, atol=0)+++@pytest.mark.parametrize("dtype", [torch.bfloat16, torch.float16, torch.float32])+@pytest.mark.parametrize("rotary_dim", [32, 64])+def test_cached_rope_preserves_dtypes_and_partial_rotation(dtype, rotary_dim):+ from sgl_kernel_npu.norm.fused_rope_qk_mqa import (+ fused_rope_qk_mqa as original_rope,+ )++ from sglang.srt.hardware_backend.npu.rope import fused_rope_qk_mqa++ projection = torch.randn(3, 10, 64, device="npu", dtype=dtype)+ q, k = projection[:, :8], projection[:, 8:]+ cache = torch.randn(3, rotary_dim, device="npu", dtype=torch.float32)+ expected = original_rope(q, k, cache, rotary_dim, True)+ actual = fused_rope_qk_mqa(q, k, cache, rotary_dim, True)+ for output, reference in zip(actual, expected):+ torch.testing.assert_close(output, reference, rtol=0, atol=0)