Inspect · Checkpoints & weight state
Requested workspace inspection and file and log inspection related to checkpoints & weight state.
4 calls · #0001–#0004
ls <path>Read <path>wc -l <path> <path>Kimi K3 · RL
Qwen3-0.6B CodeOpt GRPO 1dev · Implementation Optimization
01 / PROCESS MAP
Compare agents on one time axis; overlapping spans line up vertically. Select an agent or bar to inspect its events.
Time starts at the first recorded activity. Select a bar or agent to open its events. Bars span the first and last recorded observation, including gaps; colored ticks mark tool calls. A hollow diamond marks a delegation whose child timing is unavailable.
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>. Each branch belongs to its named agent. Expand a delegation to inspect its child; branches can run concurrently. Call numbers preserve source order, not a serial schedule. Times are relative to the first recorded activity.
Requested workspace inspection and file and log inspection related to checkpoints & weight state.
4 calls · #0001–#0004
ls <path>Read <path>wc -l <path> <path>Requested source searches related to source & workspace.
4 calls · #0005–#0008
Search <pattern> <path>Requested source searches related to checkpoints & weight state.
1 call · #0009–#0009
Search <pattern> <path>Requested workspace inspection related to rollout generation.
1 call · #0010–#0010
ls <path> <path> <path> <path> <n> > <path>Requested file and log inspection, workspace inspection and source searches related to source & workspace.
2 calls · #0011–#0012
Read <path>ls <path>grep -r -n <val> <path>headRequested source searches and file and log inspection related to rollout generation.
8 calls · #0013–#0020
Search <pattern> <path>Read <path>Requested source searches related to source & workspace.
1 call · #0021–#0021
Search <pattern> <path>Requested file and log inspection related to rollout generation.
2 calls · #0022–#0023
Read <path>Requested file and log inspection and source searches related to source & workspace.
3 calls · #0024–#0026
Read <path>Search <pattern> <path>Requested source searches related to rollout generation.
2 calls · #0027–#0028
Search <pattern> <path>Requested file and log inspection related to source & workspace.
2 calls · #0029–#0030
Read <path>Requested file and log inspection and source searches related to rollout generation.
3 calls · #0031–#0033
Read <path>Search <pattern> <path>Requested source searches related to source & workspace.
2 calls · #0034–#0035
Search <pattern> <path>Requested dependency and build commands, file and log inspection and script or workload execution related to dependencies & build setup.
1 call · #0036–#0036
pip show <val> <val> <n> > <path>head -n <n>python -c <script> <n> >& <path>Requested source searches related to source & workspace.
1 call · #0037–#0037
Search <pattern> <path>Requested file and log inspection related to reward & policy updates.
2 calls · #0038–#0039
Read <path>Requested source searches related to checkpoints & weight state.
1 call · #0040–#0040
Search <pattern> <path>Requested file and log inspection, source searches and workspace inspection related to source & workspace.
6 calls · #0041–#0046
Read <path>Search <pattern> <path>ls <path> <n> > <path>head -n <n>Requested dependency and build commands, source searches and script or workload execution related to dependencies & build setup.
1 call · #0047–#0047
pip show -f <val> <n> > <path>grep <flag> <args>python3 -c <script> <n> > <path>find <path> -maxdepth <n> -iname <val>Requested source searches related to source & workspace.
1 call · #0048–#0048
Search <pattern> <path>Requested source searches related to device memory.
1 call · #0049–#0049
Search <pattern> <path>Requested file and log inspection related to source & workspace.
1 call · #0050–#0050
Read <path>Requested file and log inspection related to device memory.
1 call · #0051–#0051
Read <path>Requested source searches related to prefix caching.
1 call · #0052–#0052
Search <pattern> <path>Requested source searches related to source & workspace.
1 call · #0053–#0053
Search <pattern> <path>Requested source searches related to device memory.
1 call · #0054–#0054
Search <pattern> <path>Requested source searches related to checkpoints & weight state.
1 call · #0055–#0055
Search <pattern> <path>Requested file and log inspection related to source & workspace.
1 call · #0056–#0056
Read <path>Requested file and log inspection related to device memory.
1 call · #0057–#0057
Read <path>Requested file and log inspection related to rollout generation.
1 call · #0058–#0058
Read <path>Requested source searches related to device memory.
2 calls · #0059–#0060
Search <pattern> <path>Requested file and log inspection related to source & workspace.
1 call · #0061–#0061
Read <path>Requested file and log inspection related to rollout generation.
2 calls · #0062–#0063
Read <path>Requested source searches related to source & workspace.
1 call · #0064–#0064
Search <pattern> <path>Requested file and log inspection related to rollout generation.
1 call · #0065–#0065
Read <path>Requested file and log inspection and workspace inspection related to source & workspace.
2 calls · #0066–#0067
Read <path>echo <val>ls -l -a <val> <n> > <path>ls -l -a <path>head -n <n>Requested file and log inspection related to task requirements.
2 calls · #0068–#0069
Read <path>Requested workspace inspection and file and log inspection related to reward & policy updates.
1 call · #0070–#0070
find <path> -type <val>head -n <n>echo <flag>cat <path>Requested file and log inspection and task coordination related to source & workspace.
9 calls · #0071–#0079
Read <path>sed -n <val> <path>Update task list <tasks>Requested file and log inspection related to benchmark & validation setup.
1 call · #0080–#0080
cat <path>Requested environment setup or inspection, source searches and file and log inspection related to source & workspace.
4 calls · #0081–#0084
envgrep -E <val>sortecho <flag>cat <val> <n> > <path>head -n <n>sed -n <val> <val>Read <path>python3 -c <script> <n> >& <path>tail -n <n>Requested script or workload execution related to benchmark & validation setup.
1 call · #0085–#0085
bash <script> > <path> <n> >& <path>echo <val>Requested workspace inspection related to checkpoints & weight state.
1 call · #0086–#0086
ls <path> <path> <path> <path> <n> > <path>Requested file and log inspection related to task requirements.
1 call · #0087–#0087
Read <path>Requested task coordination related to checkpoints & weight state.
1 call · #0088–#0088
Delegate <task>Delegated by Main agent at call #0088.
Only the returned summary is retained; child tool events are not available.
Requested task coordination related to source & workspace.
1 call · #0089–#0089
Delegate <task>Delegated by Main agent at call #0089.
No child tool events are present in the retained trace.
Requested task coordination related to rollout generation.
1 call · #0090–#0090
Delegate <task>Delegated by Main agent at call #0090.
No child tool events are present in the retained trace.
Requested task coordination related to source & workspace.
1 call · #0091–#0091
Delegate <task>Delegated by Main agent at call #0091.
No child tool events are present in the retained trace.
Requested file and log inspection, workspace inspection and script or workload execution related to benchmark & validation setup.
2 calls · #0092–#0093
cat <path>echo <flag>ls -l -a <path> <n> > <path>cat <path> <n> > <path>head -n <n>python3 -c <script>Requested file and log inspection related to benchmark & validation setup.
1 call · #0094–#0094
tail -n <n> <path>Requested script or workload execution related to reward & policy updates.
1 call · #0095–#0095
python3 -c <script>Requested script or workload execution related to benchmark & validation setup.
1 call · #0096–#0096
bash <script> > <path> <n> >& <path>echo <val>Requested task coordination related to source & workspace.
1 call · #0097–#0097
Update task list <tasks>Requested source searches related to optimizer & gradients.
1 call · #0098–#0098
Search <pattern> <path>Requested file and log inspection related to source & workspace.
1 call · #0099–#0099
Read <path>Requested source searches related to optimizer & gradients.
2 calls · #0100–#0101
Search <pattern> <path>Requested source searches related to batching & scheduling.
1 call · #0102–#0102
Search <pattern> <path>Requested source searches and file and log inspection related to optimizer & gradients.
1 call · #0103–#0103
grep -n <val> <path>head -n <n>echo <flag>grep -r -n <val> <path>Requested file and log inspection related to source & workspace.
1 call · #0104–#0104
Read <path>Requested source searches and file and log inspection related to batching & scheduling.
1 call · #0105–#0105
grep -n <val> <path> <path> <n> > <path>echo <flag>grep -r -n <val> <path>headRequested file and log inspection related to source & workspace.
1 call · #0106–#0106
Read <path>Requested file and log inspection related to optimizer & gradients.
1 call · #0107–#0107
Read <path>Requested source searches, file and log inspection and workspace inspection related to source & workspace.
6 calls · #0108–#0113
grep -r -n <val> <path>headecho <flag>sed -n <val> <path>ls <path> <n> > <path>grep -r -n <val> <path> <n> > <path>grep -r -n <val> <path> -lgrep -n <val> -A <n> <path>head -n <n>grep -r -n <val> -A <n> <path>Read <path>Requested script or workload execution related to benchmark & validation setup.
1 call · #0114–#0114
python3 -c <script>Requested script or workload execution related to source & workspace.
1 call · #0115–#0115
python3 -c <script>Requested file and log inspection related to rollout generation.
2 calls · #0116–#0117
Read <path>sed -n <val> <path>echo <val>Requested file and log inspection related to source & workspace.
1 call · #0118–#0118
Read <path>Requested file and log inspection related to device memory.
1 call · #0119–#0119
Read <path>Requested file and log inspection related to task requirements.
1 call · #0120–#0120
Read <path>Requested file and log inspection related to source & workspace.
1 call · #0121–#0121
Read task output <task>Requested script or workload execution related to checkpoints & weight state.
1 call · #0122–#0122
python3 -c <script>Requested task coordination related to source & workspace.
1 call · #0123–#0123
Update task list <tasks>Requested source searches and file and log inspection related to rollout generation.
4 calls · #0124–#0127
grep -n <val> <path>head -n <n>Read <path>Requested workspace inspection and source searches related to benchmark & validation setup.
1 call · #0128–#0128
ls -l -a <path>grep -c <val> <path> <n> > <path>trueRequested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0129–#0129
grep -n <val> <path>head -n <n>Requested file and log inspection and source searches related to benchmark & validation setup.
1 call · #0130–#0130
awk <path> <path>head -n <n>echo <val>grep -n <val> <path>Requested file and log inspection related to rollout generation.
1 call · #0131–#0131
Read <path>Requested script or workload execution related to device memory.
2 calls · #0132–#0133
python3 -c <script>Requested workspace inspection, source searches and file and log inspection related to source & workspace.
2 calls · #0134–#0135
ls <path>grep -r -n <val> <path>head -n <n>grep -n <val> <path>Requested file and log inspection related to task requirements.
1 call · #0136–#0136
head -n <n> <path>echo <val>sed -n <val> <path>Requested source searches, file and log inspection and script or workload execution related to source & workspace.
8 calls · #0137–#0144
grep -n <val> <path>head -n <n>echo <val>grep -r -n <val> <path>headRead <path>cd <path>python3 -c <script> <n> >& <path>tail -n <n>Requested file and log inspection and workspace inspection related to rollout generation.
3 calls · #0145–#0147
Read <path>find <path> -name <path>xargs <val> <flag> <args>ls <path>Requested source searches and file and log inspection related to source & workspace.
1 call · #0148–#0148
grep -n <val> <path> <path> <path> <n> > <path>head -n <n>echo <val>grep -r -n <val> <path> <path> <n> > <path>headRequested source searches and file and log inspection related to rollout generation.
2 calls · #0149–#0150
grep -n <val> -A <n> <path>head -n <n>Read <path>Requested source searches and file and log inspection related to source & workspace.
1 call · #0151–#0151
grep -r -n <val> <path>head -n <n>Requested file and log inspection related to rollout generation.
2 calls · #0152–#0153
Read <path>Requested file and log inspection related to device memory.
1 call · #0154–#0154
Read <path>Requested source searches and file and log inspection related to checkpoints & weight state.
1 call · #0155–#0155
grep -r -n <val> <path> <path> <n> > <path>head -n <n>echo <val>grep -r -n <val> <path>headRequested file and log inspection, source searches and script or workload execution related to source & workspace.
6 calls · #0156–#0161
Read <path>grep -r -n <val> -A <n> <path> <n> > <path>head -n <n>grep -r -n <val> <path> --include <path> -lsed -n <val> <path>grep -n <val> <path>headpython3 <val>python3 -c <script> <n> >& <path>tail -n <n>Requested file and log inspection related to device memory.
1 call · #0162–#0162
Read <path>Requested code edits related to device memory.
2 calls · #0163–#0164
Edit <path>Requested code edits related to source & workspace.
1 call · #0165–#0165
Edit <path>Requested code edits related to rollout generation.
1 call · #0166–#0166
Edit <path>Requested source searches and file and log inspection related to rollout generation.
3 calls · #0167–#0169
grep -n <val> -A <n> <path>head -n <n>echo <val>grep -r -n <val> <path>headgrep -n <val> <path>sed -n <val> <path>Requested file and log inspection related to source & workspace.
1 call · #0170–#0170
Read <path>Requested code edits related to source & workspace.
1 call · #0171–#0171
Edit <path>Requested source searches and file and log inspection related to rollout generation.
3 calls · #0172–#0174
grep -n <val> <path>head -n <n>Read <path>grep -r -n <val> <path>echo <val>sed -n <val> <path>Requested script or workload execution related to benchmark & validation setup.
1 call · #0175–#0175
python3 -c <script>Requested file and log inspection related to source & workspace.
1 call · #0176–#0176
Read <path>Requested file and log inspection related to task requirements.
1 call · #0177–#0177
cat <path> <path>head -c <n> <path>Requested file and log inspection related to source & workspace.
1 call · #0178–#0178
Read <path>Requested source searches and file and log inspection related to batching & scheduling.
2 calls · #0179–#0180
grep -r -n <val> <path> <path> <path> <n> > <path>head -n <n>echo <val>grep -r -n <val> <path>grep -i <val>headRead <path>Requested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0181–#0181
grep -o <val> <path>head -n <n>Requested source searches and file and log inspection related to batching & scheduling.
2 calls · #0182–#0183
grep -o <val> <path>head -n <n>cut <flag>grep -r -n <val> <path> <n> > <path>grep -r -n <val> <path>headecho <val>Requested file and log inspection related to source & workspace.
1 call · #0184–#0184
sed -n <val> <path>Requested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0185–#0185
grep -o <val> <path>head -n <n>Requested source searches, file and log inspection and script or workload execution related to rollout generation.
1 call · #0186–#0186
grep -r -n <val> <path>grep -v <val>headecho <val>python3 -c <script>Requested source searches and file and log inspection related to device memory.
1 call · #0187–#0187
grep -n <val> <path>head -n <n>Requested script or workload execution related to benchmark & validation setup.
1 call · #0188–#0188
bash <script> > <path> <n> >& <path>echo <val>Requested file and log inspection and source searches related to rollout generation.
2 calls · #0189–#0190
Read <path>grep -n <val> <path>headecho <val>grep -r -n <val> <path>head -n <n>Requested source searches and file and log inspection related to attention kernels.
1 call · #0191–#0191
grep -r -n <val> <path> <path> <path> <n> > <path>headecho <val>grep -r -n <val> -A <n> <path>head -n <n>Requested file and log inspection and source searches related to runtime processes.
1 call · #0192–#0192
sed -n <val> <path>echo <val>grep -r -n <val> -A <n> <path>head -n <n>grep -r -n <val> <path> <n> > <path>headRequested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.
2 calls · #0193–#0194
sleep <n>ls -l -a <path> <n> > <path>tail -n <n> <path> <n> > <path>cut <flag>grep -a <val> <path>tail -n <n>Requested script or workload execution related to checkpoints & weight state.
1 call · #0195–#0195
python3 -c <script>Requested script or workload execution and file and log inspection related to benchmark & validation setup.
1 call · #0196–#0196
python3 -c <script> <n> > <path>tail -n <n> <path>cut <flag>Requested script or workload execution related to reward & policy updates.
1 call · #0197–#0197
python3 -c <script>Requested workspace inspection, source searches and file and log inspection related to source & workspace.
1 call · #0198–#0198
ls <path>grep -r -l -n <val> <path>headRequested source searches and file and log inspection related to device memory.
2 calls · #0199–#0200
grep -n <val> <path>head -n <n>Read <path>Requested script or workload execution related to benchmark & validation setup.
1 call · #0201–#0201
python3 -c <script>Requested script or workload execution, source searches and file and log inspection related to checkpoints & weight state.
1 call · #0202–#0202
python3 -c <script>grep -a <val> <path>head -n <n>cut <flag>Requested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0203–#0203
grep -a <val> <path>head -n <n>cut <flag>Requested code edits related to source & workspace.
1 call · #0204–#0204
Write <path>Requested script or workload execution, file and log inspection and source searches related to source & workspace.
2 calls · #0205–#0206
cd <path>python3 <script> <n> >& <path>tail -n <n>grep -a <val>head -n <n>Requested file and log inspection related to device memory.
1 call · #0207–#0207
Read <path>Requested code edits related to source & workspace.
1 call · #0208–#0208
Write <path>Requested script or workload execution, source searches and file and log inspection related to source & workspace.
1 call · #0209–#0209
cd <path>python3 <script> <n> >& <path>grep -a <val>head -n <n>Requested source searches and file and log inspection related to device memory.
1 call · #0210–#0210
grep -n <val> <path>headecho <val>sed -n <val> <path>Requested code edits related to source & workspace.
1 call · #0211–#0211
Edit <path>Requested file and log inspection related to source & workspace.
1 call · #0212–#0212
Read <path>Requested code edits related to source & workspace.
2 calls · #0213–#0214
Edit <path>Requested script or workload execution, source searches and file and log inspection related to source & workspace.
1 call · #0215–#0215
cd <path>python3 <script> <n> >& <path>grep -a <val>head -n <n>Requested code edits related to rollout generation.
2 calls · #0216–#0217
Edit <path>Requested source searches and file and log inspection related to rollout generation.
1 call · #0218–#0218
grep -r -n <val> <path>head -n <n>echo <val>grep -n <val> -A <n> <path>Requested source searches and file and log inspection related to source & workspace.
1 call · #0219–#0219
grep -r -n <val> -A <n> <path> --include <path>head -n <n>Requested code edits related to rollout generation.
2 calls · #0220–#0221
Edit <path>Requested source searches related to rollout generation.
1 call · #0222–#0222
grep -n <val> <path>Requested script or workload execution and source searches related to rollout generation.
1 call · #0223–#0223
cd <path>python3 - <script>grep -n <val> <path>echo <val>Requested script or workload execution related to benchmark & validation setup.
1 call · #0224–#0224
bash <script> > <path> <n> >& <path>echo <val>Requested task coordination and file and log inspection related to source & workspace.
2 calls · #0225–#0226
Update task list <tasks>diff < <path> <path> <path> < <path> <path> <path>head -n <n>wc -l <path>Requested execution waits, source searches and file and log inspection related to benchmark & validation setup.
3 calls · #0227–#0229
sleep <n>grep -a <val> <path> <n> > <path>tail -n <n>cut <flag>ls -l -a <path>tail -n <n> <path> <n> > <path>Requested script or workload execution related to checkpoints & weight state.
1 call · #0230–#0230
python3 -c <script>Requested script or workload execution and repository inspection related to rollout generation.
1 call · #0231–#0231
python3 -c <script>cd <path>git diff --statRequested task coordination related to source & workspace.
1 call · #0232–#0232
Update task list <tasks>03 / CANDIDATE ARTIFACT
Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.
Base commit: 0b2151ec61de5d99e0811b01c09e43a99a23e69d
@@ -840,7 +840,11 @@ class FSDPEngine(BaseEngine): per_tensor_param = ( ( name,- param.to(device, non_blocking=True).full_tensor().to(torch.bfloat16, non_blocking=True)+ # On a single-rank mesh the local shard already is the full+ # tensor, so skip the all-gather collective entirely.+ param.to(device, non_blocking=True).to_local().to(torch.bfloat16, non_blocking=True)+ if isinstance(param, DTensor) and param.device_mesh.size() == 1+ else param.to(device, non_blocking=True).full_tensor().to(torch.bfloat16, non_blocking=True) if isinstance(param, DTensor) else param, )@@ -339,6 +339,37 @@ class LLMServerManager: servers=dict(zip(self.server_addresses, self.server_handles, strict=True)), max_cache_size=DEFAULT_ROUTING_CACHE_SIZE, )+ # Eagerly initialize the load balancer actor (Ray spawns its process and+ # imports the rollout stack lazily on first RPC) and run one tiny+ # generation through each replica so that tokenizer/detokenizer init,+ # input processing and sampler/graph warmup happen now, during server+ # setup, instead of inside the first training-loop generation.+ try:+ await self._warmup_server_replicas()+ except Exception as exc:+ # Warmup is a pure latency optimization; never let it break startup.+ logger.warning(f"LLM server warmup failed (continuing without it): {exc}")++ async def _warmup_server_replicas(self) -> None:+ await self.global_load_balancer.get_status.remote()+ client = self.get_client()+ await asyncio.gather(+ *[+ client.generate(+ request_id=f"warmup-{server_index}",+ prompt_ids=[0],+ sampling_params={+ "temperature": 0.7,+ "top_p": 0.8,+ "top_k": 20,+ "max_tokens": 1,+ "logprobs": True,+ "seed": 0,+ },+ )+ for server_index in range(len(self.server_handles))+ ]+ ) def get_client(self, client_cls=LLMServerClient, **kwargs) -> LLMServerClient: """Get the LLMServerClient to request LLM server replicas.@@ -17,7 +17,6 @@ Bucketed weight transfer via ZMQ + IPC (or shared memory fallback). Not recommended depending on vllm for this file. """ -import gc import logging import os from multiprocessing import shared_memory@@ -202,6 +201,9 @@ class BucketedWeightSender: os.remove(ipc_path) except OSError: pass+ # Drop the buffer reference only; the torch caching allocator will reuse+ # the block on the next sync, and skipping gc.collect()/ipc_collect()/+ # empty_cache() here avoids several hundred ms of per-update overhead. del self.buffer self.buffer = None if self.shm is not None:@@ -209,9 +211,6 @@ class BucketedWeightSender: self.shm.unlink() del self.shm self.shm = None- gc.collect()- get_torch_device().ipc_collect()- get_torch_device().empty_cache() def _direct_send_large_weight(self, name: str, weight: torch.Tensor): """Send a weight larger than the bucket size via cuda ipc or share memory."""@@ -322,12 +321,12 @@ class BucketedWeightReceiver: # Synchronize before releasing the buffer to ensure all async ops # referencing it (e.g. clone, .to()) have completed. get_torch_device().synchronize()+ # Drop the buffer reference only; the mapped IPC memory is released by+ # the tensor destructor. Skipping gc.collect()/ipc_collect()/+ # empty_cache() avoids noticeable per-update overhead. del self.buffer self.buffer = None if self.shm is not None: self.shm.close() del self.shm self.shm = None- gc.collect()- get_torch_device().ipc_collect()- get_torch_device().empty_cache()@@ -267,6 +267,11 @@ class vLLMHttpServer: "enforce_eager": self.config.enforce_eager, "gpu_memory_utilization": self.config.gpu_memory_utilization, "disable_log_stats": self.config.disable_log_stats,+ # verl's server clients consume only the final output of each+ # request; delivering intermediate engine outputs less often+ # reduces per-step IPC/serialization overhead without changing+ # any returned content.+ "stream_interval": 16, "tensor_parallel_size": self.config.tensor_model_parallel_size, "seed": self.replica_rank + (self.config.get("seed") or 0), "override_generation_config": json.dumps(override_generation_config),@@ -501,6 +506,10 @@ class vLLMHttpServer: f"max_tokens {max_tokens} not in valid range [1, {max_possible_tokens}]" ) sampling_params["logprobs"] = 0 if sampling_params.pop("logprobs", False) else None+ # Token-in-token-out path: the returned TokenOutput carries token ids and+ # per-token logprobs only, so incremental detokenization in the engine is+ # pure overhead. Disable it unless the caller explicitly asked for text.+ sampling_params.setdefault("detokenize", False) sampling_params.setdefault("repetition_penalty", self.config.get("repetition_penalty", 1.0)) sampling_params = SamplingParams(max_tokens=max_tokens, **sampling_params) prompt_ids = qwen2_5_vl_dedup_image_tokens(prompt_ids, self.model_config.processor)Base commit: f649187194c44d86415d1ddfa49359e824932c9a
@@ -79,6 +79,10 @@ class AllocationData: handle: HandleType tag: str cpu_backup_tensor: torch.Tensor | None = None+ # Tracks whether the physical pages of this allocation are currently+ # mapped. Selective sleep only releases a subset of the allocations, so+ # wake_up must skip the ones that were never unmapped.+ is_mapped: bool = True def create_and_map(allocation_handle: HandleType) -> None:@@ -174,13 +178,21 @@ class CaMemAllocator: data.cpu_backup_tensor = None return data.handle - def sleep(self, offload_tags: tuple[str, ...] | str | None = None) -> None:+ def sleep(+ self,+ offload_tags: tuple[str, ...] | str | None = None,+ release_tags: tuple[str, ...] | str | None = None,+ ) -> None: """ Put the allocator in sleep mode. All data in the memory allocation with the specified tag will be offloaded to CPU memory, and others will be discarded. :param offload_tags: The tags of the memory allocation that will be offloaded. The rest of the memory allocation will be discarded.+ :param release_tags: When set, only allocations with these tags are+ unmapped/released and allocations with any other tag are kept+ mapped and intact. When None (default), every tracked allocation+ is released. """ if offload_tags is None: # by default, allocated tensors are offloaded@@ -188,10 +200,14 @@ class CaMemAllocator: offload_tags = (CaMemAllocator.default_tag,) elif isinstance(offload_tags, str): offload_tags = (offload_tags,)+ if isinstance(release_tags, str):+ release_tags = (release_tags,) assert isinstance(offload_tags, tuple) for ptr, data in self.pointer_to_data.items():+ if release_tags is not None and data.tag not in release_tags:+ continue handle = data.handle if data.tag in offload_tags: size_in_bytes = handle[1]@@ -202,16 +218,21 @@ class CaMemAllocator: memcpy(cpu_ptr, dest_max, ptr, size_in_bytes, ACL_MEMCPY_DEVICE_TO_HOST) data.cpu_backup_tensor = cpu_backup_tensor unmap_and_release(handle)+ data.is_mapped = False def wake_up(self, tags: list[str] | None = None) -> None: """ Wake up the allocator from sleep mode. All data that is previously offloaded will be loaded back to GPU- memory, and the rest of the data will have empty memory."""+ memory, and the rest of the data will have empty memory.+ Allocations that were kept mapped by a selective sleep are left+ untouched.+ """ for ptr, data in self.pointer_to_data.items():- if tags is None or data.tag in tags:+ if not data.is_mapped and (tags is None or data.tag in tags): handle = data.handle create_and_map(handle)+ data.is_mapped = True if data.cpu_backup_tensor is not None: cpu_backup_tensor = data.cpu_backup_tensor if cpu_backup_tensor is not None:@@ -194,7 +194,18 @@ class NPUWorker(WorkerBase): model = self.model_runner.model self._sleep_saved_buffers = {name: buffer.cpu().clone() for name, buffer in model.named_buffers()} allocator = CaMemAllocator.get_instance()- allocator.sleep(offload_tags=("weights",) if level == 1 else tuple())+ if level == 1:+ # Colocated RL fast path: the KV cache is logically reset by the+ # engine on sleep and never needs to be preserved, so keep it+ # mapped and skip the expensive unmap/remap of its pages. Weights+ # are still offloaded to CPU (and only their pages released):+ # besides parameters - which the subsequent weight sync rewrites+ # anyway - the weights pool also holds static buffers (e.g. rotary+ # cos/sin caches) that load_weights does not restore, so their+ # contents must survive the sleep/wake cycle.+ allocator.sleep(offload_tags=("weights",), release_tags=("weights",))+ else:+ allocator.sleep(offload_tags=("weights",) if level == 1 else tuple()) free_bytes_after_sleep, total = torch.npu.mem_get_info() freed_bytes = free_bytes_after_sleep - free_bytes_before_sleep used_bytes = total - free_bytes_after_sleep