RFC / Benchmarks (Team Green RTX + 8-Core x86-64): +48–59% 3D FPS via Write-Watch, Lock-Trim & L0 DMA Stack (10 Patches + Tooling) #413

Open
opened 2026-12-01 23:41:31 +00:00 by procotos-art · 11 comments
procotos-art commented 2026-12-01 23:41:31 +00:00 (Migrated from github.com)
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by procotos-art on 2026-12-01T23:41:31Z.


Scope Note: This optimization stack was developed and A/B-benchmarked specifically for the Team Green (RTX) D3D12.X translation branch (v2026.11.30.03 / e1251c31 base, Agility SDK 1.614.1, ReBAR ON). It is posted here as an RFC / architectural idea in an active community hub so maintainers and contributors can inspect, cherry-pick, or adapt individual mechanisms.

Open Reuse (MIT-0 / Public Domain): Any use is welcome — I am only researching and sharing measured results, not maintaining forks or opening PRs myself. Everyone is explicitly free to copy, adapt, integrate into their own code, or open PRs with any of these patches, scripts, or notes (with or without attribution). If active development on a Team Green (RTX) branch resumes in another repository, feel free to tag @procotos-art and copy/repost this entire article and all Gist links in full.


Overall End-to-End Speedup on Team Green (RTX 5080) + 8-Core x86-64

Measured end-to-end across the full stack (patches 01..10 + verified 8-core runtime toggles) on Ryzen 7 5700X (8C/16T) + RTX 5080 16 GB (ReBAR ON, 1440p + DLSS Quality, warm cache, 3k–4k draws/frame):

Metric (3D-only) Stock Baseline (e1251c31) Full Optimized Stack (01..10 + flags) Net Improvement
3D FPS (median) ~13.1 FPS 19.4 – 20.9 FPS (p75 21.9, peaks 22.5–26.0) +48% .. +59% FPS
Frame time (median) ~76.3 ms 47.8 – 51.5 ms -24.8 .. -28.5 ms (-32% .. -37%)
Refreshes (refr) ~33.2 ms 13.7 – 15.6 ms -53% .. -59%
Write-watch (ww_ask) ~27.3 ms 8.6 – 11.1 ms -59% .. -68%
1s VAD-lock spikes (WW_hi > 5 ms) 23 / 40 ticks 0 / 41 ticks (ZERO) -100% VAD spikes
Worst frame hitch (max frame_ms) 156 – 358 ms 62.7 – 73.1 ms (0 hitches >100 ms) -53% .. -79% stutter
Visual / Unit Tests baseline 0 visual regressions, 139/139 unit tests PASS lossless

(Every individual patch and toggle below is also backed by its own isolated, same-binary paired A/B delta.)


Hardware & Measurement Methodology

  • Test rig: AMD Ryzen 7 5700X (8C/16T, 32 MB L3) + 32 GB DDR4 + Team Green RTX 5080 16 GB (ReBAR ON, Agility SDK 1.614.1) + Windows 11.
  • Methodology: Same-binary, same-warm-cache back-to-back paired --release A/B (FLAG=0 vs FLAG=1), strictly 3D-only frames (draws >= 1000), normalized ms / 1k draws, 1-second submitting-thread breakdown (med / mean / p90), plus visual verification and full unit-test passes (72/72 watch::, 48/48 xmem::, 18/18 send::, 1/1 bury_tests).
  • Standalone Clean-Room Benchmark & Digital-Twin Lab (zero proprietary assets): https://github.com/POMXARK/victory-city-bench

1. Zero-Rebuild & Runtime-Flag A/B Results (from previous discussion)

All numbers below are same-binary paired --release A/B runs on the 8C/16T + RTX 5080 rig:

Change / Toggle Paired A/B Delta (3D-only) Physical Mechanism
VICTORY_COPY_BESIDE=1 + VICTORY_STORE_BESIDE=1 frame_med 65.40 → 51.50 ms (-13.90 ms / -21.3%), FPS 15.30 → 19.40 (+26.8%, p75 21.90), sub_total 61.60 → 44.60 ms (-17.0 ms), ww_ask 15.30 → 8.60 ms (-43.8%), WW_hi>5ms spikes 23/40 → 0/41 (ZERO), copies_mb -31.2% Routes title memcpy and single-word stores through the alias view beside PAGE_READONLY guards, eliminating MmAddressCreationLock VAD-lock storms.
VICTORY_D3D12_BACKGROUND=0 ms/1k draws 23.56 → 18.54 (-21.3%), max frame_ms 163.3 → 83.5 ms (-48.9%), ww_ask 24.20 → 17.00 ms (-29.8%) Disables driver D3D Background Threads that contend with submission/worker threads on 8C/16T CPUs.
VICTORY_PROCESS_MEMORY=0 frame p75 -13.7 ms Disables periodic 5s ~100k VirtualQuery VAD-lock storms.
VICTORY_WIDE_FILLS=0 frame_med 63.55 → 56.70 ms (-6.85 ms, p75 -17.90 ms, max 358 → 67 ms), Commit -328 MB Confirms the 8-Core Background-Thread Law (8× confirmed): keep ASK_FIRST=0, WIDE_FILLS=0, SWEEP_OFF_THREAD=0, UPLOAD_AHEAD=0, SNAP_BESIDE=0, SEND_BESIDE=0, SPLIT_PRELUDE=0, D3D12_BACKGROUND=0.
VICTORY_WC_BAR=3 (smart ReBAR) card 6.6 → 0.8 ms (91.1% of full WC speedup, 0 GpuWrite readback drops) Places only !allow_uav write-combined buffers directly into ReBAR D3D12_HEAP_TYPE_GPU_UPLOAD.

2. Sequential Patch Series (01 → 10, Isolated Secret Gists)

Every patch carries a sanitized header (Base commit: e1251c31, Mechanism, Env switch, A/B summary) and sits behind an explicit VICTORY_* toggle for risk-free A/B testing on any branch:

Order Patch File & Secret Gist Env Switch (Default) Target Bottleneck & Paired A/B Delta
01 01_sim008_guard_sharded_vp_stripe.patch VICTORY_GUARD_SHARDED=1 (ON) 64-stripe VP_STRIPE (4 MiB) outside global GUARDS lock → refreshes 33.2 → 19.4 ms (-41.6%), ww_ask 14.3 → 7.8 ms (-45.5%), frame_med 76.3 → 58.7 ms
02 02_sim011_steps_fast_and_listed_twins.patch VICTORY_STEPS_FAST=1, VICTORY_LISTED_TWINS=0 O(\log N) binary-search title_written_ranges + 8,788 → 0 raw twins/f → frame_med 71.5 → 63.2 ms (-8.3 ms), prep 64.7 → 55.9 ms (-8.8 ms)
03 03_sim010_m4_low_l0_dma.patch VICTORY_LOW_L0_DMA=1 (ON) MEM_PRIVATE | MEM_WRITE_WATCH + OpenExistingHeapFromAddress1 L0→L1 DMA (>=512 B runs) → frame_med 67.60 → 58.45 ms (-13.5%), refr 23.10 → 15.75 ms, card 2.80 → 0.90 ms (3.1×)
04 04_sim013_desc_mirror_cap_and_soft_batch.patch VICTORY_DESC_MIRROR_CAP=1, VICTORY_SOFT_BATCH=1 Cap descriptor mirror scan (38 → 18.5 MiB) + 4 MiB LAZY_AT batched soft views → prep 61.30 → 44.85 ms (-26.8%), ww_ask 27.30 → 13.15 ms (-51.8%) (clean-applies with 0 conflicts onto XSEmu/core)
05 05_marsietiss_review_fixes.patch (hardening) VP_STRIPE reopen guard, drop ahead_intact heuristic, strict per-range landing-safe L0_DMA gate
06 06_marsietiss_arming_and_strict_l0_gate.patch (hardening) ARMING bitmap + real-path protect_here_striped race test (72/72 watch::), strict card_l0_dma_allows UAV gate (18/18 send::)
07 07_prelude_shared_alloc_and_batch_cache.patch VICTORY_PRELUDE_SHARED_ALLOC=1 (ON) 1 shared prelude ID3D12CommandAllocator per submission (~136 → ~17–31 resets/f) + Batch::add last-key cache → prelude_rec max 8.18 → 4.87 ms (-40%)
08 08_soft_fast_fills_and_stack_read.patch VICTORY_SOFT_FAST=1 (ON) Sequential batched Step::Fill (1 QPC/flush vs ~20k/f) + stack FastHit::Single in soft_read → run_deferred 4.73 → 3.17 ms (-33%), steps-refr 8.50 → 6.70 ms (-1.80 ms) (48/48 xmem::)
09 09_lock_trim_watch_bury_desc.patch VICTORY_LOCK_TRIM=1 (ON) PROTECTED || ARMING bitmap fast-path in title_memory_written + 64 cacheline-aligned RETIRED shards with lock-free AtomicU64 oldest-fence skip in bury() + release_dynamic_batch → sub_lock 1.80 → 0.90 ms (-50%), sub_tot -1.90 ms, steps -2.00 ms, max_fms 155.9 → 73.1 ms (-53%)
10 10_ask_flush_batch_write_watch.patch VICTORY_ASK_FLUSH=1 (opt-in) Single watch::ask_more(&ranges) per Batch::flush / due pass while watch::is_kept() is active (0 extra threads, adapted from XSEmu PR #162) → 5s FPS +12.0%, ms/1k 24.20 → 20.18 (-16.6%), ww_ask 22.20 → 18.30 ms (-3.90 ms), max_fms 326.8 → 85.1 ms (-74%)

3. Debugging Tools, Codebase Indexer & Launch/Build Guides (Secret Gists)

  1. Debugging, HW Telemetry & Paired A/B Harness (compare_ab_logs.py, parse_diag.py, run_paired_ab.ps1, run_hw_monitor_bench.ps1):
  2. Fast Zero-Dependency Codebase Indexer (build_code_index.py, ~1.5 s) & Local Official API Spec Search Stack (rg / fd / ast-grep / DirectX-Specs):
  3. 8-Core + Team Green (RTX) Launch Flags, 4.2× Faster Windows Release Build Config (.cargo/config.toml), Proven Silicon Laws & Closed Dead Ends:

Credits & Reviewers from the Previous Thread

Huge thanks to @Marsietiss (deep code reviews that directly produced hardening patches 05 and 06 plus zero-copy dead-end analysis), @tikD1337 (independent A/B validation on RTX 4070 Ti SUPER + Ryzen 5 7600 and clean VICTORY_WC_BAR=3 PR), and @zonehammer (RTX 4090 A/B data confirming the PAGE_READONLY read-explosion trade-off on GUARD_LEARN).

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:6733219383 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413). Originally posted by [procotos-art](https://github.com/procotos-art) on 2026-12-01T23:41:31Z. --- > **Scope Note:** This optimization stack was developed and A/B-benchmarked specifically for the **Team Green (RTX)** D3D12.X translation branch (`v2026.11.30.03` / `e1251c31` base, Agility SDK `1.614.1`, ReBAR ON). It is posted here as an RFC / architectural idea in an active community hub so maintainers and contributors can inspect, cherry-pick, or adapt individual mechanisms. > > **Open Reuse (MIT-0 / Public Domain):** Any use is welcome — I am only researching and sharing measured results, not maintaining forks or opening PRs myself. Everyone is explicitly free to copy, adapt, integrate into their own code, or open PRs with any of these patches, scripts, or notes (with or without attribution). If active development on a Team Green (RTX) branch resumes in another repository, feel free to tag `@procotos-art` and copy/repost this entire article and all Gist links in full. --- ## Overall End-to-End Speedup on Team Green (RTX 5080) + 8-Core x86-64 Measured end-to-end across the full stack (`patches 01..10` + verified 8-core runtime toggles) on **Ryzen 7 5700X (8C/16T) + RTX 5080 16 GB (ReBAR ON, 1440p + DLSS Quality, warm cache, 3k–4k draws/frame)**: | Metric (3D-only) | Stock Baseline (`e1251c31`) | Full Optimized Stack (`01..10` + flags) | Net Improvement | | :--- | ---: | ---: | ---: | | **3D FPS (median)** | `~13.1 FPS` | **`19.4 – 20.9 FPS`** *(p75 `21.9`, peaks `22.5–26.0`)* | **`+48% .. +59%` FPS** | | **Frame time (median)** | `~76.3 ms` | **`47.8 – 51.5 ms`** | **`-24.8 .. -28.5 ms (-32% .. -37%)`** | | **Refreshes (`refr`)** | `~33.2 ms` | **`13.7 – 15.6 ms`** | **`-53% .. -59%`** | | **Write-watch (`ww_ask`)** | `~27.3 ms` | **`8.6 – 11.1 ms`** | **`-59% .. -68%`** | | **1s VAD-lock spikes (`WW_hi > 5 ms`)** | `23 / 40` ticks | **`0 / 41` ticks (ZERO)** | **`-100%` VAD spikes** | | **Worst frame hitch (`max frame_ms`)** | `156 – 358 ms` | **`62.7 – 73.1 ms` (0 hitches >100 ms)** | **`-53% .. -79%` stutter** | | **Visual / Unit Tests** | baseline | **0 visual regressions, `139/139` unit tests PASS** | lossless | *(Every individual patch and toggle below is also backed by its own isolated, same-binary paired A/B delta.)* --- ## Hardware & Measurement Methodology - **Test rig:** AMD Ryzen 7 5700X (8C/16T, 32 MB L3) + 32 GB DDR4 + Team Green RTX 5080 16 GB (ReBAR ON, Agility SDK `1.614.1`) + Windows 11. - **Methodology:** Same-binary, same-warm-cache back-to-back paired `--release` A/B (`FLAG=0` vs `FLAG=1`), strictly 3D-only frames (`draws >= 1000`), normalized `ms / 1k draws`, 1-second submitting-thread breakdown (`med / mean / p90`), plus visual verification and full unit-test passes (`72/72 watch::`, `48/48 xmem::`, `18/18 send::`, `1/1 bury_tests`). - **Standalone Clean-Room Benchmark & Digital-Twin Lab (zero proprietary assets):** https://github.com/POMXARK/victory-city-bench --- ## 1. Zero-Rebuild & Runtime-Flag A/B Results (from previous discussion) All numbers below are same-binary paired `--release` A/B runs on the 8C/16T + RTX 5080 rig: | Change / Toggle | Paired A/B Delta (3D-only) | Physical Mechanism | | :--- | :--- | :--- | | `VICTORY_COPY_BESIDE=1` + `VICTORY_STORE_BESIDE=1` | **`frame_med 65.40 → 51.50 ms (-13.90 ms / -21.3%)`**, **`FPS 15.30 → 19.40 (+26.8%, p75 21.90)`**, **`sub_total 61.60 → 44.60 ms (-17.0 ms)`**, **`ww_ask 15.30 → 8.60 ms (-43.8%)`**, **`WW_hi>5ms spikes 23/40 → 0/41 (ZERO)`**, `copies_mb -31.2%` | Routes title `memcpy` and single-word stores through the alias view beside `PAGE_READONLY` guards, eliminating `MmAddressCreationLock` VAD-lock storms. | | `VICTORY_D3D12_BACKGROUND=0` | **`ms/1k draws 23.56 → 18.54 (-21.3%)`**, **`max frame_ms 163.3 → 83.5 ms (-48.9%)`**, **`ww_ask 24.20 → 17.00 ms (-29.8%)`** | Disables driver D3D Background Threads that contend with submission/worker threads on 8C/16T CPUs. | | `VICTORY_PROCESS_MEMORY=0` | **`frame p75 -13.7 ms`** | Disables periodic 5s `~100k` `VirtualQuery` VAD-lock storms. | | `VICTORY_WIDE_FILLS=0` | **`frame_med 63.55 → 56.70 ms (-6.85 ms, p75 -17.90 ms, max 358 → 67 ms)`**, `Commit -328 MB` | Confirms the **8-Core Background-Thread Law** (8× confirmed): keep `ASK_FIRST=0`, `WIDE_FILLS=0`, `SWEEP_OFF_THREAD=0`, `UPLOAD_AHEAD=0`, `SNAP_BESIDE=0`, `SEND_BESIDE=0`, `SPLIT_PRELUDE=0`, `D3D12_BACKGROUND=0`. | | `VICTORY_WC_BAR=3` (smart ReBAR) | `card 6.6 → 0.8 ms` (`91.1%` of full WC speedup, `0` `GpuWrite` readback drops) | Places only `!allow_uav` write-combined buffers directly into ReBAR `D3D12_HEAP_TYPE_GPU_UPLOAD`. | --- ## 2. Sequential Patch Series (`01` → `10`, Isolated Secret Gists) Every patch carries a sanitized header (`Base commit: e1251c31`, `Mechanism`, `Env switch`, `A/B summary`) and sits behind an explicit `VICTORY_*` toggle for risk-free A/B testing on any branch: | Order | Patch File & Secret Gist | Env Switch (Default) | Target Bottleneck & Paired A/B Delta | | :---: | :--- | :--- | :--- | | **01** | [`01_sim008_guard_sharded_vp_stripe.patch`](https://gist.github.com/procotos-art/1dd2cdb521366b5eb3db588218c3cbff) | `VICTORY_GUARD_SHARDED=1` (ON) | 64-stripe `VP_STRIPE` (`4 MiB`) outside global `GUARDS` lock → **`refreshes 33.2 → 19.4 ms (-41.6%)`**, **`ww_ask 14.3 → 7.8 ms (-45.5%)`**, `frame_med 76.3 → 58.7 ms` | | **02** | [`02_sim011_steps_fast_and_listed_twins.patch`](https://gist.github.com/procotos-art/59f4eb09b88bf4343ea83b182f24444c) | `VICTORY_STEPS_FAST=1`, `VICTORY_LISTED_TWINS=0` | $O(\log N)$ binary-search `title_written_ranges` + `8,788 → 0` raw twins/f → **`frame_med 71.5 → 63.2 ms (-8.3 ms)`**, **`prep 64.7 → 55.9 ms (-8.8 ms)`** | | **03** | [`03_sim010_m4_low_l0_dma.patch`](https://gist.github.com/procotos-art/7d6e170d0cf53a20d559573e3e630c81) | `VICTORY_LOW_L0_DMA=1` (ON) | `MEM_PRIVATE \| MEM_WRITE_WATCH` + `OpenExistingHeapFromAddress1` L0→L1 DMA (`>=512 B` runs) → **`frame_med 67.60 → 58.45 ms (-13.5%)`**, **`refr 23.10 → 15.75 ms`**, **`card 2.80 → 0.90 ms (3.1×)`** | | **04** | [`04_sim013_desc_mirror_cap_and_soft_batch.patch`](https://gist.github.com/procotos-art/83008639836f7c73d76c451d593a7f8a) | `VICTORY_DESC_MIRROR_CAP=1`, `VICTORY_SOFT_BATCH=1` | Cap descriptor mirror scan (`38 → 18.5 MiB`) + `4 MiB` `LAZY_AT` batched soft views → **`prep 61.30 → 44.85 ms (-26.8%)`**, **`ww_ask 27.30 → 13.15 ms (-51.8%)`** *(clean-applies with 0 conflicts onto `XSEmu/core`)* | | **05** | [`05_marsietiss_review_fixes.patch`](https://gist.github.com/procotos-art/3a0e61f3ea78e8483be166780c26270b) | *(hardening)* | `VP_STRIPE` reopen guard, drop `ahead_intact` heuristic, strict per-range landing-safe `L0_DMA` gate | | **06** | [`06_marsietiss_arming_and_strict_l0_gate.patch`](https://gist.github.com/procotos-art/156172bb1b8d610322ffe94d28d0a460) | *(hardening)* | `ARMING` bitmap + real-path `protect_here_striped` race test (`72/72 watch::`), strict `card_l0_dma_allows` UAV gate (`18/18 send::`) | | **07** | [`07_prelude_shared_alloc_and_batch_cache.patch`](https://gist.github.com/procotos-art/f843222e4211d06a0c33f3ff483bddcb) | `VICTORY_PRELUDE_SHARED_ALLOC=1` (ON) | 1 shared prelude `ID3D12CommandAllocator` per submission (`~136 → ~17–31` resets/f) + `Batch::add` last-key cache → **`prelude_rec max 8.18 → 4.87 ms (-40%)`** | | **08** | [`08_soft_fast_fills_and_stack_read.patch`](https://gist.github.com/procotos-art/2ce36563220c519bd28bc31780e4a9b9) | `VICTORY_SOFT_FAST=1` (ON) | Sequential batched `Step::Fill` (1 QPC/flush vs `~20k`/f) + stack `FastHit::Single` in `soft_read` → **`run_deferred 4.73 → 3.17 ms (-33%)`**, **`steps-refr 8.50 → 6.70 ms (-1.80 ms)`** (`48/48 xmem::`) | | **09** | [`09_lock_trim_watch_bury_desc.patch`](https://gist.github.com/procotos-art/ad6d247c2853514ea0677cc1e856633c) | `VICTORY_LOCK_TRIM=1` (ON) | `PROTECTED \|\| ARMING` bitmap fast-path in `title_memory_written` + 64 cacheline-aligned `RETIRED` shards with lock-free `AtomicU64` oldest-fence skip in `bury()` + `release_dynamic_batch` → **`sub_lock 1.80 → 0.90 ms (-50%)`**, **`sub_tot -1.90 ms`**, **`steps -2.00 ms`**, **`max_fms 155.9 → 73.1 ms (-53%)`** | | **10** | [`10_ask_flush_batch_write_watch.patch`](https://gist.github.com/procotos-art/4997d1c77ace242cf2981d9efffcd02e) | `VICTORY_ASK_FLUSH=1` (opt-in) | Single `watch::ask_more(&ranges)` per `Batch::flush` / `due` pass while `watch::is_kept()` is active (0 extra threads, adapted from `XSEmu` PR `#162`) → **`5s FPS +12.0%`**, **`ms/1k 24.20 → 20.18 (-16.6%)`**, **`ww_ask 22.20 → 18.30 ms (-3.90 ms)`**, **`max_fms 326.8 → 85.1 ms (-74%)`** | --- ## 3. Debugging Tools, Codebase Indexer & Launch/Build Guides (Secret Gists) 1. **Debugging, HW Telemetry & Paired A/B Harness (`compare_ab_logs.py`, `parse_diag.py`, `run_paired_ab.ps1`, `run_hw_monitor_bench.ps1`):** - https://gist.github.com/procotos-art/460cd39f48544dfdc050ac4620a01374 2. **Fast Zero-Dependency Codebase Indexer (`build_code_index.py`, ~1.5 s) & Local Official API Spec Search Stack (`rg` / `fd` / `ast-grep` / `DirectX-Specs`):** - https://gist.github.com/procotos-art/6f93e0a569d9c1a2f21a2e9a36125954 3. **8-Core + Team Green (RTX) Launch Flags, 4.2× Faster Windows Release Build Config (`.cargo/config.toml`), Proven Silicon Laws & Closed Dead Ends:** - https://gist.github.com/procotos-art/fa5d926e6a55cb4b7298295c3d22e757 --- ## Credits & Reviewers from the Previous Thread Huge thanks to @Marsietiss (deep code reviews that directly produced hardening patches `05` and `06` plus zero-copy dead-end analysis), @tikD1337 (independent A/B validation on RTX 4070 Ti SUPER + Ryzen 5 7600 and clean `VICTORY_WC_BAR=3` PR), and @zonehammer (RTX 4090 A/B data confirming the `PAGE_READONLY` read-explosion trade-off on `GUARD_LEARN`).
readmet3xt-lab commented 2026-12-02 01:48:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by readmet3xt-lab on 2026-12-02T01:48:53Z.


Thank you for the detailed write-up and for offering it for reuse. The measurements are against another fork's base, whose watch and guard code differs from ours, so we can't carry the numbers over. Several of the switches in your first table already exist here and some are already on by default. We'll look at the striped guards and the lock trim first (patches 01 and 09) and port them behind switches if they fit, measured in our own A/B runs, with credit. If you can make the patches public gists, or a branch, that would make them easier to review.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7332138213 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7332138213). Originally posted by [readmet3xt-lab](https://github.com/readmet3xt-lab) on 2026-12-02T01:48:53Z. --- Thank you for the detailed write-up and for offering it for reuse. The measurements are against another fork's base, whose watch and guard code differs from ours, so we can't carry the numbers over. Several of the switches in your first table already exist here and some are already on by default. We'll look at the striped guards and the lock trim first (patches 01 and 09) and port them behind switches if they fit, measured in our own A/B runs, with credit. If you can make the patches public gists, or a branch, that would make them easier to review.
Marsietiss commented 2026-12-02 02:19:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by Marsietiss on 2026-12-02T02:19:25Z.


@procotos-art — we ported the write-watch private substrate + L0 DMA + WC_BAR from your stack (behind switches, re-derived for our tree, with credit). The substrate runs, but L0 opens 0 heaps and we'd like your read on the scope.

What we measure (RTX 5080, Ryzen 9 9950X3D, 32 GB, our own A/B):

  • Substrate active: write watch over the 32-bit private runs: ~147 askings run-by-run, ~4.5 ms in them, ~3.9 GB walked/frame; 4KiB pages named split landed-by-us vs the title's.
  • But L0_DMA: 0.0 MB in 0 runs; a heap opened on 0 card copies — title memory under write guards is not private memory committed whole and is not opened. And WC_BAR: 0 of them placed 0 MB.

Our read of the cause (code): we make the 32-bit graphics reservation (~185 MiB) private + write-watched (your patch's target). But our L0 is tried on the big copy-back card copies, whose title memory is a ~1.3 GB private heap plus section pages the title maps at 3–60+ addresses — not the graphics reservation. Our private_whole gate (VirtualQuery: MEM_COMMIT, MEM_PRIVATE, PAGE_READWRITE, one region covering the whole range) refuses those, so no heap opens. We pay the asking cost for zero DMA gain.

Questions:

  1. In your stack, what memory does L0 actually open heaps on — the graphics reservation, and does your title's copy-back live there? Ours doesn't.
  2. If the substrate has to cover the copy-back memory: those section pages are heavily aliased (3–60+ addresses). Private memory there falls back to views on any alias (one-copy-per-address contract), and the write-watch asking walks the range per submission (~3.5 µs/MB under load; ~16 ms/frame if a 174 MB copy is re-read every submission). How do you avoid the alias-fallback storm and the asking cost eating the DMA gain?
  3. GPU DMA writes name 0 pages to the kernel write-watch (we card-tested this), so zero-copy landings must be declared to tracking. Is a single committed-whole private pool (one home per byte) the better substrate rather than per-mapping private?
  4. WC_BAR places 0 for us — are the title's write-combined buffers simply not registered as WC regions on our host, or are there genuinely no whole-WC no-UAV buffers in this scene?

Happy to share counts/logs. What would you try?

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7332710643 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7332710643). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-12-02T02:19:25Z. --- @procotos-art — we ported the write-watch private substrate + L0 DMA + WC_BAR from your stack (behind switches, re-derived for our tree, with credit). The substrate runs, but L0 opens 0 heaps and we'd like your read on the scope. What we measure (RTX 5080, Ryzen 9 9950X3D, 32 GB, our own A/B): - Substrate active: `write watch over the 32-bit private runs: ~147 askings run-by-run, ~4.5 ms in them, ~3.9 GB walked/frame; 4KiB pages named split landed-by-us vs the title's`. - But `L0_DMA: 0.0 MB in 0 runs; a heap opened on 0 card copies — title memory under write guards is not private memory committed whole and is not opened`. And `WC_BAR: 0 of them placed 0 MB`. Our read of the cause (code): we make the **32-bit graphics reservation (~185 MiB)** private + write-watched (your patch's target). But our L0 is tried on the **big copy-back card copies**, whose title memory is a ~1.3 GB private heap plus section pages the title maps at 3–60+ addresses — not the graphics reservation. Our `private_whole` gate (`VirtualQuery`: `MEM_COMMIT`, `MEM_PRIVATE`, `PAGE_READWRITE`, one region covering the whole range) refuses those, so no heap opens. We pay the asking cost for zero DMA gain. Questions: 1. In your stack, what memory does L0 actually open heaps on — the graphics reservation, and does your title's copy-back live there? Ours doesn't. 2. If the substrate has to cover the copy-back memory: those section pages are heavily aliased (3–60+ addresses). Private memory there falls back to views on any alias (one-copy-per-address contract), and the write-watch asking walks the range per submission (~3.5 µs/MB under load; ~16 ms/frame if a 174 MB copy is re-read every submission). How do you avoid the alias-fallback storm and the asking cost eating the DMA gain? 3. GPU DMA writes name 0 pages to the kernel write-watch (we card-tested this), so zero-copy landings must be declared to tracking. Is a single committed-whole private pool (one home per byte) the better substrate rather than per-mapping private? 4. WC_BAR places 0 for us — are the title's write-combined buffers simply not registered as WC regions on our host, or are there genuinely no whole-WC no-UAV buffers in this scene? Happy to share counts/logs. What would you try?
Marsietiss commented 2026-12-02 02:42:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by Marsietiss on 2026-12-02T02:42:47Z.


@procotos-art that matches our read exactly. Our eligibility seam (a gate requiring one MEM_PRIVATE committed-whole region) is pointed at the wrong allocation class: the card copies map section pages shown at 3-60+ addresses, not the private graphics reservation.

We already have a design for the one-home-per-physical-page model: one holder record per (section, offset), one owner copy whose card buffer holds the truth, every other copy over the page brought current from the owner before a submission uses it. An independent refute left 6 open P0s before anything may be held, mostly around a DirectStorage write to physical pages under a held page, the landing fence ordering, partly-changed dwords, and alias invalidation.

Your native Prologue evidence is the missing piece. To answer those P0s against what actually worked, could you share the run-based patch details:

  1. How native tracks mapping epoch / resource-view generation per physical backing, and how a stale view is invalidated when a page is remapped or shown at a new address.
  2. The last-fence contract per physical backing: when the owner copy is authoritative vs title memory, and how a submission waits for the writing fence before reading through another alias.
  3. The contiguous mapping-run import: how a run is formed (anonymous vs shared-memfd 64 KiB), and how the physical-page owner and reservation are kept separate from the user-visible range so aliases do not force a fallback.
  4. How native handles a CPU or DMA write to a page that is currently imported (write-watch and import coexistence).

We will fold this into the design and re-refute before building anything that holds memory. Happy to share our design text and the P0 list.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7333120138 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7333120138). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-12-02T02:42:47Z. --- @procotos-art that matches our read exactly. Our eligibility seam (a gate requiring one MEM_PRIVATE committed-whole region) is pointed at the wrong allocation class: the card copies map section pages shown at 3-60+ addresses, not the private graphics reservation. We already have a design for the one-home-per-physical-page model: one holder record per (section, offset), one owner copy whose card buffer holds the truth, every other copy over the page brought current from the owner before a submission uses it. An independent refute left 6 open P0s before anything may be held, mostly around a DirectStorage write to physical pages under a held page, the landing fence ordering, partly-changed dwords, and alias invalidation. Your native Prologue evidence is the missing piece. To answer those P0s against what actually worked, could you share the run-based patch details: 1. How native tracks mapping epoch / resource-view generation per physical backing, and how a stale view is invalidated when a page is remapped or shown at a new address. 2. The last-fence contract per physical backing: when the owner copy is authoritative vs title memory, and how a submission waits for the writing fence before reading through another alias. 3. The contiguous mapping-run import: how a run is formed (anonymous vs shared-memfd 64 KiB), and how the physical-page owner and reservation are kept separate from the user-visible range so aliases do not force a fallback. 4. How native handles a CPU or DMA write to a page that is currently imported (write-watch and import coexistence). We will fold this into the design and re-refute before building anything that holds memory. Happy to share our design text and the P0 list.
procotos-art commented 2026-12-02 02:45:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by procotos-art on 2026-12-02T02:45:34Z.


Thanks for testing and sharing the exact breakdown, @Marsietiss — your log lines pinpoint the causes pretty cleanly. Here is what our logs show for each of the four points (measured on Ryzen 7 5700X 8C/16T + RTX 5080 16 GB ReBAR ON, Agility SDK 1.614.1):

1. What memory L0 DMA actually opens on (and why yours opened 0)

We do not open L0 DMA on the ~1.3 GB 64-bit copy-back heaps (try_open_low_l0_dma explicitly skips start >= (1u64 << 32) || len < (16 << 20)). It opens one heap, specifically on the 32-bit graphics reservation:

  • Reservation: 0x10000 (185 MiB, MEM_PRIVATE | MEM_WRITE_WATCH).
  • Inside it, 5 contiguous XMemMapPhysicalPages commits land: 0x10000 (10 MiB, GPU-RO), 0xa10000 (1 MiB, GPU-RO), 0xb10000 (27 MiB, GPU-RO), 0x2610000 (47 MiB), 0x5510000 (100 MiB).
  • The last three form one 174 MiB Card buffer (start=0xb10000, len=182,452,224, allow_uav=true), whose first 27 MiB (0xb10000..0x2610000) is marked GPU-read-only.
  • OpenExistingHeapFromAddress1 opens on 0xb10000+0xae00000 (bias=0), and our hardened per-range gate (!send_changed && !changes_only && (!allow_uav || range_is_gpu_readonly)) routes only the GPU-RO subrange to direct CopyBufferRegion(L0 -> L1). In our latest paired A/B on the rebased 37ff585 tree that moves 3.2 MB / 130 runs/frame via L0 DMA, cutting SEND_OWN CPU copy 2.37 -> 0.93 ms, card_mem 2.60 -> 1.15 ms, and 1s refr 15.4 -> 11.25 ms (p90 23.1 -> 15.4 ms), 5s FPS 16.50 -> 19.55 (0 errors).

Why private_whole refused yours ("title memory under write guards is not private memory committed whole"):

  1. Stale PAGE_READONLY splitting VirtualQuery: If any write-guard / cold-WW-RO pass marks pages inside 0xb10000..0xb910000 PAGE_READONLY before place_part, VirtualQuery splits the region and private_whole rejects it. In our tree with cold-WW-RO, we had to run watch::prepare_for_l0_dma(start, len) (restoring PAGE_READWRITE and blocking future RO promotion) right before place_part.
  2. Placeholder split/coalesce or buffer creation path: Make sure title_virtual_free treats MEM_PRESERVE_PLACEHOLDER | MEM_COALESCE_PLACEHOLDERS inside PRIVATE_LOW_RES as a no-op (returning 1, while still clearing GPU-RO on coalesce), and verify that 0xb10000+0xae00000 actually enters the Card creation path (not split into <16 MiB pieces or intercepted earlier).

2. Avoiding the alias-fallback storm and the ~147 askings / ~3.9 GB walked / ~4.5 ms cost

  • 64-bit aliased section pages (3–60+ VAs): We never back those with MEM_PRIVATE — they stay on section views with sharded VP_STRIPE + ARMING + COPY_BESIDE=1 + STORE_BESIDE=1. The 185 MiB 32-bit reservation has 0 aliases in this workload (we keep an error! alias detector in map_pages and it stays at 0).
  • Why you saw ~147 askings / ~3.9 GB walked/frame on 185 MiB: 3.9 GB / 185 MiB ≈ 21× full walks per frame (~147 per-run GetWriteWatch calls). In our stack, ask_once coalesces write-watch queries per reservation (ask_once_by_res) and caches dirty results in the per-submission Journal (ASK_FLUSH=1 batches ask_more once per flush instead of per copy). Without reservation-level coalescing + journal caching, GetWriteWatch re-walks the same 185 MiB dozens of times per frame and eats the DMA win.

3. GPU DMA writebacks vs GetWriteWatch & single private pool

Agreed 100% on the hardware behavior: GPU DMA writes bypass the CPU MMU PTE dirty bit, so GetWriteWatch reports 0 pages and any GPU→CPU landing must explicitly notify tracking (Journal::note / write epoch). That is why our l0_dma_range_safe gate forbids L0 DMA on any UAV-writable (non-GPU-RO) subrange rather than trying to mix zero-copy GPU landings with write-watch. A single committed-whole private pool is great for un-aliased regions (like the 32-bit reservation), while aliased 64-bit pages still need MEM_MAPPED views so CPU writes through one alias remain immediately coherent at the other 3–60+ VAs without copying.

4. Why WC_BAR placed 0 MB for you

In our runs on the same scene with WC_BAR=3 (smart), it places 3,005 buffers totaling 683.9 MB (92 buffers >= 1 MiB, 2,913 buffers < 1 MiB, e.g. 0xe770f0000+24 MiB, 0xda5c3df00+24 MiB, 0xda51c0000+10.5 MiB, 0xd5e566000+2 MiB). Three things to check on your tree:

  1. WC registration in XMemVirtualAlloc: The title requests ~4.6 GB with the console WC bit 0x400 set (protect = 0x2404 for 2199 MB at 0xd49400000 and 2413 MB at 0xe2c000000, plus 0x42404). title_memory_write_combined(at, size) must check the raw asked & 0x400 != 0 before masking off console protection bits for Win32; otherwise is_write_combined() always returns false.
  2. Agility SDK D3D12_HEAP_TYPE_GPU_UPLOAD: Confirm GPUUploadHeapSupported == true at startup (card memory the CPU maps supported=true). Without ReBAR + Agility SDK D3D12\D3D12Core.dll (>= 1.610) beside the binary, mapped_card_buffer() quietly returns None -> 0 placed.
  3. Mode & cutoff: Mode 1 requires a WC_NO_BACK cutoff to be set; mode 3/smart (!allow_uav || cutoff.is_some_and(|min| len >= min)) is what admits all no-UAV WC buffers of any size directly into CPU-mapped VRAM.

For reference, we just rebased the clean-room GUARD_SHARDED + LOW_L0_DMA + LOCK_TRIM/ASK_FLUSH patches (MIT-0) onto 37ff585 here: https://gist.github.com/procotos-art/6e1d42c88281148cb0f75a2be716fb82

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7333168483 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7333168483). Originally posted by [procotos-art](https://github.com/procotos-art) on 2026-12-02T02:45:34Z. --- Thanks for testing and sharing the exact breakdown, @Marsietiss — your log lines pinpoint the causes pretty cleanly. Here is what our logs show for each of the four points (measured on Ryzen 7 5700X 8C/16T + RTX 5080 16 GB ReBAR ON, Agility SDK `1.614.1`): ### 1. What memory L0 DMA actually opens on (and why yours opened `0`) We do **not** open L0 DMA on the ~1.3 GB 64-bit copy-back heaps (`try_open_low_l0_dma` explicitly skips `start >= (1u64 << 32) || len < (16 << 20)`). It opens **one** heap, specifically on the 32-bit graphics reservation: - Reservation: `0x10000` (`185 MiB`, `MEM_PRIVATE | MEM_WRITE_WATCH`). - Inside it, 5 contiguous `XMemMapPhysicalPages` commits land: `0x10000` (`10 MiB`, GPU-RO), `0xa10000` (`1 MiB`, GPU-RO), `0xb10000` (`27 MiB`, GPU-RO), `0x2610000` (`47 MiB`), `0x5510000` (`100 MiB`). - The last three form **one** `174 MiB` `Card` buffer (`start=0xb10000, len=182,452,224, allow_uav=true`), whose first `27 MiB` (`0xb10000..0x2610000`) is marked GPU-read-only. - `OpenExistingHeapFromAddress1` opens on `0xb10000+0xae00000` (`bias=0`), and our hardened per-range gate (`!send_changed && !changes_only && (!allow_uav || range_is_gpu_readonly)`) routes only the GPU-RO subrange to direct `CopyBufferRegion(L0 -> L1)`. In our latest paired A/B on the rebased `37ff585` tree that moves `3.2 MB / 130 runs/frame` via L0 DMA, cutting `SEND_OWN` CPU copy `2.37 -> 0.93 ms`, `card_mem 2.60 -> 1.15 ms`, and `1s refr` `15.4 -> 11.25 ms` (`p90 23.1 -> 15.4 ms`), `5s FPS 16.50 -> 19.55` (0 errors). Why `private_whole` refused yours (`"title memory under write guards is not private memory committed whole"`): 1. **Stale `PAGE_READONLY` splitting `VirtualQuery`:** If any write-guard / cold-WW-RO pass marks pages inside `0xb10000..0xb910000` `PAGE_READONLY` before `place_part`, `VirtualQuery` splits the region and `private_whole` rejects it. In our tree with cold-WW-RO, we had to run `watch::prepare_for_l0_dma(start, len)` (restoring `PAGE_READWRITE` and blocking future RO promotion) right before `place_part`. 2. **Placeholder split/coalesce or buffer creation path:** Make sure `title_virtual_free` treats `MEM_PRESERVE_PLACEHOLDER | MEM_COALESCE_PLACEHOLDERS` inside `PRIVATE_LOW_RES` as a no-op (returning `1`, while still clearing GPU-RO on coalesce), and verify that `0xb10000+0xae00000` actually enters the `Card` creation path (not split into `<16 MiB` pieces or intercepted earlier). ### 2. Avoiding the alias-fallback storm and the `~147 askings / ~3.9 GB walked / ~4.5 ms` cost - **64-bit aliased section pages (3–60+ VAs):** We never back those with `MEM_PRIVATE` — they stay on section views with sharded `VP_STRIPE` + `ARMING` + `COPY_BESIDE=1` + `STORE_BESIDE=1`. The `185 MiB` 32-bit reservation has **0 aliases** in this workload (we keep an `error!` alias detector in `map_pages` and it stays at 0). - **Why you saw `~147 askings / ~3.9 GB walked/frame` on 185 MiB:** `3.9 GB / 185 MiB ≈ 21×` full walks per frame (~147 per-run `GetWriteWatch` calls). In our stack, `ask_once` coalesces write-watch queries per reservation (`ask_once_by_res`) and caches dirty results in the per-submission `Journal` (`ASK_FLUSH=1` batches `ask_more` once per flush instead of per copy). Without reservation-level coalescing + journal caching, `GetWriteWatch` re-walks the same `185 MiB` dozens of times per frame and eats the DMA win. ### 3. GPU DMA writebacks vs `GetWriteWatch` & single private pool Agreed 100% on the hardware behavior: GPU DMA writes bypass the CPU MMU PTE dirty bit, so `GetWriteWatch` reports 0 pages and any GPU→CPU landing must explicitly notify tracking (`Journal::note` / write epoch). That is why our `l0_dma_range_safe` gate forbids L0 DMA on any UAV-writable (non-GPU-RO) subrange rather than trying to mix zero-copy GPU landings with write-watch. A single committed-whole private pool is great for un-aliased regions (like the 32-bit reservation), while aliased 64-bit pages still need `MEM_MAPPED` views so CPU writes through one alias remain immediately coherent at the other 3–60+ VAs without copying. ### 4. Why `WC_BAR` placed `0 MB` for you In our runs on the same scene with `WC_BAR=3` (`smart`), it places **3,005 buffers totaling 683.9 MB** (`92` buffers `>= 1 MiB`, `2,913` buffers `< 1 MiB`, e.g. `0xe770f0000+24 MiB`, `0xda5c3df00+24 MiB`, `0xda51c0000+10.5 MiB`, `0xd5e566000+2 MiB`). Three things to check on your tree: 1. **WC registration in `XMemVirtualAlloc`:** The title requests ~4.6 GB with the console WC bit `0x400` set (`protect = 0x2404` for `2199 MB` at `0xd49400000` and `2413 MB` at `0xe2c000000`, plus `0x42404`). `title_memory_write_combined(at, size)` must check the **raw `asked & 0x400 != 0`** *before* masking off console protection bits for Win32; otherwise `is_write_combined()` always returns `false`. 2. **Agility SDK `D3D12_HEAP_TYPE_GPU_UPLOAD`:** Confirm `GPUUploadHeapSupported == true` at startup (`card memory the CPU maps supported=true`). Without ReBAR + Agility SDK `D3D12\D3D12Core.dll` (`>= 1.610`) beside the binary, `mapped_card_buffer()` quietly returns `None` -> `0 placed`. 3. **Mode & cutoff:** Mode `1` requires a `WC_NO_BACK` cutoff to be set; mode `3`/`smart` (`!allow_uav || cutoff.is_some_and(|min| len >= min)`) is what admits all `no-UAV` WC buffers of any size directly into CPU-mapped VRAM. For reference, we just rebased the clean-room `GUARD_SHARDED` + `LOW_L0_DMA` + `LOCK_TRIM`/`ASK_FLUSH` patches (MIT-0) onto `37ff585` here: https://gist.github.com/procotos-art/6e1d42c88281148cb0f75a2be716fb82
Marsietiss commented 2026-12-02 05:53:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by Marsietiss on 2026-12-02T05:53:44Z.


Findings from implementing and canary-testing the per-run L0 path on an RTX 5080, and the flight-snapshot gap it exposed. Credit to @procotos-art for the eligibility seam, the ask-once-per-reservation idea, and the recovered first-draw snapshot discipline.

  1. The multi-allocation wall is real and the per-run open works. A heap span crossing two private allocations is refused by the host (parameter error), and a whole-region query sees two regions. Our substrate makes one allocation per mapping call, so a large multi-commit buffer cannot open whole. Opening on the largest GPU-read-only run (one allocation, >=16 MiB) succeeds on the 5080: whole-buffer refused, per-run fallback opened one heap, ~3.5-3.9 MiB / ~127 runs per frame sent direct (your paired figure was ~3.2 MiB / 130). Source offset bias + a - off with span containment; a byte-exact card canary (off != 0 and off = 0, every byte of five runs) passes, and the old wrong formula reads out of the placed span.

  2. But L0 direct is NOT a flight snapshot, and that is the wrong-texture corrupter. A card canary records an L0 CopyBufferRegion, rewrites the source ring before execution, then submits: the destination holds the rewrite's bytes (all differ), and two flights recorded on one ring slot cross-contaminate (flight N reads N+1). The prepare-time upload-snapshot control holds its own epoch in both cases. So the patchy/wrong-material world tiles are a source-epoch violation, not an offset bug: the title runs ahead of deferred flights and reuses ring slots between record and GPU execution, and a live-memory read delivers the newer epoch.

  3. Impossibility, confirmed from both sides. There is no mechanism that lets the title overwrite a live ring slot while guaranteeing a delayed GPU copy still reads its previous contents. Generic native direct imports assumed a serialized flight. Your recovered first-draw hybrid is the solution: capture exact descriptor/CBV/VB bytes into flight-private storage at exact offsets (never round the guest address down into neighbors), retain until the consuming fence retires, recheck the source immediately before submission and refuse + rebuild if it changed, never refresh a snapshot while its flight is active. The stricter L0 form (block guest writes while the GPU consumes, release after fence + visibility) only works with that serialization or blocking.

  4. Adopted direction. Mutable / reused-ring sources and descriptor/CBV/VB use the flight-private snapshot; true zero-copy L0 only where the source is provably held stable or flights serialized (fail closed to snapshot otherwise); write-combined buffers get a per-flight card-memory ring (freeze epoch N in buffer N). The frame win is then from DELETING GPU-write machinery (copy-back, landing, card compare, dword merge, descriptor dirty-sync, flight wait for returning bytes) for the proven CPU-owned epoch-frozen set, not from DMA volume. Asking is one walk per noted reservation per flush with every asking in that flush answering from the journal.

  5. Open. A reuse/stability classification is a property of the past, not the future bytes at record, and we have no ring/shader-binding metadata, so fail-closed makes snapshot the default for mutable memory; the ownership trim (delete-work) is gated behind the epoch proof. Runnable canaries now cover byte-exactness, flight-snapshot (destination vs snapshot at the submission's own fence), watch-after-open, GPU-DMA blindness, overlap identity, guard pages outside the range, and ordered CPU/GPU collision.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7336406111 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7336406111). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-12-02T05:53:44Z. --- Findings from implementing and canary-testing the per-run L0 path on an RTX 5080, and the flight-snapshot gap it exposed. Credit to @procotos-art for the eligibility seam, the ask-once-per-reservation idea, and the recovered first-draw snapshot discipline. 1) The multi-allocation wall is real and the per-run open works. A heap span crossing two private allocations is refused by the host (parameter error), and a whole-region query sees two regions. Our substrate makes one allocation per mapping call, so a large multi-commit buffer cannot open whole. Opening on the largest GPU-read-only run (one allocation, >=16 MiB) succeeds on the 5080: whole-buffer refused, per-run fallback opened one heap, ~3.5-3.9 MiB / ~127 runs per frame sent direct (your paired figure was ~3.2 MiB / 130). Source offset bias + a - off with span containment; a byte-exact card canary (off != 0 and off = 0, every byte of five runs) passes, and the old wrong formula reads out of the placed span. 2) But L0 direct is NOT a flight snapshot, and that is the wrong-texture corrupter. A card canary records an L0 CopyBufferRegion, rewrites the source ring before execution, then submits: the destination holds the rewrite's bytes (all differ), and two flights recorded on one ring slot cross-contaminate (flight N reads N+1). The prepare-time upload-snapshot control holds its own epoch in both cases. So the patchy/wrong-material world tiles are a source-epoch violation, not an offset bug: the title runs ahead of deferred flights and reuses ring slots between record and GPU execution, and a live-memory read delivers the newer epoch. 3) Impossibility, confirmed from both sides. There is no mechanism that lets the title overwrite a live ring slot while guaranteeing a delayed GPU copy still reads its previous contents. Generic native direct imports assumed a serialized flight. Your recovered first-draw hybrid is the solution: capture exact descriptor/CBV/VB bytes into flight-private storage at exact offsets (never round the guest address down into neighbors), retain until the consuming fence retires, recheck the source immediately before submission and refuse + rebuild if it changed, never refresh a snapshot while its flight is active. The stricter L0 form (block guest writes while the GPU consumes, release after fence + visibility) only works with that serialization or blocking. 4) Adopted direction. Mutable / reused-ring sources and descriptor/CBV/VB use the flight-private snapshot; true zero-copy L0 only where the source is provably held stable or flights serialized (fail closed to snapshot otherwise); write-combined buffers get a per-flight card-memory ring (freeze epoch N in buffer N). The frame win is then from DELETING GPU-write machinery (copy-back, landing, card compare, dword merge, descriptor dirty-sync, flight wait for returning bytes) for the proven CPU-owned epoch-frozen set, not from DMA volume. Asking is one walk per noted reservation per flush with every asking in that flush answering from the journal. 5) Open. A reuse/stability classification is a property of the past, not the future bytes at record, and we have no ring/shader-binding metadata, so fail-closed makes snapshot the default for mutable memory; the ownership trim (delete-work) is gated behind the epoch proof. Runnable canaries now cover byte-exactness, flight-snapshot (destination vs snapshot at the submission's own fence), watch-after-open, GPU-DMA blindness, overlap identity, guard pages outside the range, and ordered CPU/GPU collision.
Marsietiss commented 2026-12-02 08:14:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by Marsietiss on 2026-12-02T08:14:14Z.


Update after canaries, refutes and a contract pass. Credit @procotos-art for the eligibility seam, ask-once-per-reservation, and the recovered first-draw snapshot discipline.

  1. Per-run L0 works mechanically on the 5080: whole-buffer open refused (host refuses a span over two allocations), per-run heap on the 27 MiB GPU-RO run opens, byte-exact (offset bias+a-off verified every byte), ~2.4-3.9 MB / 112-128 runs direct per frame.

  2. But deferred live-read breaks source-epoch (our PB-23), and that is the wrong-texture / patchy-road class. Card canary: record an L0 copy, rewrite the source ring before execution, submit -> destination holds the rewrite's bytes; two flights on one slot cross-contaminate; the prepare-time upload-snapshot control holds its own epoch. Impossibility confirmed from both sides: nothing lets the title overwrite a live ring while a DELAYED GPU copy reads the previous contents; generic native direct imports assumed a serialized flight. Your recovered first-draw hybrid (exact flight-private snapshot, retain to consuming fence, recheck before submit / refuse+rebuild, never refresh while active) is the correct fallback for mutable memory.

  3. The "delete GPU-write machinery" trim is subsumed by the shipped unified_back default: leaves(ReadOnly, GPU_RO)=true keeps GPU-RO pieces on the card (no fetch/land/put-back). The ~2 ms we measured came from running UNIFIED_BACK=0, a non-default that re-declares them. Trim parked.

  4. Route now being built to make LIVE zero-copy epoch-correct without a CPU snapshot: prompt-L0, executing the direct copies same-frame (own list + immediate submit + fence on the copy queue) so the live source read lands before the title's next ring write. Verifying road-clean + fps with L0 live. Fallbacks if the latency bound is unreliable: copy-on-write ring rename (fault-intercepted, guarantees the old epoch) or the flight-private snapshot.

  5. Synthesis: an adaptive per-region/per-flight policy choosing the cheapest correctness-preserving strategy (leave-on-card / live-L0 for provably-immutable / prompt-L0 / COW ring rename / epoch-frozen snapshot / full copy-back), promoting on positive evidence and demoting on any epoch mismatch. Zero-copy becomes one option the layer picks, not a global mode.

  6. Ready safe config measured at the road spot: unified_back=1 + epoch class + asking loop = 22.5 fps / 44.5 ms at 10518 draws (4.23 us/draw) vs unified_back=0 baseline 20.3 fps / 49 ms at 9150 draws (5.36 us/draw); copy-back 7.7 -> 3.0 ms.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7339179830 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7339179830). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-12-02T08:14:14Z. --- Update after canaries, refutes and a contract pass. Credit @procotos-art for the eligibility seam, ask-once-per-reservation, and the recovered first-draw snapshot discipline. 1) Per-run L0 works mechanically on the 5080: whole-buffer open refused (host refuses a span over two allocations), per-run heap on the 27 MiB GPU-RO run opens, byte-exact (offset bias+a-off verified every byte), ~2.4-3.9 MB / 112-128 runs direct per frame. 2) But deferred live-read breaks source-epoch (our PB-23), and that is the wrong-texture / patchy-road class. Card canary: record an L0 copy, rewrite the source ring before execution, submit -> destination holds the rewrite's bytes; two flights on one slot cross-contaminate; the prepare-time upload-snapshot control holds its own epoch. Impossibility confirmed from both sides: nothing lets the title overwrite a live ring while a DELAYED GPU copy reads the previous contents; generic native direct imports assumed a serialized flight. Your recovered first-draw hybrid (exact flight-private snapshot, retain to consuming fence, recheck before submit / refuse+rebuild, never refresh while active) is the correct fallback for mutable memory. 3) The "delete GPU-write machinery" trim is subsumed by the shipped unified_back default: leaves(ReadOnly, GPU_RO)=true keeps GPU-RO pieces on the card (no fetch/land/put-back). The ~2 ms we measured came from running UNIFIED_BACK=0, a non-default that re-declares them. Trim parked. 4) Route now being built to make LIVE zero-copy epoch-correct without a CPU snapshot: prompt-L0, executing the direct copies same-frame (own list + immediate submit + fence on the copy queue) so the live source read lands before the title's next ring write. Verifying road-clean + fps with L0 live. Fallbacks if the latency bound is unreliable: copy-on-write ring rename (fault-intercepted, guarantees the old epoch) or the flight-private snapshot. 5) Synthesis: an adaptive per-region/per-flight policy choosing the cheapest correctness-preserving strategy (leave-on-card / live-L0 for provably-immutable / prompt-L0 / COW ring rename / epoch-frozen snapshot / full copy-back), promoting on positive evidence and demoting on any epoch mismatch. Zero-copy becomes one option the layer picks, not a global mode. 6) Ready safe config measured at the road spot: unified_back=1 + epoch class + asking loop = 22.5 fps / 44.5 ms at 10518 draws (4.23 us/draw) vs unified_back=0 baseline 20.3 fps / 49 ms at 9150 draws (5.36 us/draw); copy-back 7.7 -> 3.0 ms.
Marsietiss commented 2026-12-02 16:32:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by Marsietiss on 2026-12-02T16:32:24Z.


Zero-copy placement findings (measured, continuing this thread):

  1. A pool the translation reads on the CPU must live in PC memory the card reads over the bus, not in CPU-mapped card memory. CPU reads of CPU-mapped VRAM crawl (~40 MB/s effective); one upload ring measured ~814 ms/frame in CPU-mapped card memory vs ~25 ms in PC memory. The card reads such a pool about once a frame, so the bus cost is small; the CPU read speed is what matters. (PCIe read bandwidth is a hardware limit.)

  2. A host-opened pool has no write watch. A CPU-side refresh then copies everything it is asked for at each submission (~164 MB/frame of redundant copies measured) unless the card copies from the pool buffer instead. Removing the write watch needs a refresh-source plan.

  3. The upload pool is a placeholder split into several pieces (the write-combined ring is one piece, already DMA-able as a GPU-read-only run). Host-opening the whole pool as one committed region is a substrate change, and the physical pages are shared/aliased across addresses, so sharing must be preserved.

  4. The submitting thread's remaining cost is asking, not moving bytes: a large texture block spends ~10 ms/frame refreshing ~2 MB, and the title's own small copies ~8 ms for under 0.5 MB. Compare-first stores (skip a store that writes what is already there) measured ~34.6 vs 36.2 ms in 12 of 14 pairs.

All switch-gated and fail-closed. Matched-draws A/B at a fixed spot is the bar; us/draw alone drifts.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7352093325 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7352093325). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-12-02T16:32:24Z. --- Zero-copy placement findings (measured, continuing this thread): 1. A pool the translation reads on the CPU must live in PC memory the card reads over the bus, not in CPU-mapped card memory. CPU reads of CPU-mapped VRAM crawl (~40 MB/s effective); one upload ring measured ~814 ms/frame in CPU-mapped card memory vs ~25 ms in PC memory. The card reads such a pool about once a frame, so the bus cost is small; the CPU read speed is what matters. (PCIe read bandwidth is a hardware limit.) 2. A host-opened pool has no write watch. A CPU-side refresh then copies everything it is asked for at each submission (~164 MB/frame of redundant copies measured) unless the card copies from the pool buffer instead. Removing the write watch needs a refresh-source plan. 3. The upload pool is a placeholder split into several pieces (the write-combined ring is one piece, already DMA-able as a GPU-read-only run). Host-opening the whole pool as one committed region is a substrate change, and the physical pages are shared/aliased across addresses, so sharing must be preserved. 4. The submitting thread's remaining cost is asking, not moving bytes: a large texture block spends ~10 ms/frame refreshing ~2 MB, and the title's own small copies ~8 ms for under 0.5 MB. Compare-first stores (skip a store that writes what is already there) measured ~34.6 vs 36.2 ms in 12 of 14 pairs. All switch-gated and fail-closed. Matched-draws A/B at a fixed spot is the bar; us/draw alone drifts.
Marsietiss commented 2026-12-02 17:05:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by Marsietiss on 2026-12-02T17:05:06Z.


@readmet3xt-lab see https://github.com/Marsietiss/Mangrove/tree/zero-copy
Status: implemented behind switches (default off = byte-identical old path). The card can DMA directly from the title's own memory for proven CPU-owned / GPU-read-only intervals; the CPU shuttle is removed for those runs. The frame win is expected to come from DELETING GPU-write machinery once ownership is proven, not from DMA volume (see Roadmap).

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7352876914 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7352876914). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-12-02T17:05:06Z. --- @readmet3xt-lab see https://github.com/Marsietiss/Mangrove/tree/zero-copy Status: implemented behind switches (default off = byte-identical old path). The card can DMA directly from the title's own memory for proven CPU-owned / GPU-read-only intervals; the CPU shuttle is removed for those runs. The frame win is expected to come from DELETING GPU-write machinery once ownership is proven, not from DMA volume (see Roadmap).
procotos-art commented 2026-12-02 21:03:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by procotos-art on 2026-12-02T21:03:56Z.


Update: 23.95 med / 31.8 Peak Native FPS in Indoor Scenes (0 FrameGen) + Full Toolkit/Skills + Help Wanted on Flicker & Stutters

Sharing our latest clean-room patch series (01..12), full debugging toolkit/skills/scientific protocol, and a concrete RFC / help request on the remaining flicker and periodic frame stutters.

Measured Progression (8C/16T Zen 3, 32 GB DDR4, 16 GB ReBAR GPU, Native 1440p + DLSS Quality, 0 FrameGen)

Stage 5s FPS (med / peak) frame_ms (med) prep (med) ms/1k draws
Stock (37ff585, defaults) 13.15 / — 76.05 — —
+ Packs 01..09 (GUARD_SHARDED, LOW_L0_DMA, STEPS_FAST, WC_BAR_NO_CPU_READ, READABLE_FAST, UPLOAD_AHEAD=1, INDIRECT_BATCH=3) 20.90 / 26.8 47.8 35.1 19.2
+ PASS_4MS_H0 + Visual Pack 11 (RAYMISS_ZERO, EMISSIVE_FALLBACK, FRESH_FIRST, KEEP_SHOWN=2) 23.95 / 31.8 (indoor 1.1k–2.0k draws; 18.4–20.0 at 3.8k–4.0k draws) 41.9 28.6 17.89

(To be completely transparent: 30+ FPS peak is in indoor scenes, and periodic stutters/freezes >100 ms plus intermittent flicker still occur during camera cuts and panning.)

Help Wanted: Flicker, Post-Cut Underload & Periodic Stutters (H1 / H2 / H3)

We added DARNER_ARTIFACT_DETECT=1 v2 (12_darner_artifact_detect_v2.patch — pure-GPU 96x54 compute shader, ~30 us/frame, 0 CPU threads) to separate and measure the remaining visual defects deterministically:

  • SCENE_FLIP: >=10% of screen strong 1-frame A-B-A flip (dRGB >= 45).
  • OBJ_FLICKER: localized sharp A-B-A (dRGB >= 65 or dSpr >= 80, >=6 tiles, logs (pct_x, pct_y)).
  • CUT_UNDERLOAD / UNDERLOAD_LAG: post-cut pop-in (cut+2..cut+60) + direct HEAP_TEXTURES_QUEUE lag (due_slots, oldest_due_frames > 15).

Three competing hypotheses we would love community feedback / PR ideas on:

  1. H1 (TextureQueue lock contention & starvation under PASS_4MS_H0): With TEXSPK_PASS_MS=4, HURRY_PASSES=0, FRESH_FIRST=1, due_slots climbs to 21,333, oldest_due_frames reaches 183 frames (~9 s!), and qlock (waited for locks: the queue's ... by other threads) explodes 7.4x (587 ms -> 4,365 ms / 5s across 8 worker threads!). Any ideas for a lock-free / O(1) std::mem::take drain + out-of-lock prioritization in TextureQueue::ordered_with so 8 recording workers stop stalling on qlock while keeping due drained?
  2. H2 (Replaced texture copy lifetime): Upstream 3b2560f4 waits for references(&host.texture) == 1 before dropping replaced texture copies — testing whether that eliminates localized 1-frame missing-texture flips.
  3. H3 (Async submit/present race under SUBMIT_SPLIT=2): Testing upstream 5b273e10 (DARNER_PRESENT_SENT=1) and camera-panning stability on the latest upstream (8050243).

Full Dead-End Ledger (including why MAKE_TWINNED_FAST, TEXTURE_TRUST_GUARD, BUF_COPY_DEDUP, TEXTURE_SOFT_MB=8192, PRELUDE_UPLOADS=0, etc. were dropped) and our automated log/video-audit tools are in the Toolkit Gist above.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7358738577 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7358738577). Originally posted by [procotos-art](https://github.com/procotos-art) on 2026-12-02T21:03:56Z. --- ### Update: 23.95 med / 31.8 Peak Native FPS in Indoor Scenes (0 FrameGen) + Full Toolkit/Skills + Help Wanted on Flicker & Stutters Sharing our latest clean-room patch series (`01..12`), full debugging toolkit/skills/scientific protocol, and a **concrete RFC / help request** on the remaining flicker and periodic frame stutters. - **Patches Gist (`01..12.patch`, base `37ff585` -> `2a8dd99`, MIT-0):** https://gist.github.com/procotos-art/6e1d42c88281148cb0f75a2be716fb82 - **Toolkit, Agent Skills, Scientific Protocol & Dead-End Ledger (MIT-0):** https://gist.github.com/procotos-art/e0e1b3a1be41d3648045189cf5c08a6c - **Legal Microbenchmark Twin:** https://github.com/POMXARK/victory-city-bench #### Measured Progression (8C/16T Zen 3, 32 GB DDR4, 16 GB ReBAR GPU, Native 1440p + DLSS Quality, 0 FrameGen) | Stage | 5s FPS (med / peak) | `frame_ms` (med) | `prep` (med) | `ms/1k draws` | |---|---:|---:|---:|---:| | Stock (`37ff585`, defaults) | `13.15` / — | `76.05` | — | — | | + Packs `01..09` (`GUARD_SHARDED`, `LOW_L0_DMA`, `STEPS_FAST`, `WC_BAR_NO_CPU_READ`, `READABLE_FAST`, `UPLOAD_AHEAD=1`, `INDIRECT_BATCH=3`) | `20.90` / `26.8` | `47.8` | `35.1` | `19.2` | | **+ `PASS_4MS_H0` + Visual Pack `11` (`RAYMISS_ZERO`, `EMISSIVE_FALLBACK`, `FRESH_FIRST`, `KEEP_SHOWN=2`)** | **`23.95` / `31.8`** (indoor 1.1k–2.0k draws; `18.4–20.0` at 3.8k–4.0k draws) | **`41.9`** | **`28.6`** | **`17.89`** | *(To be completely transparent: **30+ FPS peak is in indoor scenes**, and periodic stutters/freezes `>100 ms` plus intermittent flicker still occur during camera cuts and panning.)* #### Help Wanted: Flicker, Post-Cut Underload & Periodic Stutters (`H1 / H2 / H3`) We added **`DARNER_ARTIFACT_DETECT=1` v2** (`12_darner_artifact_detect_v2.patch` — pure-GPU 96x54 compute shader, ~30 us/frame, 0 CPU threads) to separate and measure the remaining visual defects deterministically: - **`SCENE_FLIP`**: >=10% of screen strong 1-frame A-B-A flip (`dRGB >= 45`). - **`OBJ_FLICKER`**: localized sharp A-B-A (`dRGB >= 65` or `dSpr >= 80`, >=6 tiles, logs `(pct_x, pct_y)`). - **`CUT_UNDERLOAD` / `UNDERLOAD_LAG`**: post-cut pop-in (`cut+2..cut+60`) + direct `HEAP_TEXTURES_QUEUE` lag (`due_slots`, `oldest_due_frames > 15`). Three competing hypotheses we would love community feedback / PR ideas on: 1. **`H1` (`TextureQueue` lock contention & starvation under `PASS_4MS_H0`):** With `TEXSPK_PASS_MS=4, HURRY_PASSES=0, FRESH_FIRST=1`, `due_slots` climbs to **`21,333`**, `oldest_due_frames` reaches **`183 frames` (~9 s!)**, and `qlock` (`waited for locks: the queue's ... by other threads`) explodes **7.4x** (`587 ms -> 4,365 ms / 5s` across 8 worker threads!). Any ideas for a **lock-free / O(1) `std::mem::take` drain + out-of-lock prioritization** in `TextureQueue::ordered_with` so 8 recording workers stop stalling on `qlock` while keeping `due` drained? 2. **`H2` (Replaced texture copy lifetime):** Upstream `3b2560f4` waits for `references(&host.texture) == 1` before dropping replaced texture copies — testing whether that eliminates localized 1-frame missing-texture flips. 3. **`H3` (Async submit/present race under `SUBMIT_SPLIT=2`):** Testing upstream `5b273e10` (`DARNER_PRESENT_SENT=1`) and camera-panning stability on the latest upstream (`8050243`). Full Dead-End Ledger (including why `MAKE_TWINNED_FAST`, `TEXTURE_TRUST_GUARD`, `BUF_COPY_DEDUP`, `TEXTURE_SOFT_MB=8192`, `PRELUDE_UPLOADS=0`, etc. were dropped) and our automated log/video-audit tools are in the Toolkit Gist above.
procotos-art commented 2026-12-02 22:31:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by procotos-art on 2026-12-02T22:31:12Z.


Important Correction: Earlier 01..12 Patch Stack Is Deprecated (Analysis Only — Do NOT Apply In-Game) + High-Performance Sibling D3D12 Architecture Findings

Following strict controlled 3-minute fast-camera-spin A/B benchmarks (8-core / 16-thread x86-64 + 16 GB ReBAR-ON RTX GPU, Agility SDK D3D12Core.dll verified), I want to be completely transparent and save everyone time:

1. Do NOT apply our earlier 01..12 patch stack in-game — keep strictly for post-mortem analysis

Our earlier 01..12 patch series (rebased on legacy 37ff585 / 2a8dd99) looked good in short 50s static indoor captures, but regresses badly under real sustained camera motion compared to clean upstream 8050243 (v2026.12.02.01):

Build (3-min fast camera spin, ~4.9k draws/f) 5s FPS (med / avg / max) frame_ms (med / max) >100 ms freezes TextureQueue (due / oldest) Visual verdict
Legacy 01..12 stack (2a8dd99 + PASS_4MS_H0) 20.30 / 18.99 / 26.30 49.3 / 1031.1 ms 2 due=3,955 / oldest=62f Pop-in & object flicker (406)
Clean upstream 8050243 (defaults + Agility SDK) 22.30 / 22.53 / 32.40 44.9 / 68.3 ms 0 due=0 / oldest=0f Much cleaner, residual 1f flips only
8050243 + WC_BAR_NO_CPU_READ=1 (reverted) 21.80 / 21.65 / 27.60 45.9 / 282.2 ms 1 due=0 Dark surface/face blotches (despite copyback 19.0 -> 9.3 ms)
8050243 + DARNER_HEAP_HOOKS=1 (vs 20.30 spin base) 18.20 / 17.85 / 23.90 55.1 / 310.9 ms 2 due=0 -2.10 FPS regression
8050243 + HEAP_HOOKS=1 + SUBMIT_SPLIT=0 + PRESENT_SENT=1 18.85 / 18.47 / 24.50 53.0 / 148.1 ms 1 due=0 -1.45 FPS regression, residual flips unchanged

Key post-mortem takeaways (all logged in our Dead-End Ledger Gist):

  • PASS_4MS_H0 (TEXSPK_PASS_MS=4 + HURRY_PASSES=0) starves the texture upload queue under camera movement (due grows to thousands, causing late pop-in).
  • WC_BAR_NO_CPU_READ=1 halves async copyback (19.0 -> 9.3 ms), but relay runs off the critical path (zero FPS gain) while skipping < 1 MiB write-backs corrupts aliased/placed surface data (visible blotches).
  • Always ship Agility SDK D3D12\D3D12Core.dll beside any rebuilt runtime binary; falling back to SYSTEM32\D3D12Core.dll silently disables GPU_UPLOAD / ReBAR / HEAP_TWIN and causes GPU hangs.
  • The patches Gist (01..12) has been clearly marked DEPRECATED — ANALYSIS ONLY / DO NOT APPLY IN-GAME.

2. High performance, timely asset streaming, and zero frame-flipping in the sibling D3D12 translation tree (b417632)

In parallel, we built and tested the active sibling D3D12 translation tree (commit b417632, clean default configuration + warmed shader/pipeline cache) on the exact same 8-core + RTX 5080 host, and the difference in real-world playability, visual stability, and throughput is dramatic:

  • Zero frame flipping & stutter-free pacing in live gameplay.
  • Textures and geometry/models stream in on time without delayed pop-in or queue starvation.
  • Code audit of why that architecture works so well right now points to the combination of:
    1. Synchronous presentation & submission ordering (SUBMIT_SENDER=1 + SHOW_AFTER=1 + UPLOAD_AHEAD=1, avoiding SUBMIT_SPLIT=2 submission races and upload queue caps).
    2. Descriptor & heap fast paths (PORT_DESCRIPTORS=1, INDEX_HEAP_SPANS=1, PORT_JOURNAL=1) paired with ALIAS_DIRECT=1 texture mapping.
    3. Wave32 compute pairing & NaN scrubbing (PAIRED_FOR across 45 key lighting/temporal/shadow/defrag compute shaders + NAN_SCRUB=1).
    4. Pipeline compilation discipline (PIPELINE_WAIT_MS=10000 instead of silently dropping model draws when a PSO is not yet cached).

We are updating our benchmark & analysis priority to focus on that higher-performing D3D12 architecture going forward, and keeping the older 01..12 patch Gist strictly as a cautionary negative-result archive alongside the updated Dead-End Ledger:

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7360803503 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7360803503). Originally posted by [procotos-art](https://github.com/procotos-art) on 2026-12-02T22:31:12Z. --- ### Important Correction: Earlier `01..12` Patch Stack Is Deprecated (Analysis Only — Do NOT Apply In-Game) + High-Performance Sibling D3D12 Architecture Findings Following strict controlled 3-minute fast-camera-spin A/B benchmarks (8-core / 16-thread x86-64 + 16 GB ReBAR-ON RTX GPU, Agility SDK `D3D12Core.dll` verified), I want to be completely transparent and save everyone time: #### 1. Do NOT apply our earlier `01..12` patch stack in-game — keep strictly for post-mortem analysis Our earlier `01..12` patch series (rebased on legacy `37ff585` / `2a8dd99`) **looked good in short 50s static indoor captures, but regresses badly under real sustained camera motion** compared to clean upstream `8050243` (`v2026.12.02.01`): | Build (3-min fast camera spin, ~4.9k draws/f) | 5s FPS (med / avg / max) | `frame_ms` (med / max) | `>100 ms` freezes | `TextureQueue` (`due` / `oldest`) | Visual verdict | |---|---:|---:|---:|---:|---| | Legacy `01..12` stack (`2a8dd99` + `PASS_4MS_H0`) | `20.30 / 18.99 / 26.30` | `49.3 / 1031.1 ms` | `2` | `due=3,955 / oldest=62f` | Pop-in & object flicker (`406`) | | **Clean upstream `8050243` (defaults + Agility SDK)** | **`22.30 / 22.53 / 32.40`** | **`44.9 / 68.3 ms`** | **`0`** | **`due=0 / oldest=0f`** | Much cleaner, residual 1f flips only | | `8050243` + `WC_BAR_NO_CPU_READ=1` (reverted) | `21.80 / 21.65 / 27.60` | `45.9 / 282.2 ms` | `1` | `due=0` | **Dark surface/face blotches** (despite `copyback 19.0 -> 9.3 ms`) | | `8050243` + `DARNER_HEAP_HOOKS=1` (vs `20.30` spin base) | `18.20 / 17.85 / 23.90` | `55.1 / 310.9 ms` | `2` | `due=0` | `-2.10 FPS` regression | | `8050243` + `HEAP_HOOKS=1 + SUBMIT_SPLIT=0 + PRESENT_SENT=1` | `18.85 / 18.47 / 24.50` | `53.0 / 148.1 ms` | `1` | `due=0` | `-1.45 FPS` regression, residual flips unchanged | **Key post-mortem takeaways (all logged in our Dead-End Ledger Gist):** - `PASS_4MS_H0` (`TEXSPK_PASS_MS=4 + HURRY_PASSES=0`) starves the texture upload queue under camera movement (`due` grows to thousands, causing late pop-in). - `WC_BAR_NO_CPU_READ=1` halves async `copyback` (`19.0 -> 9.3 ms`), **but** `relay` runs off the critical path (zero FPS gain) while skipping `< 1 MiB` write-backs corrupts aliased/placed surface data (visible blotches). - Always ship Agility SDK `D3D12\D3D12Core.dll` beside any rebuilt runtime binary; falling back to `SYSTEM32\D3D12Core.dll` silently disables `GPU_UPLOAD` / ReBAR / `HEAP_TWIN` and causes GPU hangs. - The patches Gist (`01..12`) has been clearly marked **`DEPRECATED — ANALYSIS ONLY / DO NOT APPLY IN-GAME`**. #### 2. High performance, timely asset streaming, and zero frame-flipping in the sibling D3D12 translation tree (`b417632`) In parallel, we built and tested the active sibling D3D12 translation tree (commit `b417632`, clean default configuration + warmed shader/pipeline cache) on the exact same 8-core + RTX 5080 host, and the difference in **real-world playability, visual stability, and throughput** is dramatic: - **Zero frame flipping & stutter-free pacing** in live gameplay. - **Textures and geometry/models stream in on time** without delayed pop-in or queue starvation. - Code audit of why that architecture works so well right now points to the combination of: 1. **Synchronous presentation & submission ordering** (`SUBMIT_SENDER=1` + `SHOW_AFTER=1` + `UPLOAD_AHEAD=1`, avoiding `SUBMIT_SPLIT=2` submission races and upload queue caps). 2. **Descriptor & heap fast paths** (`PORT_DESCRIPTORS=1`, `INDEX_HEAP_SPANS=1`, `PORT_JOURNAL=1`) paired with **`ALIAS_DIRECT=1`** texture mapping. 3. **Wave32 compute pairing & NaN scrubbing** (`PAIRED_FOR` across 45 key lighting/temporal/shadow/defrag compute shaders + `NAN_SCRUB=1`). 4. **Pipeline compilation discipline** (`PIPELINE_WAIT_MS=10000` instead of silently dropping model draws when a PSO is not yet cached). We are updating our benchmark & analysis priority to focus on that higher-performing D3D12 architecture going forward, and keeping the older `01..12` patch Gist strictly as a cautionary negative-result archive alongside the updated Dead-End Ledger: - Dead-End Ledger & Scientific Toolkit (MIT-0): https://gist.github.com/procotos-art/e0e1b3a1be41d3648045189cf5c08a6c - Archived `01..12` Patch Pack (**Analysis Only — Do NOT Apply**): https://gist.github.com/procotos-art/6e1d42c88281148cb0f75a2be716fb82
procotos-art commented 2026-12-03 12:19:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by procotos-art on 2026-12-03T12:19:26Z.


Offline Pipeline Precompiler Optimization (warm.rs + pipeline/known.rs) — 3.88x Faster, -50% RAM (Opt-In Patch)

Following up with a verified, opt-in optimization for offline full-cache pipeline precompilation (warm / preload --all), which previously crawled at ~18–29 pipelines/s (~55–60 min for ~88.6k PSOs) on 8C/16T x86-64 + 16 GB ReBAR GPU.

Root Cause (Measured on known-pipelines.bin)

  • Across 88,677 pipelines, there are only 15,067 unique shader combinations (5.89x duplication) and 19,108 unique individual shaders.
  • Upstream warm spawns 10–14 single-threaded child processes with AT_ONCE = 40, IDLE_PRIORITY_CLASS, and random pipeline-key sorting (~2,200 cold process spawns per full run). Every 40 pipelines destroys the in-process translated shader cache (static SHADERS) and driver in-process compiled-stage cache, while scattering graphics-state variants of the same heavy pixel/compute shader across separate processes.

Mechanism (Default OFF = 100% Byte-Identical Upstream Behavior)

All new behavior is opt-in via environment variables (DARNER_WARM_JOBS, DARNER_WARM_THREADS, DARNER_WARM_BATCH, DARNER_WARM_PRIORITY, DARNER_WARM_SORT, DARNER_WARM_ADAPTIVE, DARNER_WARM_MIN_FREE_MB):

  1. known::make_parallel (1 child process x N worker threads): Shares one ID3D12Device, shader index, static SHADERS cache, and driver cache handle — halving peak RAM and removing cross-process DXCache contention.
  2. Primary-shader BLAKE3 sort + capped (<= 16) combo group-stealing (DARNER_WARM_SORT=shader): Leads each sort key with the last shader's 32-byte BLAKE3 hash (pixel shader for graphics, compute shader for compute) + combo bytes — keeping stage distribution uniform across slices while executing state variants of the same shader back-to-back on the same thread (variant #1 compiles, variants #2..N hit in ~0.1 ms).
  3. Dynamic CPU/RAM adaptive throttling (DARNER_WARM_ADAPTIVE=1): Every 2 s reads Win32 GetSystemTimes - GetProcessTimes and GlobalMemoryStatusEx to yield worker slots automatically when external apps use CPU, and cleanly recycles batches early if free RAM drops below DARNER_WARM_MIN_FREE_MB (default 3584 MB).
  4. Single-pass Stage 3 fill_library: Replaces N separate known::make calls (up to 12.96 GB RAM + static .step_by stragglers) with one shared known::make_parallel pass + shader_sort.
  5. Exact crash isolation & @file handoff: If a multi-threaded child crashes or hangs, only uncompleted items in that chunk are retried single-threaded (threads = 1). Lists > 400 indices pass via a temporary @file.

Bracketed Paired A-B-C-A Silicon Results (Ryzen 7 5700X + RTX 5080, 2,000 uncached PSOs/case, 0 refused, 0 crashed)

Case Wall (2,000 PSOs) Throughput Speedup Median P90 Sum Compile Peak RAM Procs
A1_BASE (14x1, b=40, idle, key) 73.95 s 27.04/s 1.00x 23.3 ms 1194.7 ms 782 s 6,615 MB 15
A2_BASE (14x1, b=40, idle, key) 62.94 s 31.78/s 1.00x 6.0 ms 1197.8 ms 750 s 6,914 MB 15
BASE Mean (A1, A2) 68.45 s 29.22/s 1.00x 14.7 ms 1196.3 ms 766 s 6,765 MB 15
F1 (1x16, b=2000, norm, key) 36.92 s 54.17/s 1.85x 1.3 ms 738.7 ms 506 s (-34%) 3,368 MB (-50%) 2
G1 / G2 (1x16, b=2000, norm, ps-hash) 17.66 s mean 113.25/s 3.88x (+288%) 0.1 ms 62.3 ms 236 s (-69%) 3,392 MB (-50%) 2

Thread-Scaling Follow-Up (1x8 Physical Cores vs 1x12 vs 1x16 SMT, sort=shader, 2,000 PSOs/case)

  • T16_A / T16_B (1x16 SMT): 28.99 s / 21.74 s (mean 25.37 s = 78.8/s), p90 42.3 ms, sum 327 s, RAM 3,916 MB
  • T08 (1x8 physical cores only): 23.38 s (85.53/s), p90 16.7 ms, sum 166 s, RAM 3,426 MB, leaving 50% CPU headroom!
  • T12 (1x12): 29.94 s (66.81/s), p90 206.8 ms, sum 314 s, RAM 3,847 MB
  • Takeaway: The driver compiler saturates L3/EU at 1 thread per physical core (Sum doubled 166 s -> 327 s = 1.97x at 16 threads for zero wall-clock gain). Defaulting to 1xPhysCores + DARNER_WARM_ADAPTIVE=1 + adaptive WARM_BATCH=10000 is both faster and keeps the desktop responsive.

Dead ends also logged (so others skip them):

  • Multi-process batch bump alone (14x1, b=80, normal, key): DROP (27.89/s vs 28.45/s baseline, same 6.06 GB RAM — tail imbalance + 14-way DXCache contention).

  • Stage-prefix sort ((stage_0, hash_0)): DROP (front-loads VS-only pipelines and piles heavy compute shaders at the tail; leading with last-shader BLAKE3 hash fixes this cleanly).

  • GraphicsState "don't care" field canonicalization (known-pipelines.bin binary audit): DROP (0.00% — across all 88,569 real PSOs and all 6 D3D12 don't-care rules, only 4 PSOs deduplicated: 88,569 -> 88,565; the title engine already canonicalizes unused fields).

  • Clean-Room Patch Gist (e6245bf, 17/17 tests pass, 0 warnings, MIT-0): https://gist.github.com/procotos-art/84611bdb2fc6dada51a6b34932f61202

  • One-Click Smart Cache Warmer (12_tool_smart_cache_warmer.ps1 with SHA-256 skip-stamp + live cache size + 13_Warm_Cache_Fast_Used.bat + 14_Warm_Cache_Full_ALL.bat) & Dead-End Ledger Gist: https://gist.github.com/procotos-art/e0e1b3a1be41d3648045189cf5c08a6c
    (Drop the .ps1 and .bat files into any folder and double-click — auto-discovers runtime binary, existing cache folder with zero duplication, title folder, and live CPU/RAM/VRAM limits, and automatically activates the 3.88x flags on patched builds while remaining 100% compatible with stock builds.)

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7378018436 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/413#issuecomment-7378018436). Originally posted by [procotos-art](https://github.com/procotos-art) on 2026-12-03T12:19:26Z. --- ### Offline Pipeline Precompiler Optimization (`warm.rs` + `pipeline/known.rs`) — `3.88x` Faster, `-50%` RAM (Opt-In Patch) Following up with a verified, opt-in optimization for offline full-cache pipeline precompilation (`warm` / `preload --all`), which previously crawled at `~18–29 pipelines/s` (~55–60 min for ~88.6k PSOs) on 8C/16T x86-64 + 16 GB ReBAR GPU. #### Root Cause (Measured on `known-pipelines.bin`) - Across **`88,677` pipelines**, there are only **`15,067` unique shader combinations (`5.89x` duplication)** and `19,108` unique individual shaders. - Upstream `warm` spawns 10–14 single-threaded child processes with `AT_ONCE = 40`, `IDLE_PRIORITY_CLASS`, and random pipeline-key sorting (~2,200 cold process spawns per full run). Every 40 pipelines destroys the in-process translated shader cache (`static SHADERS`) and driver in-process compiled-stage cache, while scattering graphics-state variants of the same heavy pixel/compute shader across separate processes. #### Mechanism (Default OFF = 100% Byte-Identical Upstream Behavior) All new behavior is opt-in via environment variables (`DARNER_WARM_JOBS`, `DARNER_WARM_THREADS`, `DARNER_WARM_BATCH`, `DARNER_WARM_PRIORITY`, `DARNER_WARM_SORT`, `DARNER_WARM_ADAPTIVE`, `DARNER_WARM_MIN_FREE_MB`): 1. **`known::make_parallel` (`1` child process x `N` worker threads):** Shares one `ID3D12Device`, shader index, `static SHADERS` cache, and driver cache handle — halving peak RAM and removing cross-process DXCache contention. 2. **Primary-shader BLAKE3 sort + capped (`<= 16`) combo group-stealing (`DARNER_WARM_SORT=shader`):** Leads each sort key with the **last shader's 32-byte BLAKE3 hash** (pixel shader for graphics, compute shader for compute) + combo bytes — keeping stage distribution uniform across slices while executing state variants of the same shader back-to-back on the same thread (variant #1 compiles, variants #2..N hit in ~0.1 ms). 3. **Dynamic CPU/RAM adaptive throttling (`DARNER_WARM_ADAPTIVE=1`):** Every 2 s reads Win32 `GetSystemTimes - GetProcessTimes` and `GlobalMemoryStatusEx` to yield worker slots automatically when external apps use CPU, and cleanly recycles batches early if free RAM drops below `DARNER_WARM_MIN_FREE_MB` (default `3584 MB`). 4. **Single-pass Stage 3 `fill_library`:** Replaces `N` separate `known::make` calls (up to `12.96 GB` RAM + static `.step_by` stragglers) with one shared `known::make_parallel` pass + `shader_sort`. 5. **Exact crash isolation & `@file` handoff:** If a multi-threaded child crashes or hangs, only uncompleted items in that chunk are retried single-threaded (`threads = 1`). Lists `> 400` indices pass via a temporary `@file`. #### Bracketed Paired A-B-C-A Silicon Results (Ryzen 7 5700X + RTX 5080, 2,000 uncached PSOs/case, `0` refused, `0` crashed) | Case | Wall (2,000 PSOs) | Throughput | Speedup | Median | P90 | Sum Compile | Peak RAM | Procs | |---|---:|---:|---:|---:|---:|---:|---:|---:| | `A1_BASE` (`14x1, b=40, idle, key`) | `73.95 s` | `27.04/s` | `1.00x` | `23.3 ms` | `1194.7 ms` | `782 s` | `6,615 MB` | `15` | | `A2_BASE` (`14x1, b=40, idle, key`) | `62.94 s` | `31.78/s` | `1.00x` | `6.0 ms` | `1197.8 ms` | `750 s` | `6,914 MB` | `15` | | **BASE Mean (`A1, A2`)** | **`68.45 s`** | **`29.22/s`** | **`1.00x`** | `14.7 ms` | `1196.3 ms` | **`766 s`** | **`6,765 MB`** | **`15`** | | `F1` (`1x16, b=2000, norm, key`) | `36.92 s` | `54.17/s` | **`1.85x`** | `1.3 ms` | `738.7 ms` | `506 s` (-34%) | `3,368 MB` (-50%) | `2` | | **`G1` / `G2` (`1x16, b=2000, norm, ps-hash`)** | **`17.66 s` mean** | **`113.25/s`** | **`3.88x` (+288%)** | **`0.1 ms`** | **`62.3 ms`** | **`236 s` (-69%)** | **`3,392 MB` (-50%)** | **`2`** | #### Thread-Scaling Follow-Up (`1x8` Physical Cores vs `1x12` vs `1x16` SMT, `sort=shader`, 2,000 PSOs/case) - `T16_A` / `T16_B` (`1x16` SMT): `28.99 s / 21.74 s` (mean **`25.37 s` = `78.8/s`**), `p90 42.3 ms`, `sum 327 s`, `RAM 3,916 MB` - **`T08` (`1x8` physical cores only):** **`23.38 s` (`85.53/s`)**, **`p90 16.7 ms`**, **`sum 166 s`**, **`RAM 3,426 MB`**, leaving **50% CPU headroom**! - `T12` (`1x12`): `29.94 s` (`66.81/s`), `p90 206.8 ms`, `sum 314 s`, `RAM 3,847 MB` - **Takeaway:** The driver compiler saturates L3/EU at **1 thread per physical core** (`Sum` doubled `166 s -> 327 s` = `1.97x` at 16 threads for zero wall-clock gain). Defaulting to `1xPhysCores` + `DARNER_WARM_ADAPTIVE=1` + adaptive `WARM_BATCH=10000` is both faster and keeps the desktop responsive. Dead ends also logged (so others skip them): - Multi-process batch bump alone (`14x1, b=80, normal, key`): `DROP` (`27.89/s` vs `28.45/s` baseline, same `6.06 GB` RAM — tail imbalance + 14-way DXCache contention). - Stage-prefix sort (`(stage_0, hash_0)`): `DROP` (front-loads VS-only pipelines and piles heavy compute shaders at the tail; leading with last-shader BLAKE3 hash fixes this cleanly). - `GraphicsState` "don't care" field canonicalization (`known-pipelines.bin` binary audit): `DROP` (`0.00%` — across all `88,569` real PSOs and all 6 D3D12 don't-care rules, only `4` PSOs deduplicated: `88,569 -> 88,565`; the title engine already canonicalizes unused fields). - **Clean-Room Patch Gist (`e6245bf`, `17/17` tests pass, 0 warnings, MIT-0):** https://gist.github.com/procotos-art/84611bdb2fc6dada51a6b34932f61202 - **One-Click Smart Cache Warmer (`12_tool_smart_cache_warmer.ps1` with SHA-256 skip-stamp + live cache size + `13_Warm_Cache_Fast_Used.bat` + `14_Warm_Cache_Full_ALL.bat`) & Dead-End Ledger Gist:** https://gist.github.com/procotos-art/e0e1b3a1be41d3648045189cf5c08a6c *(Drop the `.ps1` and `.bat` files into any folder and double-click — auto-discovers runtime binary, existing cache folder with zero duplication, title folder, and live CPU/RAM/VRAM limits, and automatically activates the `3.88x` flags on patched builds while remaining 100% compatible with stock builds.)*
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
readmet3xt-lab/foxhound#413
No description provided.