perf: credit announced shadow writes with independent freshness validation #652

Open
github-bot wants to merge 6 commits from github-bot/gh-652 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-06 00:14 UTC · original
tommiehansen:perf/phase13-announced-shadow-feed-20261206 → main · +387 −9 · 4 files · 6 commits · draft

Why

Streaming CPU writes into watched GPU-local shadow replicas may trigger a later redundant refresh even when the bytes have already been captured for upload. Avoiding that duplicate work could reduce refresh traffic, but an independent CPU writer can invalidate a previously captured snapshot.

What changes

Opt-in VICTORY_ANNOUNCED_SHADOW_COPY=1 credits only complete successfully captured pages of watched ordinary GPU-local replicas. Exclude GPU-owned changes-only copies and recheck kernel write-watch before consuming a credited snapshot. Retain the original refresh fallback. Inspired by CNF/Larp heapfeed; no copied source.

Benchmark results — exactness and traffic accounting

CI 47585779021, deebb254, both configurations passed including independent late CPU writer.

Metric Baseline Enabled
Exact readback per arm 589824 bytes 589824 bytes
Credited bytes (enabled arm) — 131072 bytes

Credited bytes are accounting, not measured avoided transfer time. Preparation, submission and net refresh costs have not yet been quantified.

Why this should be merged

A narrow freshness-checked credit mechanism could avoid redundant refresh work without changing GPU ownership semantics. Keep draft pending alias, failure, lifetime and concurrency controls and a paired net-cost comparison.

Validation and compatibility

Run the exact off/on WARP workflow at the pinned revision above. The late writer must be observed in both arms. Request real streaming traces, refresh byte counts, complete preparation/submission timings and physical AMD validation. This is separate from the broader semantic heap generation architecture and is not a complete streaming redesign.

Current revision 878ee0c

Serialize opt-in pending-credit capture and consumption per shadow through freshness recheck and copying; leave the disabled path free of the new mutex. Reject partial ranges with no complete page before write-watch work. Added exact overlapping-replica readback, unavailable-watch fallback, dropped external owners and late-writer controls, plus 96 paired ABBA/BAAB rows measuring preparation, submission, credited bytes and actual refresh bytes. Overlapping replicas are not a physical alias-mapping test. Current-head CI 47589329686 is pending; prior results above are historical.

Verified paired net-cost results

CI 47589329686 passed both jobs at 878ee0c, including 96 exact paired rows, overlapping replicas, unavailable-watch fallback, dropped owners and late writers. Times are medians of block medians; paired percentages use block-level ratios.

Shape Preparation before → after (µs) Submission before → after (µs) Total before → after (µs) Paired total CPU refresh bytes before → after
Partial 115.55 → 109.775 490.975 → 505.50 614.725 → 621.925 +1.50% (3/8) 65,536 → 65,536
Page 107.70 → 107.10 489.15 → 478.60 594.825 → 588.825 −2.34% (4/8) 65,536 → 0
Full 110.125 → 109.375 523.65 → 552.375 630.10 → 666.30 +5.86% (1/8) 262,144 → 0

The full-page capture removes duplicate CPU refresh traffic, but does not demonstrate a net speedup or fewer GPU upload bytes. Keep draft and disabled: full coverage regresses. Physical alias and AMD streaming evidence remain open.

Warm-replica upload accounting

Current head 8c0b33d initializes and verifies GPU replica content before each timed update. It captures the actual existing Host::card_before logical upload-byte and range counters alongside CPU refresh/credit counts and timing. This excludes initial upload from timed accounting and adds no production synchronization. CI 47592106870 is running. Logical GPU upload bytes are not measured PCIe bus traffic.

