Skip to content

Vice-Tay picks: renderer ports 1/5/6 and submit-thread fixes, all off by default - #10

Open
oceansde012 wants to merge 22 commits into
mainfrom
claude/project-thread-ro2ml3
Open

oceansde012 wants to merge 22 commits into
mainfrom
claude/project-thread-ro2ml3

Conversation

@oceansde012

Copy link
Copy Markdown
Owner

Requested by Vlad · project thread

Base f4b48ad + single changes from TaynanGT/Vice-Tay that other forks also took, without the Vice-Tay defaults that darken the room / put blue blocks on the poster (none of the suspects is here). Every change is behind its own switch, off by default; with all switches unset the code paths are those of f4b48ad.

Picked (clean cherry-picks, -x keeps the source sha)

switch source target (profile 27.11)
VICTORY_PORT_CONSTANTS=1 (+ORDER sub-switches) DoubleGhosty c4966402 5e0c9ab0 2652705a eaad2f1f 76c4a286 (Vice-Tay port 1) copies / SEND_OWN bytes
VICTORY_PORT_CBV=1 DoubleGhosty fad4e536 (port 5) copies
VICTORY_PORT_GUARD=1 (_PLAN sub-switch) DoubleGhosty c781843b 4802054e 78b09e54 9f83fe9a bf1fb825 9828b0a0 (port 6) refreshes 17 ms, write watch 4.4 ms
VICTORY_UNDER_FUSED=1 Vice-Tay 6f3ede5 (default flipped to off) under-flights merge 4.9 ms
VICTORY_SPANS_QUICK=1, VICTORY_SYNC_FINE=1 Vice-Tay a284ca7 288af58 93c7e09 (default flipped to off) heap sync (VT: 13.5 -> 11.9 ms)
VICTORY_WIDE_NOTIFY_FEW=1 Vice-Tay d60fc84 Condvar wait 21%
VICTORY_RANGES_REUSE=1 Vice-Tay 876a02f per-submission allocations
VICTORY_COMPARE_FIRST_PIECE=1 Vice-Tay 21ec811 (fxceless #1407) bug fix: parallel compare dropped the first partial piece
VICTORY_ONE_BARRIER_PER_BUFFER=1 codec-d 641835a via Vice-Tay 773d902 duplicate transitions in one barrier call
VICTORY_GUARD_ONE_FAST=1 Vice-Tay 3c7ad08 (fxceless #1400) write watch

The last commit (gating of the default-on ones) was written by DeepSeek and reviewed by Claude.

Not in this PR: Vice-Tay PR #193 shader passes (put new passes into the default set, not gateable as is), port 7 and SYNC_IN_PLACE (conflicts). Details: project file reports/vicetay-picks-2026-11-27.md.

Tests

  • Cloud: CARGO_FEATURE_PURE=1 cargo check --workspace --all-targets --target x86_64-pc-windows-msvc OK.
  • clippy -D warnings on victory-gpu: base already fails (30 findings); this PR adds 5 kinds, all inside the upstream picks (is_multiple_of in shadow.rs, a test literal in port.rs, one unwrap_or_else in descriptor.rs, one needless &mut in watch.rs), none in the gating code.
  • Not run: cargo test on Windows, game A/B (base-env vs each switch).

Generated by Claude Code

local and others added 22 commits November 27, 2026 13:41
…s read as raw bytes, the title's in place given to the card where they are

The console takes constant buffers on 16 bytes, D3D12 views on 256, so every
constant buffer a draw's tables name was copied at each submission into upload
memory of ours (~23,000 a frame of the city, ~9 MB, out of the title's graphics
memory that renderer port 1 already has the card read in place), and each root
one not on 256 bytes (64 KiB each).

With the switch, translated shaders read constant buffers as raw bytes
(victory_shader::emit::constants_raw): a table's (or one picked from the heap)
through the raw twin of its slot, a root one as a root SRV. The host makes a
table's constant buffer in title memory in place a raw view of the title's
bytes in that twin (descriptor::host::constant_raw_at): no copy, no step at
submission. Others are copied as before (their twin is a raw view of the copy);
a title slot's constant buffer view gets a raw twin (a raw read through a
constant buffer view has no end on AMD). The shader cache keys on the switch
(only when on: translations cached without it keep their key, so the
translator version stays). VICTORY_PORT_CBV_PLACE=0 copies again while reading
raw; with VICTORY_AB=<s>,VICTORY_PORT_CBV_PLACE both sides in one run.
Per-second line: "renderer port 5 (VICTORY_PORT_CBV=1) per frame: ...".
Test: emit::tests::table_constant_buffers_read_as_raw_bytes_through_their_twins
(WARP: the twin is read, the slot's own view is not).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit fad4e53629e19a7834495ffeeaef4fa11be5f92e)
…ock shared by faults and refreshes, a block's claim held while its state changes; view memory not asked of the kernel

The sets of guarded blocks are of atomic words and GUARDS is a reader-writer
lock. With the switch a write fault, a refresh guarding its range and a block
made known by its bits take the lock shared and the claims (BUSY bits) of the
blocks they change: faults wait only for whoever changes the same block, not
for one another, and refreshes do not wait for faults. Faults wait for claims
in block order, refreshes only try for theirs (a block they cannot claim stays
written, told so at the next asking), so no two wait for each other. What
changes more than single blocks (mappings, kernel reads, freed memory, holes)
still holds the lock alone, as before. Blocks known as view memory (VIEWS) go
to the guards at once instead of a kernel asking that is refused.
VICTORY_GUARD_HOT=<ms> (off): blocks written again soon after each taking
rest longer. End-of-run line: renderer port 6 per frame.
Tests: three stress tests of the view writes with the switch on (all
threads, half of them, resting and hot blocks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c781843b41be3d52662d412b2ea8dd01673e9a17)
…ean?) under the shared lock too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4802054e833930b946d61b02248f19632754f6c1)
…res) is not asked: the kernel refuses it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 78b09e548a9add52ab71373e210a2e9c82469637)
…goes to the threads beside the submitting one (VICTORY_PORT_GUARD_PLAN=0: on it, as before); spans of the refresh planning on the timeline

