gpu(card_steps): prune dependency scans and batch constant slot writes #2812

Open
Nosheboo wants to merge 1 commit from upstream-pr/2812 into main
Nosheboo commented 2026-11-29 17:37:10 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Nosheboo on 2026-11-29T17:37:10Z.


Motivation

On upstream 55d06914, baseline telemetry shows the submitter spending 2.5–3.3 ms/frame in card_steps and 4.4–5.3 ms/frame in copies & fills. Per-slot constant_slot calls repeatedly take/drop SHADER_HEAPS locks and query host() / GetGPUVirtualAddress(), while fill-only submissions still pay full read-range merging and Box<dyn Iterator> overhead in plan_with.

Changes

  • crates/victory-gpu/src/host/card_steps.rs:
    • Raises MOST from 12288 to 16384.
    • Prunes unnecessary read-range merges, dependency rescans, behind-range checks, and Box<dyn Iterator> boxing when planning fill-only/no-copy submissions, while preserving !given[i] checks in in_the_way and served_fills.
    • Pre-sizes places/held and uses held.retain, plus reuses bounded thread-local SLOT_BATCH scratch storage (flush_slot_batch) per worker shard inside land::each_view / land::each_under.
    • Adds plan_handles_fill_only_lazy_behind_coalescing_and_served_placed.
  • crates/victory-gpu/src/descriptor.rs & crates/victory-gpu/src/descriptor/host.rs:
    • Adds constant_slots (using single-heap fast path plus order-preserving per-heap grouping with bounded thread-local CONSTANT_SLOT_SCRATCH) forwarding to HostHeap::constant_at_batch (adapted to upstream's 16-shard retire_resource).
    • Adds constant_at_batch_writes_slots_and_retires_replaced_buffers and constant_slots_batches_across_heaps_and_handles_empty_or_stale.

Attribution

Ported from FoxHound v0.8.1: readmet3xt-lab/foxhound commit 6c67166d (PR #36, author Dilim0n, GPL-3.0-or-later). Commit trailers and source doc comments credit Dilim0n and readmet3xt-lab.

Verification

  • Rebased cleanly onto upstream/main (41adb551): git diff --check upstream/main..HEAD clean; trailers intact (Co-authored-by: Dilim0n, Co-authored-by: readmet3xt-lab).
  • cargo clippy -p victory-gpu --no-deps --all-targets --locked and --all-features with -W clippy::undocumented_unsafe_blocks: 0 new warnings vs upstream/main baseline (41adb551).
  • cargo test -p victory-gpu --lib --locked host::card_steps:: -- --test-threads=1 -> 22 passed; 0 failed; 1 ignored
  • cargo test -p victory-gpu --lib --locked descriptor:: -- --test-threads=1 -> 106 passed; 0 failed; 2 ignored

Council review

Rounds: 4

Delegate Round 1 Round 2 Round 3 Round 4 (Rebase)
Concurrency & Safety Auditor (gpt-6-luna, xhigh) 9/10 9/10 9/10 10/10
Performance & Modernization Architect (gpt-6-luna, xhigh) 7/10 7/10 9/10 9/10
Upstream PR Hygiene & Test Critic (gpt-6-luna, xhigh) 8/10 8/10 8/10 10/10

Created in T3 Code (reviewed by Council: 3× gpt-6-luna on xhigh).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5553310328 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2812). Originally posted by [Nosheboo](https://github.com/Nosheboo) on 2026-11-29T17:37:10Z. --- ## Motivation On upstream `55d06914`, baseline telemetry shows the submitter spending `2.5–3.3 ms/frame` in `card_steps` and `4.4–5.3 ms/frame` in `copies & fills`. Per-slot `constant_slot` calls repeatedly take/drop `SHADER_HEAPS` locks and query `host()` / `GetGPUVirtualAddress()`, while fill-only submissions still pay full read-range merging and `Box<dyn Iterator>` overhead in `plan_with`. ## Changes - `crates/victory-gpu/src/host/card_steps.rs`: - Raises `MOST` from `12288` to `16384`. - Prunes unnecessary read-range merges, dependency rescans, behind-range checks, and `Box<dyn Iterator>` boxing when planning fill-only/no-copy submissions, while preserving `!given[i]` checks in `in_the_way` and `served_fills`. - Pre-sizes `places`/`held` and uses `held.retain`, plus reuses bounded thread-local `SLOT_BATCH` scratch storage (`flush_slot_batch`) per worker shard inside `land::each_view` / `land::each_under`. - Adds `plan_handles_fill_only_lazy_behind_coalescing_and_served_placed`. - `crates/victory-gpu/src/descriptor.rs` & `crates/victory-gpu/src/descriptor/host.rs`: - Adds `constant_slots` (using single-heap fast path plus order-preserving per-heap grouping with bounded thread-local `CONSTANT_SLOT_SCRATCH`) forwarding to `HostHeap::constant_at_batch` (adapted to upstream's 16-shard `retire_resource`). - Adds `constant_at_batch_writes_slots_and_retires_replaced_buffers` and `constant_slots_batches_across_heaps_and_handles_empty_or_stale`. ## Attribution Ported from **FoxHound v0.8.1**: [`readmet3xt-lab/foxhound`](https://github.com/readmet3xt-lab/foxhound) commit `6c67166d` (PR #36, author `Dilim0n`, `GPL-3.0-or-later`). Commit trailers and source doc comments credit `Dilim0n` and `readmet3xt-lab`. ## Verification - Rebased cleanly onto `upstream/main` (`41adb551`): `git diff --check upstream/main..HEAD` clean; trailers intact (`Co-authored-by: Dilim0n`, `Co-authored-by: readmet3xt-lab`). - `cargo clippy -p victory-gpu --no-deps --all-targets --locked` and `--all-features` with `-W clippy::undocumented_unsafe_blocks`: `0` new warnings vs `upstream/main` baseline (`41adb551`). - `cargo test -p victory-gpu --lib --locked host::card_steps:: -- --test-threads=1` -> `22 passed; 0 failed; 1 ignored` - `cargo test -p victory-gpu --lib --locked descriptor:: -- --test-threads=1` -> `106 passed; 0 failed; 2 ignored` ## Council review Rounds: 4 | Delegate | Round 1 | Round 2 | Round 3 | Round 4 (Rebase) | | --- | --- | --- | --- | --- | | Concurrency & Safety Auditor (`gpt-6-luna`, `xhigh`) | 9/10 | 9/10 | 9/10 | 10/10 | | Performance & Modernization Architect (`gpt-6-luna`, `xhigh`) | 7/10 | 7/10 | 9/10 | 9/10 | | Upstream PR Hygiene & Test Critic (`gpt-6-luna`, `xhigh`) | 8/10 | 8/10 | 8/10 | 10/10 | Created in T3 Code (reviewed by Council: 3× gpt-6-luna on xhigh).
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/2812:upstream-pr/2812'
git switch 'upstream-pr/2812'

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/2812'
git switch 'upstream-pr/2812'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2812'
git switch 'upstream-pr/2812'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2812'
git switch 'main'
git merge --squash 'upstream-pr/2812'
git switch 'main'
git merge --ff-only 'upstream-pr/2812'
git switch 'main'
git merge 'upstream-pr/2812'
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
trustno1-coder/VIctory-NVIDIA!2812
No description provided.