CPU hot paths: lock-free HostHeap::keep_ref, raw keyboard input, step-vec reuse, guard_ahead, per-pipeline wakeup #7

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

@⁠adib-cyber007 on GitHub · 2026-12-02 08:40 UTC · original
adib-cyber007:pr/3-cpu-hotpaths-and-raw-input → main · +663 −95 · 7 files · 7 commits · open

Ports 6 clean, independent CPU & lock-contention optimizations (GPL-3.0, kept as separate commits so any can be cherry-picked individually):

  1. Lock-free HostHeap::keep / keep_ref (DoubleGhosty/cool_fox 4bf0ab95, fabian-wolf09): Atomic kept_raw fast path skips the slot mutex + COM AddRef/Release when a draw slot already holds the same resource (~0.2 core saved on recording threads). kept_in gated under #[cfg(feature = diagnostics)].
  2. Raw keyboard input (VICTORY_RAW_KEYS) (DoubleGhosty/cool_fox 2263ef84, fabian-wolf09): Replaces 240 GetAsyncKeyState calls every 8 ms (~30,000 syscalls/s, ~0.4 core) with a message-only RIDEV_INPUTSINK window + 256 ms safety reconciliation while preserving mouse polling (VICTORY_RAW_KEYS=0 reverts).
  3. Submission step-vector reuse (DoubleGhosty/cool_fox b2c0275a, fabian-wolf09): Reuses Batch::refresh_ahead touches and card_steps::does_of vectors via thread-local, avoiding ~1 MB NtAllocateVirtualMemory/NtFreeVirtualMemory churn per submission under Windows's address-space lock.
  4. In-place join_ranges dedup (readmet3xt-lab/foxhound c4a74c18, David Valor).
  5. Per-pipeline Completion condvar wakeup (readmet3xt-lab/foxhound effe3e38, JokerAttack): Eliminates global DONE condvar notify_all().
  6. Batched view-memory refresh guards (VICTORY_GUARD_BATCH) (readmet3xt-lab/foxhound 8ecf5ab5, Grein / VIctory-NVIDIA a6567e07): watch::guard_ahead adapted cleanly for this fork's Renderer Port #6 (RwLock) and Port #7 (sharded journal), wired through toggled! for live VICTORY_AB=30,VICTORY_GUARD_BATCH (VICTORY_GUARD_BATCH=0 disables).

Verification

  • watch::many_askers_tests::no_write_to_views_is_lost_with_batched_guards passed across Port #6 off, on, and mixed.
  • pipeline::make::tests (completing_another_pipeline_does_not_notify_this_waiter, pipeline_completion_observes_preexisting_result_and_keeps_timeout), all 27 gameinput tests, and default + --features diagnostics builds passed with zero new warnings.
  • Live FPS needs measurement with start-ab.ps1.