One submission a frame spent up to 6 ms in that look alone (run guard-3,
the timeline at 100 s: 5.8 ms with nothing else on the lane) while the six
threads beside it waited; with more than 256 refreshes it was already done
beside them, as each one's first step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9f83fe9a65308541f3aa4f71261def17770c3093)
…de per list on the threads beside the submitting one and joined in order (with VICTORY_PORT_GUARD_PLAN, from 4,096 steps)

Run guard-4's timeline: the submission with most of the frame's steps spent
2.9 ms gathering them and 3.9 ms on the spans, alone. Each list's steps are
now folded per copy beside it (fold_touches: the span of its refreshes
before its first write by shaders, whether it writes it) and the folds
joined in list order (join_keys), which gives what front_spans gives of the
whole submission, span for span and in order: front_tests, 3,000 random
submissions of lists, parts, refreshes and writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit bf1fb825930a01dfe68c9a4076a2ad482f88444e)
… off: worse in run guard-6)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9828b0a04b8501e094b426a7895a01847e16643d)
…ORY_PORT_CONSTANTS=1, off by default)

The title's routine at image+0x1e86440 reserves 185 MB of graphics memory
below 4 GiB, splits it into five pieces, takes all their physical pages
in one XMemAllocatePhysicalPages and maps them in order: one stretch of
one section. Its 174 MB buffer at 0x34e10000 (the ring of constants, and
what the skinning passes write through one view of all of it) had a host
copy in the card's memory, ~17 MB a frame sent up in ~600 pieces, shader
writes fetched back and compared, and ~6,000 constant fills a frame.

With the switch the stretch is mapped once more at an address of ours and
opened as a host heap there (OpenExistingHeapFromAddress1); title buffers
and windows in it are buffers placed in that heap, the existing in-place
form of a host copy: nothing tracked, sent up, fetched back or compared.
The title's own views stay free to change; when it maps other pages
there the region is forgotten. A line on the frame-rate report counts
the CPU fills and buffer copies of ours that still read or write it.

Replay (play-1125-0127, heap in the PC's memory): the title's own work
+~3 ms on the card; the 30 ms added there are our compare passes, which
do not run over memory in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c496640276bbabd8551d2d193c7332b67c5471e8)
…n address order

Run port1-1: the title maps the five pieces of its 185 MB heap in another
order than their addresses, so the heap was views of one section in a
scattered order ("not one stretch of a section: Scattered") and nothing
was placed. With VICTORY_PORT_CONSTANTS=1 xmem now gives the page numbers
mapped into a 32-bit graphics reservation the slices at their offset in
it, when the reservation is all one section and both slices are fresh
(never mapped or written: no commit bit), which the title cannot observe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5e0c9ab01e7be216628516ff975445682555c366)
…d reads in place are clamped alone, right before they run, not ahead in a batch or window (VICTORY_PORT_CONSTANTS_ORDER=0: as before); their ranges logged with the frame line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2652705aa637dde3b24feb78654c815eb94bbf7e)
… after the last shader that may write buffers (VICTORY_PORT_CONSTANTS_ORDER_ALONE=1: each alone, as in run pop-14)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit eaad2f1fba828bc31248b9fb1120d88e81e163a8)
… (a batch opened after the last write was not enough: run pop-15); VICTORY_PORT_CONSTANTS_ORDER_ALONE=0 gives the batch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 76c4a286a55fd1a01e56c8675e81fbb38a9b7ca5)
…ass (VICTORY_UNDER_FUSED), noted at once, and where the time goes

Shadow::merge_under_writes, for a copy in the card's memory, found the
changed word runs of a page and then copied each run on its own into the
CPU's side: 190,000 runs in 400 pages a frame in session play-1125-1724.
Now each 32-byte block in which a word differs takes the title's bytes as
it is compared (the words of a block that do not differ are equal, so the
same bytes end up there; VICTORY_UNDER_FUSED=0: as before). The copies of
their own a page can need (runs of more than 256 bytes, at most n/260+1)
are taken from what the submission may send up before the pass and the
rest given back, so a page never has to be put back; where they cannot
be taken, the pass is as before. The runs of a range's pages go into the
copy's dirty list in one call, with room reserved.

A frame-rate line says where the time of this step goes: finding the
copies in the lists' refreshes, asking what was written, finding the
pages, waiting for the copy's locks, comparing (wall, and threads
together: reading title memory, comparing and putting in), noting runs.

Measured, city, lane on (VICTORY_THIN=1, JOIN_PARTS=8, UPLOAD_AHEAD=1):
- late-1 (no ray tracing, before this): 7-13 ms a frame on the lane, of
  them compare 3-6 wall (7-16 threads together), noting 1.4-3.6, asking
  1.0-1.7, the refreshes looked through 0.9, locks 0.0-0.2.
- late-3 (ray tracing, A/B of the switch in one run, world phases): 1.96
  -> 1.87 ms; compare and put 0.42 -> 0.27 (threads together), noting
  0.11 -> 0.06; frame unchanged within noise (110-121 ms both).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 6f3ede5)
…the spans' lock alone when the slot is not in them (VICTORY_SPANS_QUICK), finer jobs (VICTORY_SYNC_FINE), the pass's phases on the timeline and its jobs' split in the log

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit a284ca7)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 288af58)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 93c7e09)
Notify one helper per extra job, up to the size of the worker pool. The calling thread still drains the queue and waits for the entire batch.

(cherry picked from commit d60fc84)
Compact joined spans in their original allocation. Translate the first page of title writes in place and move its range storage into the batch for the later pages.

(cherry picked from commit 876a02f)
Adapt the fix from fxceless/victory-fork#1407, which credits the original finding to stellarr-studio/kelvaroq. Use the existing unbacked Shadow test helper for a hardware-independent regression.

(cherry picked from commit 21ec811)
…r many copies lie in it

From codec-d/cool_fox (Graham): the COPY_DEST -> NON_PIXEL_SHADER_RESOURCE
transitions after the card's copies of dirty ranges are made once for
each buffer; two shadows in one buffer gave two transitions of the same
subresource in one ResourceBarrier call.

Tests: victory-gpu --lib 343 ok, victory-hle ok, victory-shader --lib
286 ok, victory-loader --lib 42 ok.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 773d902)
Adapt the single-block fast path from fxceless/victory-fork#1400. Keep the existing alias path and protection handling.

(cherry picked from commit 11d5975dfe9abcbaf3669f95d96c8ed828f8a05d)
(cherry picked from commit 3c7ad08)
Code by DeepSeek (deepseek-v4-pro), reviewed by Claude. With all switches
unset the code paths are the ones of f4b48ad.

- VICTORY_UNDER_FUSED (Vice-Tay 6f3ede5): was on unless 0, now off unless 1.
- VICTORY_SPANS_QUICK (Vice-Tay a284ca7): was on unless 0, now off unless 1.
- VICTORY_WIDE_NOTIFY_FEW (Vice-Tay d60fc84): wake only the helpers the jobs use.
- VICTORY_RANGES_REUSE (Vice-Tay 876a02f): join ranges in their own storage.
- VICTORY_COMPARE_FIRST_PIECE (Vice-Tay 21ec811, fxceless #1407): parallel
  compare keeps the first partial piece; its test forces the fixed path.
- VICTORY_ONE_BARRIER_PER_BUFFER (codec-d 641835a via Vice-Tay 773d902).
- VICTORY_GUARD_ONE_FAST (Vice-Tay 3c7ad08, fxceless #1400).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FLuVRnYBaf7eTVgmDS8gca
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.

6 participants