Skip to content

A submission's one asking begun beside its first steps (VICTORY_ASK_FIRST=1, off by default) - #127

Merged
trustno1-coder merged 1 commit into
trustno1-coder:mainfrom
1mosce:ask-first
Nov 28, 2026
Merged

trustno1-coder merged 1 commit into
trustno1-coder:mainfrom
1mosce:ask-first

Conversation

@1mosce

@1mosce 1mosce commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

What

VICTORY_ASK_FIRST=1 (off by default; with VICTORY_ASK_ONCE, and not with upcheck): a submission's one asking of the write watch is begun as soon as the submission has the lock, on a thread kept for it (victory-ask), beside the planning of the steps done on the card and the look at the flights in the air. The submission waits for it where it asked before, and there:

  • if flights were waited for or settled meanwhile (the wait for flights it reads from, the settle for the sweep), the asking is made again, whole, as today: what they landed is title memory written;
  • else only what the asking that stands does not hold is asked (watch::ask_more, which is ask_rest over the same ranges): the ranges of the list of steps done on the card, which is made after the asking was begun;
  • if no asking stands (the first found nothing to hold, or gave up), ask_once as today.

stale_under_flights and settle_stale follow unchanged. A line per frame says how many submissions began their asking first, how many made it again, and how many asked for more.

Without the switch nothing changes, but that the Batch is taken a little earlier in submit.

Why

The asking is the kernel resetting the pages it finds written, on the thread a frame waits for: 4.3 to 5.4 ms a frame in the session of 2026-11-28 (RTX 4070 Laptop 8 GiB, Ryzen 9 8945HS, Series S profile), with 5.8 ms of planning ahead of it indoors and 12 to 18 ms in the open world. It reads nothing the planning makes.

I looked for other steps of submit that could run beside one another and found none: the planning's list has to be asked about and looked at by stale_under_flights, the refreshes need its answer, picked::declare and the card's copies need every refresh done, and one copy has one CPU side and one snapshot, so the next submission cannot be prepared before this one is sent (which VICTORY_JOIN_PARTS already answers the legal way). This one step is what is left, and its ceiling is the asking's own time, less what waking a thread costs.

What changes

The asking is made a few hundred microseconds earlier in the submission. Memory the title's other threads write in that time is seen by the next submission's asking, as what they write while the refreshes run is today (once's own comment); what this submission's lists read was written before they were submitted.

Tested

  • watch::tests::an_asking_begun_first_is_made_and_more_is_asked_for (new): the asking begun on the thread is made when waited for and notes what was written; a range nobody held is asked for afterwards; an empty asking is waited for like any other. cargo test -p victory-gpu --lib watch:: host::tests: 106 passed.
  • cargo clippy -p victory-gpu --all-targets --locked: no warning that upstream ca9c75c does not have; cargo xtask policy: 280 files ok.
  • Not run in the title yet, so neither the gain nor the picture over a long session is known: this is the one of my changes that touches what the journal says, and it should be looked at with that in mind. I will add a run here.

🤖 Generated with Claude Code

…IRST=1, off by default)

The asking of the write watch is begun on a thread kept for it when the submission has the lock, beside the planning of the steps done on the card and the look at flights, and waited for where it was made before. There it is made again, whole, if flights were waited for or settled meanwhile; else only what it does not hold is asked (the ranges of the list of steps done on the card). A line per frame counts the three.

Tests: an asking begun first is made when waited for, and more is asked for afterwards.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@cloph-dsp

Copy link
Copy Markdown

Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):

  • PR A submission's one asking begun beside its first steps (VICTORY_ASK_FIRST=1, off by default) #127 at head edbf86e8b382dbe261622961d7cae244dd6c9e12, base (single-commit parent) ca9c75cd6d59b04a096746b313baed986608e63a.
  • cargo test --locked -p victory-gpu --lib -- watch::tests::an_asking_begun_first_is_made_and_more_is_asked_for --exact --test-threads=1 --quiet → 1 passed, 0 failed, 455 filtered, exit 0.
  • git grep -F for the test name on the base returned no hits (test is new on this PR); git diff --check ca9c75cd HEAD clean (2 files, +188/-2).
  • Used a per-worktree CARGO_TARGET_DIR (never shared) with CARGO_BUILD_JOBS=2.
  • Only the named synthetic test was replayed; full workspace suite and clippy were not run locally (no clippy component on this toolchain).
  • GPU/driver: N/A (CPU-only bookkeeping test). No game data, assets, extracted shaders, DRM or decrypt involved.

AI-assisted (Hy4 flash).

@wildheathen

Copy link
Copy Markdown
Contributor

Tried this on top of 63b902f (RTX 5080), together with #697, #1066 and foxhound's CARD_STEPS_JOIN. One gap, found by reading the code, not seen in a run:

With VICTORY_ASK_FIRST=1 the asking starts before card_steps and late_blocked. If the relay worker lands a flight in that window, its bytes go into title memory through put_changed → watch::writing (no journal entry), and copy_back_done runs before the submission gets there. Then late_blocked has nothing left to wait for (waited_for_flights stays false, no settle for the sweep), ask_more finds those ranges already held and does not ask again, and writes_pending() is false, so stale_under_flights does not see them. A shadow copy of that memory read by this submission can be one landing old. Without ASK_FIRST this cannot happen: a flight that writes what the lists read is waited for before the asking.

What closed it here: an even/odd counter bumped by relay_land around each place it writes title memory (the merge in relay_card_back after its wait, hand_back.merge(), and the read-back / Late::Write loop, before the line's lock), read with Acquire before the asking begins; the whole asking is made again if the value was odd or has changed. relay_land only runs on the relay worker, so one counter is enough.

Numbers (Jason's house, RTX 5080, Series X 1440p, frame generation off; switched inside one 8-minute run with VICTORY_AB=10,VICTORY_SUBMIT_SPLIT,VICTORY_ASK_FIRST and #697's page holding on; phases from minute 3 on at 7,000–7,600 draws a frame; the counter above included): median frame 36.6 ms off (7 phases) and 37.0 ms on (7 phases), so no difference at the frame in this scene. In my earlier separate runs the "asking the write watch" part of the submitting thread went down by about 1.4 ms a frame with it, but the frame here waits on the preparing as a whole.

Happy to open the counter as a follow-up PR against this branch if that's easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants