mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1043] [CLOSED] generate: residency-table uploads wait for their own copy before the non-blocking streams read the table #2991
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2991
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1043
Author: @sergqwer
Created: 10/6/2026
Status: ❌ Closed
Base:
main← Head:pr/res-upload-order📝 Commits (1)
000f288generate: residency-table uploads wait for their own copy before the non-blocking streams read the table📊 Changes
1 file changed (+16 additions, -9 deletions)
View changed files
📝
src/program/generate.cpp(+16 -9)📄 Description
Replaces #550. GitHub closed it on 2026-10-05, when my fork was made private by mistake: that took the fork out of the network for good, so it can no longer open pull requests. This is the same branch and commit (
000f288), opened from a new fork; the discussion and the measurements are in #550.Every upload of the expert residency table, host_res to
d_resand each stage's, is a plaincudaMemcpy(src/program/generate.cpp, 9 call sites). The kernels that read the table run on streams createdcudaStreamNonBlocking.cudaMemcpymay return once the data is staged, before its DMA has landed.So nothing orders a kernel enqueued right after an upload (the next verify window after an adaptive swap, a trim, a refill) behind the copy. That kernel could read a table half old, half new: an expert computed by both the GPU and the CPU, or by neither.
The table is ~100 KB and usually lands in microseconds, so this rarely fires. It is the same class as #532 and #536, where the tests' uploads raced their non-blocking streams. Ours made one of those tests fail in 6 of 20 runs.
Fix: the uploads go through
res_put(), which waits for the copy on the current device's legacy stream (cudaStreamSynchronize(cudaStreamLegacy)): that copy only, not the device.Measured on an RTX 5090, IQ2_XS (ISTA),
--expert-cache 14900, v0.1.37 against this PR:--stop-eos), 6 interleaved pairs: 15.82 ms a round against 15.93 (+0.7%, within noise). One more pair is left out: 19.80 ms on a different token path, a desktop stall.🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.