mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #302] [CLOSED] HIP/Windows: batch expert copy dependencies in long prefill #2563
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#2563
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/302
Author: @araujoluks
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:perf/hip-windows-prefill-copy-batching📝 Commits (4)
5d852e8HIP/Windows: batch expert copy dependencies in long prefill2888abaHIP: add staging ownership regression test and document opt-in1339041HIP: reset staging state for empty generations606f5d6HIP: cover GPU copy grouping and event ordering📊 Changes
7 files changed (+690 additions, -125 deletions)
View changed files
📝
CMakeLists.txt(+10 -0)➕
docs/HIP_WINDOWS_PREFILL.md(+69 -0)➕
src/prefill/copy_groups.hpp(+68 -0)📝
src/prefill/prefill.cpp(+57 -125)➕
src/prefill/stager.hpp(+178 -0)➕
tests/hip/prefill_copy_groups.cpp(+224 -0)➕
tests/hip/prefill_stager.cpp(+84 -0)📄 Description
What
Long-prefill HIP/Windows issued completion/reuse dependencies at expert granularity. This groups those dependencies while preserving the individual expert copies, sources, destinations, bytes and logical order.
Why
On one RX 9070 XT / gfx1201 / HIP 7.2 / Windows, dependency management substantially reduced effective prefill throughput. This changes dependency granularity; it does not combine transfers or change kernel arithmetic.
Implementation
copiedrecord and one terminalusedreuse wait.dma_donerecord. Each reused host buffer still waits for DMA completion before CPU memcpy.copied/slot dependencies.STRATA_HIP_COPY_BATCH,STRATA_HIP_STAGE_BATCH,STRATA_HIP_STAGE_COPY_BATCHare opt-in and guarded to HIP/Windows. Short prefill and decode retain their existing paths.STRATA_PREFILL_TIMINGenables mechanical counts; no new production synchronization is added for diagnostics.Performance
Base: current
main,30ec18e, engine 0.1.30. Same Release executable for both arms; two independent processes per arm, each with 2 warmups + 3 samples. Main table is the median of six measured samples per arm; cold requests are excluded.Qwen3.8-Flash-Next Q2_0; fixed 4,206 IDs / 4,205 processed by
Prefill::run; cache 6,500; context 32,768; KV int8; MTP/spec4; auto request chunk 4,352; 1,575 borrowed slots; prompt reuse disabled. Windows / HIP 7.2 / RX 9070 XT / gfx1201.Prefill::runwallIndependent repetition medians: 669.9 → 1,111.6 PP and 672.8 → 1,087.7 PP. RAM was sampled every 0.5 s with the unchanged 2 GiB availability watchdog. No TG improvement is claimed; these were prefill requests with one generated token.
Same payloads per request: 19,651 copies, 13,938 direct pinned, 5,713 staged, 27,165,542,400 H2D bytes (19,267,891,200 direct + 7,897,651,200 staged).
Warmed application-operation counters:
copiedrecordscopiedrecordsdma_donerecordsThese do not count all HIP API calls or measure hardware bus bandwidth. Compute-side consumption and
usedrecords are preserved.Correctness
Separate diagnostic A/B on this patch and current main, two identical requests per arm:
hip_prefill_stager: 1,020 ownership cases with byte-exact DMA readback, batches 1/2/4/8/16, job counts 1/15/16/17/31/32/33/65, rings 16/17, wraps, partial aborts, repeated finish and generations.The additional, unmodified upstream
hip_handofftest reportsseparate copy/ring timeout(exit 10) on this Windows/HIP system. Its target links only unchanged kernels/runtime, not prefill; this PR does not resolve that standalone doorbell issue. This is not a claim that the whole HIP suite passed.Full residual/cache instrumentation and raw local results are excluded from the patch.
Scope / limitations
Measured on one RX 9070 XT, Windows HIP 7.2. No CUDA/Linux/other AMD GPU performance or runtime-validation claim. Default-on elsewhere is not justified by this single-platform result.
No kernel, model, quality-setting, quantization, routing, cache-policy/size, MTP/spec, or decode changes. Current upstream GDN pipeline, MTP batching, gfx1201 dot4, session carve, doorbells and stream threshold are preserved. No research kernels, tracing tooling, model dumps or local paths are included.
Copilot review follow-up
1339041resets jobs, counters, submission state and generation even for empty staging lists. The production stager fixture now covers nonempty → empty → nonempty and passes 1,020 cases.606f5d6extracts the unchanged group planner and event contract into a private helper shared with production. The GPU fixture passes 216 generations with direct, pinned-staged and forced-pageable sources, GPU rings 8/17/32, host rings 16/17, both batching settings enabled, repeated wraps and skipped/unrouted entries. An independent maximal-group oracle checks boundaries/window release; a held terminal used event verifies the actual reuse wait and terminal copied recording/publication. DMA payload readback is byte-exact. The issuer join guard now outlives its captured planner/bookkeeping on early return.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.