Skip to content

Title memory by address: per-frame timings on its log line (log only) - #1468

Open
tupacfan04 wants to merge 1 commit into
trustno1-coder:mainfrom
tupacfan04:pr/memory-by-address-timings
Open

tupacfan04 wants to merge 1 commit into
trustno1-coder:mainfrom
tupacfan04:pr/memory-by-address-timings

Conversation

@tupacfan04

@tupacfan04 tupacfan04 commented Nov 28, 2026 •

Copy link
Copy Markdown

What

Log only. The existing title memory by address: line (about every ten seconds) keeps its text and gains a tail with per-frame timings:

; timings per frame: 21.774 ms in ready over 379 calls, of it 3.297 ms waiting for the lock (13.0 waits), 0.371 ms making arenas (0.01 tried), 0.273 ms in bring-ups (149.8), 0.732 ms landing at submissions (145)
  • ready: every call of memory::ready, lock wait included
  • waiting for the lock: the clock is read only when try_lock finds the lock held, then lock() as before
  • making arenas / bring-ups / landing: Memory::another past its once-a-frame refusal, Memory::bring_up, and the deferred closure at submission

Numbers are kept in static atomics and swapped to zero when the line is written. No control flow changes, no new switch. One file, crates/victory-gpu/src/memory.rs (+97 −3).

Why

With ray tracing on, nothing in the log said how much of the submitting thread's frame goes to title memory by address. This line does, so the ray tracing PRs that touch this path (#971, #1062, #1046) can be judged with a number from any tester's log.

Measured

RTX 5070 12 GB (driver 621.40), i9-14900F, 32 GB, Windows 11. Series X, 2560x1440, DLSS Quality (model K), frame generation 2x. Unattended 6-minute runs on one walking route, built from source.

Run fps at 6–8k draws median frame ready per frame lock wait calls
ray tracing off 15.5 64.9 ms 0.1 ms 0.002 ms 15
VICTORY_BVH_BUILDER=1 10.4 85.3 ms 15.6–21.8 ms 3.0–4.1 ms 281–379
VICTORY_BVH_BUILDER=1 (next run) — — 23.6 ms 6.8 ms 298

So on this PC roughly 15–24 ms of the ray tracing frame is spent in memory::ready, and 3–7 ms of that is waiting for the memory lock. The two clock reads per call are not a visible cost at a few hundred calls a frame.

The runs were made on my test branch (main 63b902f plus local off-by-default switches) carrying this same commit; this PR is that commit alone, rebased on main 923e38c.

Tests

  • New: memory::tests::timings_are_taken_once
  • cargo test --release -p victory-gpu --lib on this branch: 551 passed, 0 failed, 43 ignored
  • One earlier run of the suite had watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view fail once; it then passed three times alone and in the next full run. This PR does not touch watch.rs. Plain main 923e38c passed twice (550 passed) in my runs, so I could not reproduce it there.

Checked for overlap

🤖 Generated with Claude Code

…rena growth, bring-ups and lands on its 10 s line (log only)

The "title memory by address: ..." line (memory.rs, every ten seconds or
so) keeps its text as it was and ends with:

  ; timings per frame: {:.3} ms in ready over {:.0} calls, of it {:.3} ms
  waiting for the lock ({:.1} waits), {:.3} ms making arenas ({:.2} tried),
  {:.3} ms in bring-ups ({:.1}), {:.3} ms landing at submissions ({:.0})

All per frame averages over the frames since the last line:
- ready: every call of memory::ready (one per draw/dispatch that reads or
  builds by address), lock wait included;
- the lock wait: the clock is read only when MEMORY.try_lock() finds the
  lock held, then lock() as before (the same guard, poisoning handled as
  before); "waits" counts those calls;
- making arenas: Memory::another past its once-a-frame refusal (the cheap
  early return is not timed);
- bring-ups: Memory::bring_up (the refreshes of the directory and of every
  copy recorded into a list);
- landing: the deferred closure at submission (its own lock wait and
  Memory::land).
Numbers are kept in static atomics and swapped to zero when the line is
written. No control flow changes.

Tests: memory::tests::timings_are_taken_once (a timed call counts once,
taking leaves zeros). cargo test --release -p victory-gpu --lib -- memory
shadow:: watch:: resource:: : 134 passed, 0 failed, 5 ignored.

Measured (RTX 5070 12 GB, i9-14900F, Series X 1440p, VICTORY_BVH_BUILDER=1):
the line reads 15-24 ms per frame in ready over about 280-380 calls, 3-7 ms
of it waiting for the lock; without the builder 0.1 ms over 15 calls. At a
few hundred calls a frame the two clock reads are not a visible cost.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@tupacfan04 tupacfan04 changed the title Title memory by address: per-frame timings on its log line (log only) [pr-diagnostics] [memory] [NVIDIA] [RAYTRACING] Title memory by address: per-frame timings on its log line (log only) Nov 28, 2026
@trustno1-coder trustno1-coder changed the title [pr-diagnostics] [memory] [NVIDIA] [RAYTRACING] Title memory by address: per-frame timings on its log line (log only) Title memory by address: per-frame timings on its log line (log only) Nov 28, 2026
@trustno1-coder trustno1-coder added memory RAM or VRAM use, out of memory, leaks pr-diagnostics Pull request: adds logging, counters or tools labels Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

memory RAM or VRAM use, out of memory, leaks NVIDIA pr-diagnostics Pull request: adds logging, counters or tools RAYTRACING

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants