[PR #1001] [CLOSED] generate: wait for the residency table's upload before the next window (#871) #2955

Closed
opened 2026-11-04 02:04:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1001
Author: @ischencheng
Created: 10/5/2026
Status: ❌ Closed

Base: main ← Head: fix/residency-upload-order


📝 Commits (10+)

  • fa16567 setup: an earlier config that does not parse is skipped, not a crash; configs are written atomically (#459)
  • 749d957 setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446)
  • 5a30024 calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447)
  • 9f60d13 serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448)
  • eb8da1d /metrics: each request's speculative draft counts, and their sums in the totals (#457)
  • 6a09387 setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)
  • d6a91e2 docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)
  • d8d4ad3 Merge branch 'f-135-eng' into rel-0.1.35
  • 7b600d5 Merge branch 'f-135-small' into rel-0.1.35
  • d9ab843 Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it

📊 Changes

1 file changed (+8 additions, -2 deletions)

View changed files

📝 src/program/generate.cpp (+8 -2)

📄 Description

On a card that holds every expert, a fresh prompt longer than --short-read answers !!!! (#871). The batched read lends cache slots to the prompt path (their host_res entries become -1), refill gives them back, and res_upload copies host_res to d_res with a plain cudaMemcpy from a std::vector. For pageable memory CUDA only promises the data is staged when that call returns, not that the DMA has landed, and the verify windows run on non-blocking streams that are not ordered after it. If the first zero-doorbell window still sees a -1, resident_plan_kernel returns without writing the plan (skip is null on that path) and the window computes with an old one.

res_upload now waits for each copy (cudaStreamSynchronize(0) after it). It runs at a lend, a refill, a VRAM resize and an adaptive swap, not per token.

Measured on an L40S (49140 MiB, sm_89, the same size as the 48 GB 4090 in the issue), Linux, IQ2_XS, expert cache 24576 slots with the zero-doorbell graph, setup's config with --max-context 32768. Five fresh prompts over 64 tokens at temperature 0, plus one short one:

engine !!!! replies
main 0 / 5
main, table DMA delayed 50 ms (debug probe) 5 / 5
this PR, same probe 0 / 5
this PR 0 / 5, same replies as main, same decode rate (220 tok/s)

On Linux the copy lands in time, so main never failed here. The probe (a cudaLaunchHostFunc that sleeps 50 ms on stream 0, followed by an async copy of the table) makes the late landing that CUDA allows happen every time. The 41-token prompt was fine in every run, as in the issue. I haven't tested on Windows, where it was reported; my guess is that WDDM batching is what delays the copy there.

Side note on #646: on this card the zero-doorbell graph decodes at 216-220 tok/s, against 179 tok/s with STRATA_VERIFY_ALL_RESIDENT=0 (343-token prompts, 31-36 tokens out).

Should fix #871.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1001 **Author:** [@ischencheng](https://github.com/ischencheng) **Created:** 10/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/residency-upload-order` --- ### 📝 Commits (10+) - [`fa16567`](https://github.com/Niko1221/Strata/commit/fa165679f9860552ac97ebd07118bb8db286be4a) setup: an earlier config that does not parse is skipped, not a crash; configs are written atomically (#459) - [`749d957`](https://github.com/Niko1221/Strata/commit/749d957a1790b1a171dd4a01ab3e31b3882c9892) setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446) - [`5a30024`](https://github.com/Niko1221/Strata/commit/5a3002446dbb9dfcabb7d0bd9f113da90cc2f3c0) calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447) - [`9f60d13`](https://github.com/Niko1221/Strata/commit/9f60d13246e46b02b1dd0841980b4d18b0faaea7) serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448) - [`eb8da1d`](https://github.com/Niko1221/Strata/commit/eb8da1d8c26ec41e6ffb084fdf579dba7cad10bd) /metrics: each request's speculative draft counts, and their sums in the totals (#457) - [`6a09387`](https://github.com/Niko1221/Strata/commit/6a093874fe037020f49bd5cf053879ff6a133c21) setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444) - [`d6a91e2`](https://github.com/Niko1221/Strata/commit/d6a91e2d1770d0f469d6ec15890acc7ee93e764c) docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438) - [`d8d4ad3`](https://github.com/Niko1221/Strata/commit/d8d4ad337d3c98ba21d3bd0af1a16e9177e112b6) Merge branch 'f-135-eng' into rel-0.1.35 - [`7b600d5`](https://github.com/Niko1221/Strata/commit/7b600d55ff801caaaa11542af1523050992e049b) Merge branch 'f-135-small' into rel-0.1.35 - [`d9ab843`](https://github.com/Niko1221/Strata/commit/d9ab8435f654c368c586340d490915f6addf56a3) Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it ### 📊 Changes **1 file changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/program/generate.cpp` (+8 -2) </details> ### 📄 Description On a card that holds every expert, a fresh prompt longer than `--short-read` answers `!!!!` (#871). The batched read lends cache slots to the prompt path (their `host_res` entries become -1), `refill` gives them back, and `res_upload` copies `host_res` to `d_res` with a plain `cudaMemcpy` from a `std::vector`. For pageable memory CUDA only promises the data is staged when that call returns, not that the DMA has landed, and the verify windows run on non-blocking streams that are not ordered after it. If the first zero-doorbell window still sees a -1, `resident_plan_kernel` returns without writing the plan (`skip` is null on that path) and the window computes with an old one. `res_upload` now waits for each copy (`cudaStreamSynchronize(0)` after it). It runs at a lend, a refill, a VRAM resize and an adaptive swap, not per token. Measured on an L40S (49140 MiB, sm_89, the same size as the 48 GB 4090 in the issue), Linux, IQ2_XS, `expert cache 24576 slots` with the zero-doorbell graph, setup's config with `--max-context 32768`. Five fresh prompts over 64 tokens at temperature 0, plus one short one: | engine | `!!!!` replies | |---|---| | main | 0 / 5 | | main, table DMA delayed 50 ms (debug probe) | 5 / 5 | | this PR, same probe | 0 / 5 | | this PR | 0 / 5, same replies as main, same decode rate (220 tok/s) | On Linux the copy lands in time, so main never failed here. The probe (a `cudaLaunchHostFunc` that sleeps 50 ms on stream 0, followed by an async copy of the table) makes the late landing that CUDA allows happen every time. The 41-token prompt was fine in every run, as in the issue. I haven't tested on Windows, where it was reported; my guess is that WDDM batching is what delays the copy there. Side note on #646: on this card the zero-doorbell graph decodes at 216-220 tok/s, against 179 tok/s with `STRATA_VERIFY_ALL_RESIDENT=0` (343-token prompts, 31-36 tokens out). Should fix #871. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:04:28 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2955
No description provided.