Skip to content

perf(tp2): hand pending snapshot captures the MTP execution lock - #1

Closed
LostVector wants to merge 1 commit into
rdmafrom
perf/tp-mtp-snapshot-handoff
Closed

LostVector wants to merge 1 commit into
rdmafrom
perf/tp-mtp-snapshot-handoff

Conversation

@LostVector

@LostVector LostVector commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

An MTP decode loop can repeatedly reacquire TpExecutor::call_mutex_ while another request's prompt-snapshot capture waits. That delays the second request's admission into a decode batch: one unchanged-policy trace recorded a 2,421 ms capture lock wait followed by only 1.234 ms inside capture.

Register pending snapshot captures before acquiring the existing recursive mutex. Multi-token and batched decode calls yield outside that mutex until registered captures acquire it. In-flight calls finish normally; prefill ordering and recursive fallback behavior stay unchanged. This is a bounded snapshot handoff, not a global FIFO scheduler. No new runtime setting or model arithmetic change.

Validation

  • Focused gate tests cover recursive ordering, abandoned registrations, and 6,000 capture/decode operations; normal, ASan, UBSan and TSan runs passed. Existing TP executor tests and repository formatting passed.
  • Clean release builds of base 0b6978aa and candidate b6d4cbaa completed with matching normalized compiler commands. A clean-build B/C/B integration check matched all 39 outputs and expected cache/prefill work. Aggregate C2 throughput was 59.12 / 66.75 / 47.51 tok/s; maximum stream gap was 2,544 / 138 / 2,541 ms. This small check is supporting evidence, not the confidence estimate below.
  • Separate fixed eight randomized paired blocks, 16 fresh process-pair starts: median per-start C2 aggregate throughput 55.045 → 67.014 tok/s; paired relative improvement 20.583%, bootstrap 95% CI 16.287–24.276%, exact two-sided sign-flip p = 0.0078125, eight of eight pairs improved. All 208 request executions matched outputs and expected work. Control had >500 ms gaps in 16/24 waves; candidate 0/24.
  • Single-request decode medians 54.684 → 54.553 tok/s and 32K prompt processing 1,967.031 → 1,963.756 tok/s were approximately flat in that experiment. These are aggregate controls, not per-request equivalence claims.
  • Additional sampled, cancellation, 18K/32K-context, concurrent and peer-loss/recovery checks passed.

Configuration: two 128 GB Strix Halo hosts, Flash Next UD-Q4_K_XL with shared-Q8_0 MTP, context capacity 65,536, two sessions, chunk 2,048, cache RAM 1 GiB, two 20 Gb/s USB4 links. Timing scope excludes model loading; driver and toolchain were held fixed within each comparison. The confidence runs used our experimental GPU build profile; the separate clean-build check above must not be conflated with those eight paired blocks.

Draft qualification limits

Fair progress can make the first-arriving request finish later: median first-request wall time increased about 121 ms (17/24 waves slower). This patch improves admission and combined throughput, not every request's latency. The confidence experiment retains 108 strict request/phase timing flags; the clean-build check retains 31. These are not averaged away or represented as a complete timing qualification. No default deployment or broad model-performance claim is requested yet.

This targets the RDMA branch because gufo-org/gufo:main does not contain tp_executor.cpp; the original distributed integration is tracked in gufo-org#296. The independent cache-retention change is outside this diff.

Related drafts

@LostVector

Copy link
Copy Markdown
Owner Author

Superseded by the maintained tp2 integration in #9, now published at 6d41cb4648fa7bccf4e75c734f73bb96d6c95c29. This change is included through commit 816d0d6787bc84a32759fa4276dca19560dde5a3 (verified ancestor of the published head).

The current Linux HIP release passed fresh TP=2 inference, cache/cancellation, persisted-cache restart and injected failure/recovery checks. The integration PR retains the original measurement attribution and timing caveats; these checks do not create a new performance claim for this historical patch.

Closing this historical draft as superseded, not claiming a formal GitHub merge. Its source branch and evidence remain intact. Fork main remains the gufo-org mirror; tp2 is the working combined branch. Fresh Windows CI for the current integration is still running.

@LostVector LostVector closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant