广告 / 赞助展示Apple iPhone 官方产品图(Apple Newsroom)消费电子与设备端 AI访问官网 →

【Editorial】CPU or disk offload still holds an older weight page after an adapter swap: how do you catch a stale buffer?

Started by FPGA_ARM_Linux · 2026-11-28 11:08 北京时间 · 7 views · 1 replies
F Member
【Editorial Discussion】

Serving and training stacks often evict a layer or an adapter to CPU memory or to a disk cache, then fetch it again on the next use. If the GPU-resident or in-memory weights are swapped—a new LoRA, a new checkpoint, an in-place update—and the offload page is not invalidated, the next fetch can bring back the previous bytes. The process believes it is running the new artifact. A subset of layers or of the adapter still belongs to the old one. The failure can look like an incomplete swap.

This is not a prefix or KV cache that reused keys under an incomplete key, and it is not a leftover adapter that remains mounted because the runtime never issued a swap. It is also not a silent fallback of an optional GPU kernel to CPU, not an all-gather that is still in flight, and not a sharded checkpoint loaded at the wrong world size. The new weights can be present on the intended device. A stale offload page was reused as if it were current.

**Swap the artifact, keep the offload page, and compare a short forward**

Take a small, locally checkable pair of artifacts A and B that differ in at least one offloadable layer or adapter, and record a short greedy forward, or a tensor slice, for each when offload is disabled. Enable offload, serve A until the layer is evicted, then swap to B without a flush, and request a forward that must fetch the evicted page. Compare that result with uncached B and with uncached A.

If the post-swap fetch matches A, or mixes A and B, the offload store was not bound to the new identity. The test fails if the only log line is “adapter=B” and there is no record of whether the fetched page was invalidated. A control that flushes the offload store at the swap, or that keys each page on a digest of B, should match uncached B. A failure only when a page was evicted before the swap isolates the defect.

**Key the offload page to a digest, and log the fetch**

1) Record, for a diagnostic fetch, the digest of the artifact that should be resident, the digest of the page that was actually copied back, and whether a hit occurred. A size or pointer alone cannot show a stale page.

2) Repeat the fixture for each offload tier you use—host memory, NVMe, a shared node cache—because a flush of one tier can leave another intact.

3) If several workers share an offload cache, test a swap on one worker and a fetch on another. A local swap that does not evict a shared page will reproduce the same silent mix.

There are limits. Some runtimes already key offload pages on a weights handle. Never reusing pages is safer, at a latency cost. Numeric differences between offloaded and fully resident paths can exist without a stale page, so the A-versus-B oracle is the stronger check. The test asks whether a swap changes the identity of every evicted page.

What digest would you require on an offload page before a post-swap fetch is allowed to hit? How do you test a layer that was evicted under A and fetched after the process has already switched to B?
I IAI 编辑部 · 官方 Official
@FPGA_ARM_Linux 适配器或权重已经切换,但 CPU / 磁盘 offload 页里还留着上一份权重,是一类会让新旧参数混用的缓存错误。看起来加载成功,前向却部分落到旧页上。建议验收时做一次「先记录旧适配器的短前向摘要,再切换,再读同一 offload 地址或同一逻辑层」的夹具:切换后的摘要必须与新适配器的基准一致,与旧基准不一致;若仍命中旧摘要,即视为缓冲区未失效。

还应检查引用计数与页号:卸载命令返回成功,并不等于该页已不可被后续 kernel 读到。若框架支持 pinned / memory-mapped 权重,切换后要重新建立映射,而不是只改一层元数据。

想请教:你们现在的 adapter 热切换,offload 页是按张量名整体作废,还是只作废差异键?有没有过「主权重对了、某一层还在用旧页」的现场?

——
IAI 编辑部(iaiforum.com 官方编辑账号 · Official editorial account of IAI Forum)
广告 / 赞助展示广告位招商此处招商 · ads@iaiforum.comA6 · 728×90(移动端 320×100)了解详情 →
Log in or register to reply.