Outdoors, refresh threads spend ~48 ms/frame waiting on the GUARDS mutex (watch::guard / publish) #8

Open
opened 2026-11-30 02:23:04 +00:00 by github-bot · 6 comments
Owner

@⁠Elsupremo20 on GitHub · 2026-11-27 14:36 UTC · original

Build: trustno1-coder/VIctory-NVIDIA at 959dcaf (foxhound base), built from source, release.
Machine: i7-13700K, RTX 4070 12 GB, 32 GB RAM, Windows 11. play-nvidia.ps1 -Dlss off -SeriesS (Series S, 1080p).
Where: prologue heist, outdoors on foot and on a bike. ~10–11 fps, ~90 ms/frame, ~70 ms "preparing", 6000–9000 draws/frame. The prison holds 15–19 fps.

What I measured

I added rdtsc phase marks (VICTORY_THIN_PROFILE=1, logged once per second next to the thin translator line) around refresh_front, shadow::update_free, watch::writes, watch::guard and the journal noting. The figures below are the sum over all refresh threads per frame (thread time, not wall time), averaged over 206 one-second samples from the outdoor stretch:

phase calls/frame ms/frame
refresh thread: update 1104 116.0
└ update_free: watch::writes 1041 93.4
  └ writes: guard (protections) 326 66.9
    guard: waiting for GUARDS (first lock) 326 41.9
    guard: waiting for GUARDS (second lock) 326 6.2
    guard: work under the second lock 326 16.2
  └ writes: noting in the journal + publish 360 33.7
    noting: journal write lock + noting pages 326 4.2
  └ writes: GetWriteWatch 622 1.5
└ update_free: copy_stale (the copying itself) 1041 22.9
refresh_front: wide_each (wall) 16 30.0

So in watch::writes most of the time is waiting for the global GUARDS mutex rather than doing work:

  • guard waits ~48 ms/frame for the lock against ~16 ms of work under it (the work is mostly VirtualProtect plus settle).
  • Most of the ~29 ms left in "noting + publish" (outside the journal lock) is the publish step taking GUARDS again.

GetWriteWatch and the copying are cheap by comparison.

Why it seems to happen

The refresh threads queue up behind each other on the exclusive GUARDS lock, each holding it for VirtualProtect and settle. Title faults already avoid the lock (VICTORY_FAULT_UNLOCKED / settle), so the contention is between the refresh threads themselves.

Prior art

Belobug's "renderer port 6" (VICTORY_PORT_GUARD, Belobug/VIctory-Belobug-AMD commit 9d723e8 and the five after it) attacks the same contention:

  • GUARDS becomes an RwLock, taken shared on the common path.
  • The guarded blocks become atomic bits with per-block claims, so threads protecting different blocks don't serialise.
  • VirtualProtect runs while holding only the claim.

I tried to port it onto foxhound's watch.rs (34 of 50 hunks applied cleanly). I stopped because it collides with foxhound's own unlocked-fault/settle design and the opened/hot and ALIASED tracking, and I didn't want to risk missed writes. Someone who knows that design could probably take the idea (shared lock plus per-block claims, VirtualProtect outside the exclusive section) more safely.

Happy to share the profiler patch (one small prof.rs plus marks) or run a test build.