**@⁠adib-cyber007** on GitHub · 2026-12-02 08:40 UTC · [original](https://github.com/ImTaneax/VIctory-RTX3050-4gb/pull/7) `adib-cyber007:pr/3-cpu-hotpaths-and-raw-input` → `main` · +663 −95 · 7 files · 7 commits · open Ports 6 clean, independent CPU & lock-contention optimizations (GPL-3.0, kept as separate commits so any can be cherry-picked individually): 1. **Lock-free `HostHeap::keep` / `keep_ref`** (`DoubleGhosty/cool_fox` `4bf0ab95`, fabian-wolf09): Atomic `kept_raw` fast path skips the slot mutex + COM `AddRef`/`Release` when a draw slot already holds the same resource (~0.2 core saved on recording threads). `kept_in` gated under `#[cfg(feature = diagnostics)]`. 2. **Raw keyboard input (`VICTORY_RAW_KEYS`)** (`DoubleGhosty/cool_fox` `2263ef84`, fabian-wolf09): Replaces 240 `GetAsyncKeyState` calls every 8 ms (~30,000 syscalls/s, ~0.4 core) with a message-only `RIDEV_INPUTSINK` window + 256 ms safety reconciliation while preserving mouse polling (`VICTORY_RAW_KEYS=0` reverts). 3. **Submission step-vector reuse** (`DoubleGhosty/cool_fox` `b2c0275a`, fabian-wolf09): Reuses `Batch::refresh_ahead` `touches` and `card_steps::does_of` vectors via thread-local, avoiding ~1 MB `NtAllocateVirtualMemory`/`NtFreeVirtualMemory` churn per submission under Windows's address-space lock. 4. **In-place `join_ranges` dedup** (`readmet3xt-lab/foxhound` `c4a74c18`, David Valor). 5. **Per-pipeline `Completion` condvar wakeup** (`readmet3xt-lab/foxhound` `effe3e38`, JokerAttack): Eliminates global `DONE` condvar `notify_all()`. 6. **Batched view-memory refresh guards (`VICTORY_GUARD_BATCH`)** (`readmet3xt-lab/foxhound` `8ecf5ab5`, Grein / `VIctory-NVIDIA` `a6567e07`): `watch::guard_ahead` adapted cleanly for this fork's Renderer Port #6 (`RwLock`) and Port #7 (sharded journal), wired through `toggled!` for live `VICTORY_AB=30,VICTORY_GUARD_BATCH` (`VICTORY_GUARD_BATCH=0` disables). ### Verification - `watch::many_askers_tests::no_write_to_views_is_lost_with_batched_guards` passed across Port #6 off, on, and mixed. - `pipeline::make::tests` (`completing_another_pipeline_does_not_notify_this_waiter`, `pipeline_completion_observes_preexisting_result_and_keeps_timeout`), all 27 `gameinput` tests, and default + `--features diagnostics` builds passed with zero new warnings. - Live FPS needs measurement with `start-ab.ps1`.
Port of DoubleGhosty/cool_fox 4bf0ab95 (fabian-wolf09, GPL-3.0). Stores each slot's raw interface pointer in an atomic alongside its lock so keep/keep_ref skip the mutex lock and COM AddRef/Release whenever the slot already holds the same resource.
Port of DoubleGhosty/cool_fox 2263ef84 (fabian-wolf09, GPL-3.0). Replaces 30,000 GetAsyncKeyState syscalls/s (~0.4 CPU core) with a message-only RIDEV_INPUTSINK raw-input window plus 256 ms safety reconciliation. VICTORY_RAW_KEYS=0 reverts.
Port of DoubleGhosty/cool_fox b2c0275a (fabian-wolf09, GPL-3.0). Avoids ~1 MB NtAllocateVirtualMemory/NtFreeVirtualMemory churn on the submit thread under Windows's address-space lock.
Port of readmet3xt-lab/foxhound c4a74c18 (David Valor, GPL-3.0).
Port of readmet3xt-lab/foxhound effe3e38 (JokerAttack, GPL-3.0). Replaces global DONE condvar notify_all with a per-Pending Completion condvar.
Port of readmet3xt-lab/foxhound 8ecf5ab5 (Grein / VIctory-NVIDIA a6567e07, GPL-3.0), adapted for renderer port #6 (shared RwLock guards) and renderer port #7 (sharded journal) and wired through toggled! for live VICTORY_AB testing. Guards all view ranges a submission refreshes in one merged Askings/journal/publish batch. Verified with multi-threaded stress test no_write_to_views_is_lost_with_batched_guards across port #6 off/on/mixed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 08:41:50 +00:00
github-bot changed title from Pr/3 cpu hotpaths and raw input to CPU hot paths: lock-free HostHeap::keep_ref, raw keyboard input, step-vec reuse, guard_ahead, per-pipeline wakeup 2026-12-02 10:22:06 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/7/head:github-bot/gh-7'
git switch 'github-bot/gh-7'

Merge

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