mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4211] [CLOSED] [Engine] dsv41: a layer split's chunked prompt no longer deadlocks (wait for the other group's flag on the host first) #4952
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#4952
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/4211
Author: @wyxu95
Created: 10/26/2026
Status: ❌ Closed
Base:
main← Head:dsv41-layer-split-host-wait📝 Commits (1)
8f8bba7DeepSeek engine: a layer split's chunked prompt no longer deadlocks - the host waits for another group's flag before it queues the device-side wait (2x H100, IST-DAS-2.25bpw)📊 Changes
1 file changed (+25 additions, -3 deletions)
View changed files
📝
src/dsv41/ds4_model.cu(+25 -3)📄 Description
Draft PR, not ready for review: the HIP and Windows builds and other GPUs are not run, and the requests below ran
at
7dd5cf18e, not at this branch's base (see Validation).Problem and result
On a two-GPU layer split, every prompt that takes the chunked prompt path never finished. The engine stopped
answering, and the server's watchdog ended it after 955 s ("the engine said nothing ... during the request").
The layer split comes from the pack: the IST-DAS-2.25bpw (IQ2_XS) experts' 256-value blocks do not split
n_ff 2304, so
--tp 2falls back to whole layers per GPU (tensor parallel 2 -> 1).at about 128 W, and GPU 0 showed 0%. One engine thread was busy. The windowed path (
--prefill-chunk 0) worked,at about 135 tok/s.
is unchanged (numbers below).
Related: #4090 shows the same stall on 2x RTX 5090 under WSL2 (intermittent there). This change was not tested
on that machine.
What stalled
Temporary stderr prints (not part of this PR) showed where each device's thread stopped in
run_dev_chunks:xfer_getfor chunk 0's hand-off into layer 19 and for its source rows from layer 14. Then itsthread called
cublasSgemminhc_mix_chunk(layer 19). The call did not return.cublasSgemminhc_mix_chunk(layer 0). The call did not return, and device 0 queued nothing more.So device 1's wait kernel spun for a hand-off that device 0 never started. Why a
cublasSgemmcall blocks whilea wait kernel spins on the same device, and why device 0's call blocks too, is not established here. This part
is inferred, not confirmed: something in the cuBLAS or driver call waits on the device, and the other device's
thread waits behind it.
These did not change the stall (each with a fresh prompt of 243-247 or about 1,600-2,000 tokens):
--threads on,--prefill-chunk 2048,--dspark none(a clean split, layers 0-19 and 20-39 plus the head, every expert inVRAM),
DS4_FLOW=0,--mmap-experts off,CUDA_MODULE_LOADING=EAGER,CUDA_MODULE_LOADING=EAGERwithCUDA_MODULE_DATA_LOADING=EAGER, and a cuBLAS workspace set at handle creation (cublasSetWorkspace, 32 MiB).Approach
Before the chunk path queues a device-side wait for another group (
xfer_getorwait_flags), the host nowpolls the same host-mapped flag until it is up. The kernel then finds the flag up and never spins. This covers
the four cross-group waits of the chunk path: the hand-off into a group, the hand-off acknowledgements, the
source rows, and their acknowledgements.
host_wait_at_leastuses the kernels' test (flag - seqas a signeddifference, so a wrapped counter still works). It yields first, then sleeps 20 us between reads.
queues the waiting group's work changes.
Validation
Environment: 2x NVIDIA H100 80GB HBM3 (NVLink NV18, PCIe 5.0 x16), driver 580.126.09, CUDA 13.0 (nvcc V13.0.88),
Ubuntu 24.04.5 in a container, kernel 6.8.0-100, Xeon Platinum 8480C, 2 TB RAM. Model files are on a network
filesystem (WekaFS). Source
7dd5cf18e(engine 0.1.49.2) plus this patch. Pack IST-DAS-2.25bpw, served throughserve/server.pywithgpu [0, 1]and--max-context 1048576 --eos 1 --dspark auto --dspark-conf 0.65.Every expert sits in VRAM except 274 on the CPU lane.
Build:
cmake -S . -B build-dsv41 -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=90 -DSTRATA_BUILD_TESTS=OFF -DSTRATA_BUILD_DSV41=ON -DSTRATA_NATIVE_EXPERTS=ON, thencmake --build build-dsv41 --target strata-dsv41.Passed (patched build, default chunked prompt path; every prompt is fresh text with no prefix reuse). The
rates are the engine's own "read in" figures:
--prefill-chunk 0execagainst the server, 2 runsObserved, not explained: right after an engine start, the second request read at about 130 tok/s twice (1,653
and 1,958 tokens). Later requests in the same run were fast, and it did not occur in the five-request run.
This branch is on
4b9e05a. The patch applied there with a three-way merge, and its added and removed lines arethe ones tested at
7dd5cf18e. Between the two revisions, the four waits did not change. Two changes nearby: theprompt path is now chosen from the prompt's length (the chunked pass from 96 tokens,
dfd1b0f), andforward_chunksnow takes the warm-up lock first.Passed at
4b9e05awith this patch: the build above (CUDA 13.0, sm_90) linksstrata-dsv41. Its only warningsare three unused declarations in
ds4_tq.cu, which this change does not touch.Failed: none observed with the patch.
Not run:
4b9e05a.splits where the unpatched chunk path works (#4147, #4042).
ahead, so a later group's work is queued later. The effect is unmeasured.
this machine; its chunk path worked before the patch, and it was not re-run with the patch.
Limits
cublasSgemmcall is inferred, not confirmed.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.