**@⁠tommiehansen** on GitHub · 2026-12-06 00:14 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/652) `tommiehansen:perf/phase13-announced-shadow-feed-20261206` → `main` · +387 −9 · 4 files · 6 commits · draft ## Why Streaming CPU writes into watched GPU-local shadow replicas may trigger a later redundant refresh even when the bytes have already been captured for upload. Avoiding that duplicate work could reduce refresh traffic, but an independent CPU writer can invalidate a previously captured snapshot. ## What changes Opt-in `VICTORY_ANNOUNCED_SHADOW_COPY=1` credits only complete successfully captured pages of watched ordinary GPU-local replicas. Exclude GPU-owned changes-only copies and recheck kernel write-watch before consuming a credited snapshot. Retain the original refresh fallback. Inspired by CNF/Larp heapfeed; no copied source. ## Benchmark results — exactness and traffic accounting [CI 47585779021](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47585779021), `deebb254`, both configurations passed including independent late CPU writer. | Metric | Baseline | Enabled | |---|---:|---:| | Exact readback per arm | 589824 bytes | 589824 bytes | | Credited bytes (enabled arm) | — | 131072 bytes | Credited bytes are accounting, not measured avoided transfer time. Preparation, submission and net refresh costs have not yet been quantified. ## Why this should be merged A narrow freshness-checked credit mechanism could avoid redundant refresh work without changing GPU ownership semantics. Keep draft pending alias, failure, lifetime and concurrency controls and a paired net-cost comparison. ## Validation and compatibility Run the exact off/on WARP workflow at the pinned revision above. The late writer must be observed in both arms. Request real streaming traces, refresh byte counts, complete preparation/submission timings and physical AMD validation. This is separate from the broader semantic heap generation architecture and is not a complete streaming redesign. ### Current revision `878ee0c` Serialize opt-in pending-credit capture and consumption per shadow through freshness recheck and copying; leave the disabled path free of the new mutex. Reject partial ranges with no complete page before write-watch work. Added exact overlapping-replica readback, unavailable-watch fallback, dropped external owners and late-writer controls, plus 96 paired ABBA/BAAB rows measuring preparation, submission, credited bytes and actual refresh bytes. Overlapping replicas are not a physical alias-mapping test. [Current-head CI 47589329686](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47589329686) is pending; prior results above are historical. ### Verified paired net-cost results [CI 47589329686](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47589329686) passed both jobs at 878ee0c, including 96 exact paired rows, overlapping replicas, unavailable-watch fallback, dropped owners and late writers. Times are medians of block medians; paired percentages use block-level ratios. | Shape | Preparation before → after (µs) | Submission before → after (µs) | Total before → after (µs) | Paired total | CPU refresh bytes before → after | |---|---:|---:|---:|---:|---:| | Partial | 115.55 → 109.775 | 490.975 → 505.50 | 614.725 → 621.925 | +1.50% (3/8) | 65,536 → 65,536 | | Page | 107.70 → 107.10 | 489.15 → 478.60 | 594.825 → 588.825 | −2.34% (4/8) | 65,536 → 0 | | Full | 110.125 → 109.375 | 523.65 → 552.375 | 630.10 → 666.30 | +5.86% (1/8) | 262,144 → 0 | The full-page capture removes duplicate CPU refresh traffic, but does not demonstrate a net speedup or fewer GPU upload bytes. Keep draft and disabled: full coverage regresses. Physical alias and AMD streaming evidence remain open. ### Warm-replica upload accounting Current head `8c0b33d` initializes and verifies GPU replica content before each timed update. It captures the actual existing Host::card_before logical upload-byte and range counters alongside CPU refresh/credit counts and timing. This excludes initial upload from timed accounting and adds no production synchronization. [CI 47592106870](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47592106870) is running. Logical GPU upload bytes are not measured PCIe bus traffic.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 00:17:35 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/652/head:github-bot/gh-652'
git switch 'github-bot/gh-652'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-652'
git switch 'github-bot/gh-652'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-652'
git switch 'github-bot/gh-652'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-652'
git switch 'main'
git merge --squash 'github-bot/gh-652'
git switch 'main'
git merge --ff-only 'github-bot/gh-652'
git switch 'main'
git merge 'github-bot/gh-652'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.