perf: read the clock only for submission steps whose time is summed #279
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/279"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LooperSalty/AnyXboxX. Originally posted by Skyfrye on 2026-11-26T00:13:06Z.
Draft: the in-game A/B is pending (the change and its test are done; a measured run of the world with and without it is not).
Change
HostList::run_deferred(crates/victory-gpu/src/host.rs) read the clock (Instant::now) before every submission-time step of every list. Only two kinds of step use that time:Step::Copy,Step::Fill), summed intoPREPARING[0]for the frame line;diagnostics, the title's work run at submission (Step::Run,Step::Host), summed intoRunUs.The others (
Refresh,GpuWrite,Texture) only note what to do andcontinuebefore the time is used; they are most of a submission's steps. The clock is now read only for the first two (timed), andmicros_sincegives 0 where it was not read.Where this comes from: a 30 s Nsight Systems capture of the world (release build of
mainat3e258c8, launcher fast set, 263 frames). On the title's submitting thread, which spends 48 % of the time on the CPU inqueue::execute, the innermost engine frame wasInstant::nowcalled fromHost::submit(whererun_deferredis inlined) on 2.8 % of the timer samples, andInstant::elapsedon 0.2 %. OneQueryPerformanceCountercall measured 19 ns on this machine, so that is on the order of a million clock reads a second.The frame line's sums do not change: the steps that were summed still are, with the same start and end.
Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), on upstream
mainat578098b, fromthird_party/victory:The 3 failures are the same on
mainwithout this change (183 passed, 3 failed):descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others.New test
only_summed_steps_read_the_clock: the copies are timed, the title's work only with diagnostics, and an unread clock counts 0 µs. (Refresh,GpuWriteandTextureneed host objects made on a device; they take thefalsearm of the samematch.) Without this change the test does not build, sincetimedandmicros_sinceare new.Pending: an A/B in the world (frame time; the submitting thread's share in
Instant::nowin a profile).Oracle and test data
No game file. The profile numbers come from my own capture of my copy of the game; no game code, address or dump is in this PR.
Checklist
E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: written with Claude Code. Claude Opus 5.5 read the Nsight Systems capture, wrote the change and its test, and wrote this description.
🤖 Generated with Claude Code
Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-26T10:32:24Z.
Test report for #279 on three adapters.
Merges cleanly onto current main. Setup: current
origin/main(c4c93bd) merged with this PR, Windows 11,cargo test --lockedinthird_party/victory. Adapters: RTX 4060 Laptop (DXGI 0), Intel UHD 8086:a78b (16-lane waves, no FP64), WARP. The hardware adapter is picked by name through a local, uncommitted test hook and confirmed in its log; WARP for victory-gpu is--features diagnostics+VICTORY_D3D12_WARP=1. victory-gpu runs with--test-threads=1.victory-gpu --lib"main's 3" =
descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others. They fail on all three adapters on main too.only_summed_steps_read_the_clockpasses everywhere, both without and withdiagnostics(WARP build). No new failure.Note:
timedmatches everyStepvariant explicitly, so a new variant forces a decision. That's good. (#254 changesStep::Texture(_)to two fields, so whichever merges second needsStep::Texture(..)here.)AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.
Imported from LooperSalty/AnyXboxX. Originally posted by Skyfrye on 2026-11-26T13:06:05Z.
Rebased on
main(8ed1109), plus one commit,bf7196b. It covers the timing of the same steps:The test
only_summed_steps_read_the_clockcoversFillTimer(cargo test --locked -p victory-gpu --lib only_summed_steps_read_the_clock-> 1 passed). The release build has no new warning. It was in the stacked game run described in #360: picture correct, no exception.The fill timing comes from Antigravity (gemini-4-neon-medium), commit 22d77e4 of a local branch, ported by Claude Opus 5.5. A run of fills here also ends at a shader-write or texture step, because those do refresh work that is timed elsewhere.
🤖 Generated with Claude Code
Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T15:39:54Z.
Closing as stale: this draft has been inactive for more than 24 hours and no longer applies cleanly to main (merge conflicts). Feel free to reopen after a rebase on current main and a fresh measurement of the clock-read change.
Pull request closed