GPU: a submission refreshes a copy's ranges disjoint, not their span #2417

Closed
borosf wants to merge 1 commit from upstream-pr/2419 into main
borosf commented 2026-11-25 13:10:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-25T13:10:42Z.


Summary

  • Batch merged every refresh of a buffer copy across a submission into one [min, max] span, so lists asking for distant small parts of one copy (constant buffers through the bindless hulls, heap table ranges, recorded Step::Refreshes) copied everything between them out of title memory. The dossier counts this line as most of preparing (~860 ms of a ~1,900 ms Series S world frame; copies ~270 MB ≈ 440 ms).
  • Refreshes are now kept as disjoint ranges per copy: a request merges only with what it overlaps or lies within a page (64 KiB) of; distant ranges are copied apart. The coverage bookkeeping (current) is a disjoint set too, so ranges already brought up to date are skipped more often than before.
  • The merge is a small pure function (push_range), model-checked against a brute-force coalescer over thousands of random range sequences; unit tests cover the coalescing/bridging rules, and an integration test shows two distant refreshes of one watched copy stay apart.

Numbers

Model (no game data; per-frame equivalents of the submission pattern the dossier describes):

  • scattered 16 KiB views in 64 MiB copies (80 copies × 40 requests): union 5,108 MB → disjoint 56.6 MB (90×)
  • dense 64 KiB × 200 requests: 1,333 MB → 255 MB (5.2×)
    Real-world confirmation needs the diagnostics frame log (preparing MB/ms before/after) on hardware that runs the game.

Verification

  • cargo test -p victory-gpu --lib on Intel Arc B580: 143 passed, 2 failed with only the two known Intel heap-cap failures pristine main also has, 2 benchmarks ignored. Includes the new ranges_of_a_copy_stay_disjoint, distant_refreshes_of_a_copy_are_copied_apart, and the existing refresh-semantics tests unchanged.
  • The merge algorithm fuzz-matches a reference coalescer (8,000 random operations).
  • No game data used.

claiming: PREPARING-DISJOINT-RANGES (the dirty-range half of H-2.1; per the ledger the adjacent lanes NEW-48 / NEW-53 / GPU-SNAPSHOT-COST are correctness or copy-back redesign, not this).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6605247058 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2419). Originally posted by [borosf](https://github.com/borosf) on 2026-11-25T13:10:42Z. --- ## Summary - `Batch` merged every refresh of a buffer copy across a submission into one `[min, max]` span, so lists asking for distant small parts of one copy (constant buffers through the bindless hulls, heap table ranges, recorded `Step::Refresh`es) copied everything between them out of title memory. The dossier counts this line as most of `preparing` (~860 ms of a ~1,900 ms Series S world frame; copies ~270 MB ≈ 440 ms). - Refreshes are now kept as disjoint ranges per copy: a request merges only with what it overlaps or lies within a page (64 KiB) of; distant ranges are copied apart. The coverage bookkeeping (`current`) is a disjoint set too, so ranges already brought up to date are skipped more often than before. - The merge is a small pure function (`push_range`), model-checked against a brute-force coalescer over thousands of random range sequences; unit tests cover the coalescing/bridging rules, and an integration test shows two distant refreshes of one watched copy stay apart. ## Numbers Model (no game data; per-frame equivalents of the submission pattern the dossier describes): - scattered 16 KiB views in 64 MiB copies (80 copies × 40 requests): union 5,108 MB → disjoint 56.6 MB (**90×**) - dense 64 KiB × 200 requests: 1,333 MB → 255 MB (**5.2×**) Real-world confirmation needs the diagnostics frame log (`preparing` MB/ms before/after) on hardware that runs the game. ## Verification - `cargo test -p victory-gpu --lib` on Intel Arc B580: 143 passed, 2 failed with only the two known Intel heap-cap failures pristine main also has, 2 benchmarks ignored. Includes the new `ranges_of_a_copy_stay_disjoint`, `distant_refreshes_of_a_copy_are_copied_apart`, and the existing refresh-semantics tests unchanged. - The merge algorithm fuzz-matches a reference coalescer (8,000 random operations). - No game data used. claiming: PREPARING-DISJOINT-RANGES (the dirty-range half of H-2.1; per the ledger the adjacent lanes NEW-48 / NEW-53 / GPU-SNAPSHOT-COST are correctness or copy-back redesign, not this).
upstream-sync closed this pull request 2026-11-25 14:06:49 +00:00
catminou4 commented 2026-11-25 14:06:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T13:19:30Z.

Review: COMMENTED


A submission refreshes a copy's ranges disjoint — duplicates #2349 (same disjoint-coalescing rewrite of the same host.rs section, nearly identical comment text). Whichever merges second conflicts; suggest closing one.

<!-- greyfinch-sync:Marvisak/VIctory:review:6058346596 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2419#pullrequestreview-6058346596). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T13:19:30Z. **Review:** COMMENTED --- A submission refreshes a copy's ranges disjoint — **duplicates #2349** (same disjoint-coalescing rewrite of the same host.rs section, nearly identical comment text). Whichever merges second conflicts; suggest closing one.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2417
No description provided.