Skip to content

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

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

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

Conversation

@LostVector

@LostVector LostVector commented Oct 30, 2026 •

Copy link
Copy Markdown

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

Rebase for current RDMA review

Rebased the same scheduling patch onto rdma at 3198893d as d39f8b79. The only conflict resolution moves test registration into the current non-Windows CMake sections; production changes are unchanged. Fresh CPU gate, TP executor, control and disk-store tests, gate ASan/UBSan and repository formatting pass. The measurements above remain historical evidence from their stated revisions, not new results on this rebase.

The separate AR follow-up remains in #14. Its full evidence is preserved on our fork, outside these code-only PRs.

November 5 integration check

The requested rebase is superseded by the maintainer’s integration into rdma: prerequisite #13 is included through merge a7fa41d6 and the AR follow-up through f070a179. The AR range-diff is identical; gate/test files match our review head. No duplicate patch was pushed or PR closed. Fresh validation of integrated f070a179: gate, TP executor, control and disk-store CPU tests pass; gate ASan/UBSan and repository formatting pass. This is a code/integration check, not a new two-node performance measurement.

@LostVector
LostVector force-pushed the perf/tp-mtp-snapshot-handoff branch from b6d4cba to d39f8b7 Compare November 4, 2026 20:42
neuhaus added a commit that referenced this pull request Nov 4, 2026
# Conflicts:
#	CMakeLists.txt
#	cmake/Checks.cmake
@neuhaus

neuhaus commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Thanks

@neuhaus neuhaus closed this Nov 7, 2026
@neuhaus neuhaus reopened this Nov 7, 2026
@neuhaus neuhaus closed this Nov 7, 2026
@neuhaus

neuhaus commented Nov 7, 2026

Copy link
Copy Markdown
Owner

This code has landed, sorry it doesn't credit you properly. Thanks again.

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.

2 participants