victory-gpu: O(log R) BlockRuns guard cache and fix VICTORY_D3D12_DRED=0 #685

Open
Claudinhomerq wants to merge 1 commit from upstream-pr/685 into main
Claudinhomerq commented 2026-11-25 04:29:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Claudinhomerq on 2026-11-25T04:29:19Z.


Summary

  1. O(log R) BlockRuns interval map for guarded clean blocks (crates/victory-gpu/src/watch.rs)

    • Replaces Guards::clean: BTreeSet<usize> with BlockRuns (disjoint, maximally merged half-open [start, end) intervals).
    • Checking a clean guarded view heap is now a single O(log R) range lookup with zero heap allocations, instead of collecting every clean block index into a temporary Vec<usize>.
    • Fast-paths known guarded view memory in writes() so guaranteed-to-fail GetWriteWatch kernel calls are skipped when the range is already covered by BlockRuns or known protected/absent blocks (respecting VICTORY_GUARD_ASK=1).
    • Adds unit test watch::tests::block_runs_merge_split_and_skip_clean_ranges.
  2. Respect VICTORY_D3D12_DRED=0 (crates/victory-gpu/src/host.rs)

    • dred_on() previously checked .is_some(), which kept DRED active even when explicitly set to VICTORY_D3D12_DRED=0. Now checks .is_some_and(|v| v != "0").

Verification

  • cargo xtask policy — asset policy: 169 files ok
  • cargo test -p victory-gpu --lib -- watch::tests — 7 passed; 0 failed
<!-- greyfinch-sync:fxceless/victory-fork:issue:6597227809 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/685). Originally posted by [Claudinhomerq](https://github.com/Claudinhomerq) on 2026-11-25T04:29:19Z. --- ## Summary 1. **O(log R) `BlockRuns` interval map for guarded clean blocks (`crates/victory-gpu/src/watch.rs`)** - Replaces `Guards::clean: BTreeSet<usize>` with `BlockRuns` (disjoint, maximally merged half-open `[start, end)` intervals). - Checking a clean guarded view heap is now a single O(log R) range lookup with zero heap allocations, instead of collecting every clean block index into a temporary `Vec<usize>`. - Fast-paths known guarded view memory in `writes()` so guaranteed-to-fail `GetWriteWatch` kernel calls are skipped when the range is already covered by `BlockRuns` or known `protected`/`absent` blocks (respecting `VICTORY_GUARD_ASK=1`). - Adds unit test `watch::tests::block_runs_merge_split_and_skip_clean_ranges`. 2. **Respect `VICTORY_D3D12_DRED=0` (`crates/victory-gpu/src/host.rs`)** - `dred_on()` previously checked `.is_some()`, which kept DRED active even when explicitly set to `VICTORY_D3D12_DRED=0`. Now checks `.is_some_and(|v| v != "0")`. ## Verification - `cargo xtask policy` — `asset policy: 169 files ok` - `cargo test -p victory-gpu --lib -- watch::tests` — `7 passed; 0 failed`
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/685:upstream-pr/685'
git switch 'upstream-pr/685'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/685'
git switch 'upstream-pr/685'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/685'
git switch 'upstream-pr/685'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/685'
git switch 'main'
git merge --squash 'upstream-pr/685'
git switch 'main'
git merge --ff-only 'upstream-pr/685'
git switch 'main'
git merge 'upstream-pr/685'
git push origin 'main'
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
fxceless/victory-fork!685
No description provided.