mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #592] HIP: automatically select exact TP2 prefill transport at startup #615
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#615
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/592
Author: @LostVector
Created: 10/28/2026
Status: 🔄 Open
Base:
main← Head:upstream/hip-peer-prefill📝 Commits (5)
56141a4HIP: add opt-in exact peer-VRAM prefill reductions with steady deadlines51b4c1dHIP: auto-select exact TP2 prefill transport with bounded startup calibration0ce3d7fKeep expected not-ready polling status out of launch-error checksc32c221Document automatic HIP prompt transport selection and overridesd6aab91Record current-base model startup and transport smoke validation📊 Changes
8 files changed (+803 additions, -0 deletions)
View changed files
📝
CMakeLists.txt(+5 -0)➕
docs/HIP_PEER_PREFILL.md(+48 -0)📝
docs/SETTINGS.md(+1 -0)📝
src/ds4/ds4_kernels.cu(+65 -0)📝
src/ds4/ds4_kernels.cuh(+40 -0)📝
src/ds4/ds4_model.cu(+222 -0)➕
src/ds4/ds4_peer_calibrate.cu(+175 -0)➕
tests/ds4_peer_allreduce_test.cu(+247 -0)📄 Description
Earlier full-model tests measured 9.2% lower warm-prefill latency by letting a two-GPU tensor-parallel group exchange its partial sums directly through peer VRAM instead of detouring through system RAM. This PR now automatically compares the compatible exact-F32 transports at startup and picks the fastest measured option, preserving the same addition order.
The 9.2% result comes from an earlier experimental EXL3 stack, not a fresh end-to-end benchmark of this current-upstream port. The new startup comparison measures collective latency, not total model throughput.
Automatic selection and controls
MAYA_DS4_HIP_PEER_AR=auto(default/unset): benchmark ordinary host, exact-F32 AR2 when AR2 is unset, and compatible peer VRAM once during model loading. Pick the lowest median GPU time at the configured full prompt-chunk size.0: preserve the existing transport without peer allocation or a timing probe.1: force compatible P2P without calibration.DS4_HIP_PEER_ARorSTRATA_DS4_HIP_PEER_AR; serving configs useMAYA_DS4_HIP_PEER_ARinenv.0excludes AR2 from the comparison; FP16 AR2 is never an automatic candidate. Decode/verification, logits gathering, pipeline handoffs andAR2_DECODEare unchanged.Startup cost and memory
The probe uses private synthetic inputs, checks every result exactly, warms each candidate and collects up to six rotated timing rounds (minimum three). It resets all transport flags before inference and never changes expert placement. A
PEER_AR_AUTOline reports candidate medians, the selected path and duration.A shared three-second submission/polling budget covers all eligible groups. Incomplete but safely drained calibration keeps the existing transport. A validation failure or undrained work refuses model loading. Driver calls cannot be forcibly interrupted, so the budget is not a hard recovery guarantee for driver hangs.
At chunk 4096/dimension 5120, P2P retains 160 MiB per rank; calibration temporarily needs another 80 MiB per rank, with 64 MiB free headroom. Allocation occurs after expert placement, without evicting experts to fit the probe. Peer buffers are freed if host or AR2 wins. Partial initialization failures retain the previous transport.
Validation on upstream v1.1.36 /
f031a23Release HIP/gfx1201 engine and standalone test build/link passed.
Two R9700s: 256 chained variable-size collectives matched the existing host transport bit for bit, including signed zeros, extreme finite values, subnormals, guarded outputs, sequence wraparound and payloads through 8192 x 5120 floats.
Actual auto calibration: six samples each, host 18.16 ms, AR2 7.14 ms, peer 3.46 ms. Selected peer; 237 ms probe duration. These are reduction-only timings.
Zero-budget fallback, exclusion of AR2, and exact first-sequence reuse after calibration passed.
A deliberately absent peer with a 50 ms deadline timed out in 50.300 ms; 32 poisoned calls drained in 0.102 ms, preserving the first error record.
Full-model startup passed in automatic, disabled, explicit AR2=1, and single-GPU modes. Automatic selection chose peer in 222 ms (host 17.35 ms, AR2 7.13 ms, peer 3.46 ms).
Auto/off/AR2 each completed the same 1,213-token prompt with identical short greedy text. Disabled/explicit-AR2/single-GPU runs emitted no calibration or peer-enable line. This is a functional smoke check, not full-logit parity or a broad quality evaluation.
CUDA, Windows and other AMD architectures were not hardware-tested. Current-base end-to-end performance, cancellation followed by reuse, and model-level failure injection remain separate validation work.
Runtime failure handling
The peer kernel uses HIP's
wall_clock64()and queried wall-clock rate for a two-second physical deadline. This fixes a previously observed negative GPU core-counter interval that became a false immediate timeout after unsigned conversion. Unsupported clock queries retain host transport.A real timeout records the first failing rank/sequence/block and elapsed/budget ticks. Subsequent queued peer calls drain. Errors are checked before accepting the prompt result; the model stays invalid across reset and requires reload. The integration preserves upstream's batched
step_runsentry point and coordinated chunk-boundary cancellation.Historical full-model evidence
Six balanced blocks / 24 warm trials measured 9.2332% lower latency (block-based 95% interval 8.9991–9.4673%), with medians 7456.793 → 6758.643 ms. Cold results were inconclusive and no decode speedup was established. Scratch stayed allocated in both arms, holding expert placement fixed. Cold/warm/repeated logits and 80 greedy tokens matched independent references exactly.
That older stack also included scalar EXL3 tiling, host packing, predecode, copy-wait and transfer-pruning changes. Its model-level fault-injection test checked request rejection and poison persistence after reset; these historical results do not validate the new integration points. Sources and protocols: fork #15, primitive #14, diagnostics #35, clock fix #38.
Reproduction and settings:
docs/HIP_PEER_PREFILL.md.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.