mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #597] [CLOSED] HIP: optional host-side expert-copy waits (0.88% earlier warm-prefill gain) #617
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#617
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/597
Author: @LostVector
Created: 10/28/2026
Status: ❌ Closed
Base:
main← Head:upstream/hip-host-copy-wait📝 Commits (1)
71d9110HIP: add opt-in host wait before streamed expert-part reuse📊 Changes
6 files changed (+148 additions, -1 deletions)
View changed files
📝
CMakeLists.txt(+2 -0)➕
docs/DS4_HIP_HOST_COPY_WAIT.md(+29 -0)📝
docs/SETTINGS.md(+11 -0)➕
src/ds4/ds4_hip_copy_wait.hpp(+10 -0)📝
src/ds4/ds4_model.cu(+15 -1)➕
tests/ds4_hip_copy_wait_test.cu(+81 -0)📄 Description
An earlier matched EXL3 test measured 0.88% lower warm-2K prefill latency, with exact checked logits, by changing where Maya waits before reusing an expert buffer. This draft exposes that scheduling choice on current upstream, disabled by default.
In plain terms: before new weights overwrite a VRAM slot, the previous computation must finish reading it. Today the GPU copy stream waits for that event. This option makes the device worker's CPU thread wait instead, then queues the copy. It preserves the same event dependency and data; it can change HIP queue scheduling and reduce submission overlap, so the best choice depends on the workload/driver.
Focused change
MAYA_DS4_HIP_HOST_COPY_WAIT=1; nativeSTRATA_DS4_HIP_HOST_COPY_WAITandDS4_HIP_HOST_COPY_WAITaliases accepted.copy_aheadchanges; CUDA and the flow loader retain their existing paths.filled, the host staging lifetime still uses its existingfilledsynchronization, and both modes wait forfreedbefore slot overwrite. Return status uses existing model error handling.Why the host wait does not wait for an unsubmitted consumer
The queue condition is
cp < kp + P; for a reused slotcp >= P, so its prior batchcp - P < kp. The consumer recordsfreed[half]before incrementingkpand then callscopy_ahead. The event being waited on has therefore already been submitted. That invariant still holds at the current insertion point on v1.1.34 /249f9a8.Current-base validation
maya-ds4andds4_hip_copy_wait_testbuilds; executable help smoke passed.git diff --checkpassed. The existing serving process was not replaced.Historical timing scope
The earlier model test used two R9700s plus a 9070 XT, TP2/split36/4, 256K context, fixed expert residency/profile, and the earlier FMA16/packed-host/predecode/pruning stack. Warm 2048-token prefill used six balanced blocks / 24 observations: all blocks positive, mean latency reduction 0.8796%, block-based 95% interval 0.7483–1.0108%. Median 7518.923 → 7458.083 ms. Cold results were inconclusive; one decode pair established no speedup. Full cold/warm/repeat logits and 80 greedy tokens matched independent references, with zero cache moves and process swap in timing trials. Original fork PR #13 and raw protocol/results.
Those timings are evidence for the option, not measurements of this current-upstream port. Current batching/staging and surrounding kernels have evolved. A representative same-binary model comparison, including normal caching and multi-GPU execution, remains before any default recommendation. Documentation and the standalone reproducer are included.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.