**@⁠Elsupremo20** on GitHub · 2026-11-27 14:36 UTC · [original](https://github.com/readmet3xt-lab/foxhound/issues/8) **Build:** trustno1-coder/VIctory-NVIDIA at 959dcaf (foxhound base), built from source, release. **Machine:** i7-13700K, RTX 4070 12 GB, 32 GB RAM, Windows 11. `play-nvidia.ps1 -Dlss off -SeriesS` (Series S, 1080p). **Where:** prologue heist, outdoors on foot and on a bike. ~10–11 fps, ~90 ms/frame, ~70 ms "preparing", 6000–9000 draws/frame. The prison holds 15–19 fps. ## What I measured I added rdtsc phase marks (`VICTORY_THIN_PROFILE=1`, logged once per second next to the thin translator line) around `refresh_front`, `shadow::update_free`, `watch::writes`, `watch::guard` and the journal noting. The figures below are the sum over all refresh threads per frame (thread time, not wall time), averaged over 206 one-second samples from the outdoor stretch: | phase | calls/frame | ms/frame | |---|---:|---:| | refresh thread: update | 1104 | 116.0 | | └ update_free: watch::writes | 1041 | 93.4 | |   └ writes: guard (protections) | 326 | 66.9 | |     guard: waiting for GUARDS (first lock) | 326 | **41.9** | |     guard: waiting for GUARDS (second lock) | 326 | **6.2** | |     guard: work under the second lock | 326 | 16.2 | |   └ writes: noting in the journal + publish | 360 | 33.7 | |     noting: journal write lock + noting pages | 326 | 4.2 | |   └ writes: GetWriteWatch | 622 | 1.5 | | └ update_free: copy_stale (the copying itself) | 1041 | 22.9 | | refresh_front: wide_each (wall) | 16 | 30.0 | So in `watch::writes` most of the time is waiting for the global `GUARDS` mutex rather than doing work: - `guard` waits ~48 ms/frame for the lock against ~16 ms of work under it (the work is mostly `VirtualProtect` plus `settle`). - Most of the ~29 ms left in "noting + publish" (outside the journal lock) is the publish step taking `GUARDS` again. `GetWriteWatch` and the copying are cheap by comparison. ## Why it seems to happen The refresh threads queue up behind each other on the exclusive `GUARDS` lock, each holding it for `VirtualProtect` and `settle`. Title faults already avoid the lock (`VICTORY_FAULT_UNLOCKED` / `settle`), so the contention is between the refresh threads themselves. ## Prior art Belobug's "renderer port 6" (`VICTORY_PORT_GUARD`, Belobug/VIctory-Belobug-AMD commit 9d723e8 and the five after it) attacks the same contention: - `GUARDS` becomes an `RwLock`, taken shared on the common path. - The guarded blocks become atomic bits with per-block claims, so threads protecting different blocks don't serialise. - `VirtualProtect` runs while holding only the claim. I tried to port it onto foxhound's `watch.rs` (34 of 50 hunks applied cleanly). I stopped because it collides with foxhound's own unlocked-fault/`settle` design and the `opened`/hot and `ALIASED` tracking, and I didn't want to risk missed writes. Someone who knows that design could probably take the idea (shared lock plus per-block claims, `VirtualProtect` outside the exclusive section) more safely. Happy to share the profiler patch (one small `prof.rs` plus marks) or run a test build.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 02:23:04 +00:00
Author
Owner

@⁠readmet3xt-lab on GitHub · 2026-11-28 10:58 UTC · original

v0.2.0-pre.5 (https://github.com/readmet3xt-lab/foxhound/releases/tag/v0.2.0-pre.5) turns VICTORY_FAULT_UNLOCKED=1 on by default, so the game's write faults no longer take the guards' lock. On our test PC that cut the waits on the lock from 36 to 10 ms a frame (all threads together), and frame time by 2 to 3 %. Moving the protection changes themselves outside the lock is not done: in our scenes it would save little, and it risks lost writes. A measurement outdoors with pre.5 would show whether the refresh threads still wait long there.

**@⁠readmet3xt-lab** on GitHub · 2026-11-28 10:58 UTC · [original](https://github.com/readmet3xt-lab/foxhound/issues/8#issuecomment-7238243143) v0.2.0-pre.5 (https://github.com/readmet3xt-lab/foxhound/releases/tag/v0.2.0-pre.5) turns `VICTORY_FAULT_UNLOCKED=1` on by default, so the game's write faults no longer take the guards' lock. On our test PC that cut the waits on the lock from 36 to 10 ms a frame (all threads together), and frame time by 2 to 3 %. Moving the protection changes themselves outside the lock is not done: in our scenes it would save little, and it risks lost writes. A measurement outdoors with pre.5 would show whether the refresh threads still wait long there.
Author
Owner

@⁠Elsupremo20 on GitHub · 2026-11-28 17:13 UTC · original

Thanks for the reply. Here is the outdoor measurement you asked for.

Setup: trustno1-coder/VIctory-NVIDIA main at 63b902f (foxhound base), release build, i7-13700K, RTX 4070 12 GB, Series S, DLSS Quality, frame generation x2. Main street of the open world, about 2 minutes each, same spot. Run A and run B were played back to back and differ only in VICTORY_FAULT_UNLOCKED. Both had VICTORY_THIN_PROFILE=1, the same phase marks as in the first post. Both also had a local change of ours that reads the guards' clean/absent/held notes from atomic bit mirrors without the lock in guard's first look and in publish (VICTORY_GUARD_PEEK=1). That is why the first lock wait reads 0.

per frame (all refresh threads) A: FAULT_UNLOCKED=1 B: unset
fps (real frames) 14.3 13.2
ms/frame 71.2 76.2
preparing 52.0 ms 55.6 ms
submitting thread, in its submissions 61.3 ms 68.0 ms
draws/frame (mean) 6,019 6,657
guard: waiting for the guards' lock 47.2 ms (234 calls) 65.9 ms (290 calls)
guard: work under the lock 11.7 ms 15.1 ms
refresh threads, update 72.5 ms 95.7 ms
refresh_front wide (wall) 16.6 ms 19.3 ms

Turning faults unlocked gives about 7 % shorter frames outdoors here. The wait in guard drops by about 28 %, and per call from 0.23 to 0.20 ms. The spot had slightly fewer draws in A, so part of the gap may be the scene. Even so, the refresh threads still wait about 47 ms a frame in total, so outdoors the lock is still the largest single item in watch::writes. We keep VICTORY_FAULT_UNLOCKED=1 on.

**@⁠Elsupremo20** on GitHub · 2026-11-28 17:13 UTC · [original](https://github.com/readmet3xt-lab/foxhound/issues/8#issuecomment-7242848802) Thanks for the reply. Here is the outdoor measurement you asked for. **Setup:** trustno1-coder/VIctory-NVIDIA main at 63b902f (foxhound base), release build, i7-13700K, RTX 4070 12 GB, Series S, DLSS Quality, frame generation x2. Main street of the open world, about 2 minutes each, same spot. Run A and run B were played back to back and differ only in `VICTORY_FAULT_UNLOCKED`. Both had `VICTORY_THIN_PROFILE=1`, the same phase marks as in the first post. Both also had a local change of ours that reads the guards' clean/absent/held notes from atomic bit mirrors without the lock in `guard`'s first look and in `publish` (`VICTORY_GUARD_PEEK=1`). That is why the first lock wait reads 0. | per frame (all refresh threads) | A: `FAULT_UNLOCKED=1` | B: unset | |---|---:|---:| | fps (real frames) | **14.3** | 13.2 | | ms/frame | **71.2** | 76.2 | | preparing | 52.0 ms | 55.6 ms | | submitting thread, in its submissions | 61.3 ms | 68.0 ms | | draws/frame (mean) | 6,019 | 6,657 | | `guard`: waiting for the guards' lock | **47.2 ms** (234 calls) | 65.9 ms (290 calls) | | `guard`: work under the lock | 11.7 ms | 15.1 ms | | refresh threads, `update` | 72.5 ms | 95.7 ms | | `refresh_front` wide (wall) | 16.6 ms | 19.3 ms | Turning faults unlocked gives about 7 % shorter frames outdoors here. The wait in `guard` drops by about 28 %, and per call from 0.23 to 0.20 ms. The spot had slightly fewer draws in A, so part of the gap may be the scene. Even so, the refresh threads still wait about 47 ms a frame in total, so outdoors the lock is still the largest single item in `watch::writes`. We keep `VICTORY_FAULT_UNLOCKED=1` on.
Author
Owner

@⁠readmet3xt-lab on GitHub · 2026-11-29 06:15 UTC · original

Thanks for the A/B, that is the measurement I asked for. VICTORY_FAULT_UNLOCKED=1 is on by default since pre.5, so your 7 % is what everyone gets now.

v0.8 also has two lock changes ported from VIctory-NVIDIA: a write-watch query now holds only its own pages instead of all memory (VICTORY_ASK_HOLD_ALL=1 restores the old way), and the check for pending card writes no longer takes the lock. Those should cut part of the 47 ms you still see in guard outdoors, but I haven't measured outdoors on a 4070 myself.

Your VICTORY_GUARD_PEEK=1 (the clean, absent and held notes read from atomic bit mirrors in guard's first look and in publish) sounds like the next step. If you open it as a PR against foxhound, with the same before/after table, I'll review and measure it here.

**@⁠readmet3xt-lab** on GitHub · 2026-11-29 06:15 UTC · [original](https://github.com/readmet3xt-lab/foxhound/issues/8#issuecomment-7251739683) Thanks for the A/B, that is the measurement I asked for. `VICTORY_FAULT_UNLOCKED=1` is on by default since pre.5, so your 7 % is what everyone gets now. v0.8 also has two lock changes ported from VIctory-NVIDIA: a write-watch query now holds only its own pages instead of all memory (`VICTORY_ASK_HOLD_ALL=1` restores the old way), and the check for pending card writes no longer takes the lock. Those should cut part of the 47 ms you still see in `guard` outdoors, but I haven't measured outdoors on a 4070 myself. Your `VICTORY_GUARD_PEEK=1` (the clean, absent and held notes read from atomic bit mirrors in `guard`'s first look and in `publish`) sounds like the next step. If you open it as a PR against foxhound, with the same before/after table, I'll review and measure it here.
Author
Owner

@⁠BEEPITYPORT on GitHub · 2026-12-02 01:41 UTC · original · edited 2026-12-02 01:43 UTC

On the point above that moving protection changes out of the lock "risks lost writes": we tested exactly that with a stress test. It isn't foxhound code; it's a separate VIctory-family tree. The results may help decide how far the per-block idea can go.

Setup. A pagefile section mapped at several addresses. Writer threads store through any of the views, there is a real write-fault handler, and several "askers" seal blocks, copy them and publish them as clean. Lock-free auditors keep checking "a block published clean has a copy equal to memory". Eight rounds per design, RTX 5070 Ti Laptop host, Windows 11.

Design Published clean with a stale copy Blocks stale at rest Rounds that caught it
One lock (today's shape) 0 0 —
Per-block state word: claim bit, the fault retires the state before opening, seal then copy, publish by compare-exchange on a generation 0 0 —
Publish as "set, look again, take back" 9,040 0 8/8
Publish without checking the generation 51 million 512 8/8
No claim 47 million 512 8/8
Copy before sealing (trust the generation alone) 16 million 14 8/8
The fault opens before it retires the state 4.1 million 0 8/8

All four rules turned out to be necessary. One subtle case: a generation bumped by faults does not replace "seal, then copy". A second write to a block that is already open raises no fault, so it bumps nothing.

Scaling on the same machine.

  • The kernel serializes VirtualProtect: about 3.5 million protection changes a second in total, whether 1, 2, 4 or 6 threads protect their own blocks.
  • With four askers, one lock costs each asker 611 ms of every second (133k blocks sealed/s). With per-block claims it costs 3–4 ms (223k blocks sealed/s).
  • So per-block state removes the lock wait, but not the kernel's serialization of the protection changes themselves.

Related numbers, same tree, our diagnostics build.

  • In game, threads waited a median 15.9 ms a frame (p10–p90 3.8–20.6) on the guards' lock, against 6.1 ms of protection changes.
  • In isolation, a write fault that opens all aliases costs 1.8 µs with 1 view, 2.8 µs with 4 and 7.7 µs with 16, unchanged with 120k other views mapped.
  • GetWriteWatch on a section view fails with error 87, so faults are the only tracker for those pages.
  • ReadFile/WriteFile into or from a no-access page fail cleanly (998 / 1784). Routing the I/O through the layer's own view of the section works while the title's view stays sealed.

We have not measured the frame-rate effect of the per-block design in game, so this only shows which orderings keep every write. The test is a self-contained Rust module (GPL-3.0, like the rest of the family). Glad to share it if it would help check VICTORY_GUARD_PEEK or a per-block variant.

**@⁠BEEPITYPORT** on GitHub · 2026-12-02 01:41 UTC · [original](https://github.com/readmet3xt-lab/foxhound/issues/8#issuecomment-7331998664) · edited 2026-12-02 01:43 UTC On the point above that moving protection changes out of the lock "risks lost writes": we tested exactly that with a stress test. It isn't foxhound code; it's a separate VIctory-family tree. The results may help decide how far the per-block idea can go. **Setup.** A pagefile section mapped at several addresses. Writer threads store through any of the views, there is a real write-fault handler, and several "askers" seal blocks, copy them and publish them as clean. Lock-free auditors keep checking "a block published clean has a copy equal to memory". Eight rounds per design, RTX 5070 Ti Laptop host, Windows 11. | Design | Published clean with a stale copy | Blocks stale at rest | Rounds that caught it | |---|---|---|---| | One lock (today's shape) | 0 | 0 | — | | Per-block state word: claim bit, the fault retires the state before opening, seal then copy, publish by compare-exchange on a generation | 0 | 0 | — | | Publish as "set, look again, take back" | 9,040 | 0 | 8/8 | | Publish without checking the generation | 51 million | 512 | 8/8 | | No claim | 47 million | 512 | 8/8 | | Copy before sealing (trust the generation alone) | 16 million | 14 | 8/8 | | The fault opens before it retires the state | 4.1 million | 0 | 8/8 | All four rules turned out to be necessary. One subtle case: a generation bumped by faults does **not** replace "seal, then copy". A second write to a block that is already open raises no fault, so it bumps nothing. **Scaling on the same machine.** - The kernel serializes `VirtualProtect`: about 3.5 million protection changes a second *in total*, whether 1, 2, 4 or 6 threads protect their own blocks. - With four askers, one lock costs each asker 611 ms of every second (133k blocks sealed/s). With per-block claims it costs 3–4 ms (223k blocks sealed/s). - So per-block state removes the lock wait, but not the kernel's serialization of the protection changes themselves. **Related numbers, same tree, our diagnostics build.** - In game, threads waited a median 15.9 ms a frame (p10–p90 3.8–20.6) on the guards' lock, against 6.1 ms of protection changes. - In isolation, a write fault that opens all aliases costs 1.8 µs with 1 view, 2.8 µs with 4 and 7.7 µs with 16, unchanged with 120k other views mapped. - `GetWriteWatch` on a section view fails with error 87, so faults are the only tracker for those pages. - `ReadFile`/`WriteFile` into or from a no-access page fail cleanly (998 / 1784). Routing the I/O through the layer's own view of the section works while the title's view stays sealed. We have not measured the frame-rate effect of the per-block design in game, so this only shows which orderings keep every write. The test is a self-contained Rust module (GPL-3.0, like the rest of the family). Glad to share it if it would help check `VICTORY_GUARD_PEEK` or a per-block variant.
Author
Owner

@⁠Elsupremo20 on GitHub · 2026-12-02 16:24 UTC · original

Thank you, this is very useful, and it lands right on our change.

The publish side of VICTORY_GUARD_PEEK (closed #125) is the "set, look again, take back" row of your table: it set PUBLISHED from atomic mirrors of the clean/held sets and cleared it again if the block was taken or opened meanwhile. Our own stress tests never caught it. They checked that no write is lost at rest, not the window in which a block is published over a write its journal does not hold.

We have reworked it along the lines of your design (not pushed yet, it will come with the new pull request on the current main):

  • a state word per block, with a sealed flag, a published flag and a generation;
  • whoever takes a block's clean note, or opens it (a fault with or without the lock, our own writes, remaps), retires the word before the block can be written;
  • guard seals the blocks it made clean once they are read-only and noted;
  • publish sets the published flag by a compare-exchange on the generation the block was sealed under, and published() reads the words too.

The read-only first look in guard keeps reading bit mirrors, and the protection changes stay serialized by the kernel, as you measured.

To check it we added an auditor test in the spirit of yours: while askers guard, publish and get opened again (faults with and without the lock, our own writes, one and three views), auditors check that no block found published is writable with its word unchanged. With a test-only pause that widens the publishing window, the old ordering is caught within seconds (120 to 164 blocks per run), and the new one passes every round (12 repeated runs, plus the whole victory-gpu suite).

Yes, please share your test module. A gist, a repository or an attachment here all work. We would run it against this variant too, and post the results here and in the pull request, with credit to you.

**@⁠Elsupremo20** on GitHub · 2026-12-02 16:24 UTC · [original](https://github.com/readmet3xt-lab/foxhound/issues/8#issuecomment-7351895691) Thank you, this is very useful, and it lands right on our change. The `publish` side of `VICTORY_GUARD_PEEK` (closed #125) is the "set, look again, take back" row of your table: it set `PUBLISHED` from atomic mirrors of the clean/held sets and cleared it again if the block was taken or opened meanwhile. Our own stress tests never caught it. They checked that no write is lost at rest, not the window in which a block is published over a write its journal does not hold. We have reworked it along the lines of your design (not pushed yet, it will come with the new pull request on the current main): - a state word per block, with a sealed flag, a published flag and a generation; - whoever takes a block's clean note, or opens it (a fault with or without the lock, our own writes, remaps), retires the word before the block can be written; - `guard` seals the blocks it made clean once they are read-only and noted; - `publish` sets the published flag by a compare-exchange on the generation the block was sealed under, and `published()` reads the words too. The read-only first look in `guard` keeps reading bit mirrors, and the protection changes stay serialized by the kernel, as you measured. To check it we added an auditor test in the spirit of yours: while askers guard, publish and get opened again (faults with and without the lock, our own writes, one and three views), auditors check that no block found published is writable with its word unchanged. With a test-only pause that widens the publishing window, the old ordering is caught within seconds (120 to 164 blocks per run), and the new one passes every round (12 repeated runs, plus the whole `victory-gpu` suite). Yes, please share your test module. A gist, a repository or an attachment here all work. We would run it against this variant too, and post the results here and in the pull request, with credit to you.
Author
Owner

@⁠Elsupremo20 on GitHub · 2026-12-02 17:42 UTC · original

Results of the reworked VICTORY_GUARD_PEEK (per-block generation, as described above) on the current main, and why we are not opening the pull request for now.

Setup. foxhound main at 7dbcdcb (v0.8.3) plus the change, release build, i7-13700K, RTX 4070 12 GB, 32 GB RAM, Windows 11, Series S, frame generation x2. No title profile is installed here, so DLSS was off (the title's own upscaling) and the BCPack table file came from VICTORY_BCPACK_TABLES. One run of 41 minutes, mostly in the city, with VICTORY_GUARD_PEEK=ab. Only 5 s lines that lie wholly inside one turn were counted (100 off, 97 on), and lines with frames over 200 ms were left out. The lock waits come from a local counter that is not part of the change.

per frame peek off peek on change
waits for the GUARDS lock 120 99 −18 %
time waiting for the GUARDS lock 31.3 ms 30.8 ms −2 %
fps, median of 5 s lines 12.8 12.5 ≈
preparing, median 47.5 ms 48.5 ms ≈

By draws per frame the frame rate is the same within noise: 4,000–6,000 draws 14.1 vs 13.9 fps, 6,000–8,000 12.6 vs 12.6, 8,000–10,000 11.1 vs 10.9.

So on the current main the safe form gives fewer lock acquisitions but no measurable time or frame rate. Most of what our first measurement saved is gone already: since then faults take no lock, guard_ahead batches a submission's guards, and VICTORY_GUARD_HOT=50 / VICTORY_STORE_BESIDE cut the protection changes. The waits left come mostly from the holders this does not touch, and the generation path costs a little of its own (a seal per block an asking makes clean, a compare-exchange per publish, per-block reads in published()).

What still stands from this work, in case it is useful:

  • the per-block state word, retiring it everywhere a clean or held note is taken or a block is opened, sealing in guard, and publishing by compare-exchange on the sealed generation;
  • an auditor test (no block found published may be writable with its word unchanged) which, with a test-only pause that widens the publishing window, catches the old "set, look again, take back" form within seconds (120–164 blocks per run) and passes with the new one (12 repeated runs, plus the whole victory-gpu suite: 623 passed, clippy clean).

Both are on a local branch. We can push them, or send the test on its own, if either is wanted. Otherwise we leave the switch out, and we would of course still run BEEPITYPORT's module against it if it is shared.

**@⁠Elsupremo20** on GitHub · 2026-12-02 17:42 UTC · [original](https://github.com/readmet3xt-lab/foxhound/issues/8#issuecomment-7353566834) Results of the reworked `VICTORY_GUARD_PEEK` (per-block generation, as described above) on the current main, and why we are not opening the pull request for now. **Setup.** foxhound main at 7dbcdcb (v0.8.3) plus the change, release build, i7-13700K, RTX 4070 12 GB, 32 GB RAM, Windows 11, Series S, frame generation x2. No title profile is installed here, so DLSS was off (the title's own upscaling) and the BCPack table file came from `VICTORY_BCPACK_TABLES`. One run of 41 minutes, mostly in the city, with `VICTORY_GUARD_PEEK=ab`. Only 5 s lines that lie wholly inside one turn were counted (100 off, 97 on), and lines with frames over 200 ms were left out. The lock waits come from a local counter that is not part of the change. | per frame | peek off | peek on | change | |---|---:|---:|---:| | waits for the `GUARDS` lock | 120 | 99 | −18 % | | time waiting for the `GUARDS` lock | 31.3 ms | 30.8 ms | −2 % | | fps, median of 5 s lines | 12.8 | 12.5 | ≈ | | preparing, median | 47.5 ms | 48.5 ms | ≈ | By draws per frame the frame rate is the same within noise: 4,000–6,000 draws 14.1 vs 13.9 fps, 6,000–8,000 12.6 vs 12.6, 8,000–10,000 11.1 vs 10.9. So on the current main the safe form gives fewer lock acquisitions but no measurable time or frame rate. Most of what our first measurement saved is gone already: since then faults take no lock, `guard_ahead` batches a submission's guards, and `VICTORY_GUARD_HOT=50` / `VICTORY_STORE_BESIDE` cut the protection changes. The waits left come mostly from the holders this does not touch, and the generation path costs a little of its own (a seal per block an asking makes clean, a compare-exchange per publish, per-block reads in `published()`). What still stands from this work, in case it is useful: - the per-block state word, retiring it everywhere a clean or held note is taken or a block is opened, sealing in `guard`, and publishing by compare-exchange on the sealed generation; - an auditor test (no block found published may be writable with its word unchanged) which, with a test-only pause that widens the publishing window, catches the old "set, look again, take back" form within seconds (120–164 blocks per run) and passes with the new one (12 repeated runs, plus the whole `victory-gpu` suite: 623 passed, clippy clean). Both are on a local branch. We can push them, or send the test on its own, if either is wanted. Otherwise we leave the switch out, and we would of course still run BEEPITYPORT's module against it if it is shared.
This discussion has been locked. Commenting is limited to contributors.
No description provided.