A submission's one asking begun beside its first steps (VICTORY_ASK_FIRST=1, off by default) #127
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/127"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by 1mosce on 2026-11-27T18:31:45Z.
What
VICTORY_ASK_FIRST=1(off by default; withVICTORY_ASK_ONCE, and not withupcheck): 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:watch::ask_more, which isask_restover the same ranges): the ranges of the list of steps done on the card, which is made after the asking was begun;ask_onceas today.stale_under_flightsandsettle_stalefollow 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
Batchis taken a little earlier insubmit.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
submitthat could run beside one another and found none: the planning's list has to be asked about and looked at bystale_under_flights, the refreshes need its answer,picked::declareand 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 (whichVICTORY_JOIN_PARTSalready 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 upstreamca9c75cdoes not have;cargo xtask policy: 280 files ok.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-28T03:06:56Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
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 -Ffor the test name on the base returned no hits (test is new on this PR);git diff --check ca9c75cd HEADclean (2 files, +188/-2).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wildheathen on 2026-11-28T15:25:39Z.
Tried this on top of
63b902f(RTX 5080), together with #697, #1066 and foxhound'sCARD_STEPS_JOIN. One gap, found by reading the code, not seen in a run:With
VICTORY_ASK_FIRST=1the asking starts beforecard_stepsandlate_blocked. If the relay worker lands a flight in that window, its bytes go into title memory throughput_changed→watch::writing(no journal entry), andcopy_back_doneruns before the submission gets there. Thenlate_blockedhas nothing left to wait for (waited_for_flightsstays false, no settle for the sweep),ask_morefinds those ranges already held and does not ask again, andwrites_pending()is false, sostale_under_flightsdoes not see them. A shadow copy of that memory read by this submission can be one landing old. WithoutASK_FIRSTthis 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_landaround each place it writes title memory (the merge inrelay_card_backafter its wait,hand_back.merge(), and the read-back /Late::Writeloop, 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_landonly 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_FIRSTand #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.