Skip to content

GPU: wait for in-flight writes from aliased copies, read-backs and late writes (#89) - #191

Open
gdawid9407 wants to merge 1 commit into
fxceless:mainfrom
gdawid9407:fix/relay-exact-aliased-reads
Open

gdawid9407 wants to merge 1 commit into
fxceless:mainfrom
gdawid9407:fix/relay-exact-aliased-reads

Conversation

@gdawid9407

Copy link
Copy Markdown

Problem

Under VICTORY_RELAY=2 (relay_exact), submit only waits on WHY_READ until blocked_by clears for the current submission's CPU-side reads:

  1. blocked_by ignored Step::Refresh(shadow, address, len). Refreshing the same Shadow that declared an in-flight GpuWrite needs no wait (its GPU buffer receives the write in queue order and Shadow::update skips pending), but refreshing a different Shadow covering overlapping title addresses (e.g. a 4 MiB loose window vs an 8 MiB window, or a sub-buffer vs an enclosing heap buffer) reads title CPU memory before the writing flight's copy-back has landed — matching the missing skinned meshes and overlapping subtitle vertices reported with VICTORY_RELAY=2 in RTX 5070 Laptop (8 GB, default TDR) on 4e17478: 20 min stable, but VICTORY_RELAY=2 causes missing character skin and overlapping subtitles (clean without relay) #89.
  2. Title-memory ranges written on landing by texture read_backs (deferred().backs) and Late::Write items (in_hand / line) were not checked by blocked_by (while keeping Late::Write out of line.written so late_met still evaluates known Written::Value writes without unnecessary settles).

Changes

  • Track per-owner in-flight ranges (by_copy, keyed by Shadow pointer or 0 for texture read-backs) alongside written, plus Line::immed_writes for pending/landing Late::Write ranges.
  • Block Step::Refresh in blocked_by iff the refreshed range overlaps an in-flight write from a different Shadow copy, a texture read-back, or a Late::Write (counted in LATE_STATS as another copy).
  • Add relay_tests::refreshes_wait_only_for_writes_from_another_copy_or_readback.

RicerBoy added a commit to RicerBoy/DropItLikeItsHot that referenced this pull request Nov 24, 2026
… writes from aliased copies, read-backs and late writes (#89)

Part of #16
VlREX added a commit to VlREX/victory-fork that referenced this pull request Nov 25, 2026
…B testing

Original contributions: gdawid9407 (fxceless#191) and AscilCH (fxceless#206, fxceless#207).
Preserve credits and source commits in docs/virex-world-geometry-recovery.md.
Resolve overlapping host hazard checks without changing upstream PRs.
Native validation pending; AI-assisted integration.
VlREX added a commit to VlREX/victory-fork that referenced this pull request Nov 25, 2026
[Integration test only] World Geometry Recovery: combine fxceless#191, fxceless#206, fxceless#207
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…te writes (fxceless#89)

(cherry picked from commit 1582757)

Ported from fxceless#191 (conflict in the relay tests' imports only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017V7WBDcuSkQXqyyY47pR31
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…one host copy per placed texture (upstream c96b4f2, without its depth bounds)

Ported from fxceless/victory-fork c96b4f2, leaving out its depth bounds
test (fxceless#82): this fork has its own (0a82121), and where they meet
(pipeline/host.rs, list.rs, draw.rs, host.rs) the fork's is kept.

- Defaults: wide copy-back, card copies from 1 MiB up to 1,024 MB, and
  256 lists in the air (VICTORY_WIDE_BACK=0, VICTORY_CARD_BUFFERS_MIN_MB,
  VICTORY_CARD_BUFFERS_MB, VICTORY_LATE_WAIT_LISTS=128 give the old
  values). The relay stays off by default on this fork (fxceless#191 is
  still open): VICTORY_RELAY=1 or 2 turns it on, and with it on, stage 2
  is the default stage as upstream has it.
- Textures picked by index are uploaded while loading and before a draw
  of the title's decoration bake (VICTORY_EARLY_TEXTURES_MS,
  VICTORY_BAKE_TEXTURES_MS; 0 turns each off).
- Placed textures are keyed without the filler words of their
  description (VICTORY_PLACED_FILLER=1 keeps the old key); the count of
  such twins is logged by diagnostics builds only.
- VICTORY_TEXTURE_ROOM_PERCENT (90, unchanged).

(cherry picked from commit c96b4f2, in part)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
triippywhale added a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…d of waiting

With flights in the air, a submission that refreshed a host copy over bytes
another host copy's shaders were writing in a flight waited for that flight
to land (88897be, fxceless#191: "title memory read … another copy" on the
line of flights). In the PalmVI run (main 5493624, RX 7900 XT) that was
about 3 settles and most of 66 ms a frame, with the card about 40% busy
while the submitting thread stood.

The bytes are already on the card, and the flight's submission comes first
in the queue. Now such a refresh does not wait: a list of its own, sent
just ahead of the submission's lists, copies each range from the writing
copy's buffer into the refreshing copy's, in queue order, as 3d87249 passes
what shaders wrote to card copies down in the submission that wrote it
instead of fetching it afterwards.

It is exact only where title memory over the range is still what the
writing copy's snapshot took when its flight declared the write
(Shadow::snapshot_is_title): then the writing copy's buffer holds what
title memory will hold once the flight is copied back. Anywhere else (the
title wrote there since, no snapshot, a read-back, bottom-of-pipe writes,
two writers, the refreshing copy's own shaders writing there too, a copy in
the card's memory or in place, more than 64 MB to compare) it waits as
before. If no list can be had, the flights are settled and the bytes go
from copy to copy on the CPU.

VICTORY_ALIAS_FORWARD=0 waits as before. A line beside the line of flights
counts the refreshes that took bytes on the card, their ranges and MB, and
those that still waited.

Test: a_forward_takes_another_copys_bytes_on_the_card (on the host GPU):
the card copies the range and nothing else; the snapshot check holds only
where the snapshot is the title's bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Pin0d1

Pin0d1 commented Nov 25, 2026

Copy link
Copy Markdown

I checked two ordering cases on 1582757.

  • Queue stores of 1 and then 0 to the same eight bytes, followed by an equality wait for 1. The prediction returned true and the submission retained zero waits. In this ordering the last store before the wait is 0, so I expected false and one retained wait. The result repeated in two fresh processes.
  • Map the second 64 KiB page of one view at the start of a sibling view. A pending four-byte write overlaps two bytes of the recorded read through the sibling. The dependency check returned no wait for this overlap. Adjacent, disjoint and removed-mapping controls also returned no wait.

The replay cases are pr191 and pr191-physical. I included separate candidate patches for the last covering store and for comparing exact byte ranges through the mapping index in #555. Probes and transcripts · Patches and prerequisites

Prepared with the help of Codex 6.2 Astra Max.

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.

2 participants