mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #618] [CLOSED] ds4: Pool::start fences its generation store before the sleeper load, and a worker starts from generation 0 (either could leave a batch nobody helps unrun) #626
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#626
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/mw00/project-maya/pull/618
Author: @SeriousRising
Created: 10/28/2026
Status: ❌ Closed
Base:
main← Head:ds4-pool-start-fence📝 Commits (1)
84db9a0ds4: Pool::start fences its generation store before the sleeper load, and a worker starts from generation 0 (either could leave a batch nobody helps unrun)📊 Changes
2 files changed (+45 additions, -2 deletions)
View changed files
📝
src/ds4/ds4_pool.hpp(+4 -1)📝
tests/ds4_pool_test.cpp(+41 -1)📄 Description
Fixes #615.
What. Two lines in
src/ds4/ds4_pool.hpp, for the two ways a worker could sleep through a batch (#615):Pool::start():std::atomic_thread_fence(std::memory_order_seq_cst)between thegen_store and thesleeping_load. Without it x86 may readsleeping_beforegen_is visible, and a worker going to sleep at that instant misses both the generation and the notify.loop():seen = 0(the value ofgen_at construction) instead ofgen_.load()when the thread first runs, so a batchstart()ed before the thread ran is still new to it.Test.
tests/ds4_pool_test.cppgainspool_start_wakes_sleeper: 200000 one-job batches on a one-worker pool,spin_us = 0,start()+wait()and nohelp(), with a watchdog (5 s without progress fails). Build as the file's header says (g++ -std=c++17 -O2 -pthread -I src/ds4 tests/ds4_pool_test.cpp). 10 runs each:ds4_pool.hppseen = 0onlyOutput: unchanged. Speed: no cost visible. Engine on 2x CMP 170HX 64 GB (sm_80, CUDA 12.8; PCIe Gen2 x16 + Gen2 x4), 16-vCPU Xeon E5-2697 v4 VM, DeepSeek-V4.1-Flash-1017 GSQ-RCO IQ2_XXS,
--tp 1 --gpus 0,1 --dspark on --cpu-threads 14 --suffix-draft 0, ~2240 routed experts on the CPU lane: 2000 fixed prompt ids + 256 greedy tokens give the same ids and DSpark counts as v1.1.35; decode 40.68 (v1.1.35) / 40.99 (this PR) tok/s, one run each. Onemfenceperstart()is ~16-30 a token, a few µs of a ~26 ms token (estimate).Checks (as
.github/workflows/tests.yml):tools/check_hip_compat.pyOK; server tests 463 OK (12 skipped); installer and tools tests 584 OK (31 skipped) - the same counts as v1.1.35.Not touched:
glmfast::Workers(src/core/glm_fast_state.hpp:164-165,:202) has the same shape; noted in #615, not tested.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.