Skip to content

GPU: index bindless texture slots for targeted release and preserve u… - #1862

Open
VlREX wants to merge 2 commits into
Marvisak:mainfrom
VlREX:perf/bindless-slot-index-corpus
Open

VlREX wants to merge 2 commits into
Marvisak:mainfrom
VlREX:perf/bindless-slot-index-corpus

Conversation

@VlREX

@VlREX VlREX commented Nov 24, 2026

Copy link
Copy Markdown

Optimize runtime bindless descriptor bookkeeping with a reverse texture-to-slot index and unchanged-view fast path. Includes 200 synthetic regression traces across 10 workload families. Two independent reference checks over 23,680 operations each, zero disagreements. Synthetic release work reduced from 30,006 examined entries to 5,874 targeted removals (80.42% fewer). 204 files, no new dependencies or proprietary assets. Native Rust and GPU validation pending. No FPS improvement claimed. AI-assisted (ChatGPT).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Bindless texture slots indexed for targeted release + preserve…: bindless slot lifecycle; interacts with heap-clamp work #1777/#1779 — check consistency.

@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown

Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at aab3845: cargo test -p victory-gpu --locked gives 276 passed, 2 failed, 1 ignored. The two failures are the NVIDIA heap-cap ones main also has (descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views, #1744), so there is nothing new on this hardware. Not run: a title.

AI-assisted (Claude Code).

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. The head (3ff4bc0) hasn't changed since the last review. bindless::Inner::textures in crates/victory-gpu/src/bindless.rs becomes a texture-to-slot-set index. forget, which runs on every Resource drop, removes only that texture's slots (forget_texture) instead of scanning the whole heap. The seeded test in bindless/slot_tests.rs checks the index against a full-scan reference after every step.

On your reply: thanks for the numbers, including the ones that go against the change. Release gets much faster when a texture has few slots (up to 95x at 32,768 slots), but all nine rewrite-only configurations got slower because of the extra index upkeep. Which of those costs dominates in a real frame is the maintainer's call. A per-frame timing from the title would settle it. Please also finish the truncated PR title.

CI: passing (check).


Generated by Claude Code

@VlREX
VlREX force-pushed the perf/bindless-slot-index-corpus branch from ae5da7e to 3ff4bc0 Compare November 25, 2026 18:32
@VlREX

VlREX commented Nov 25, 2026

Copy link
Copy Markdown
Author

Native performance validation

Ryzen 5 3600X / RX 5700 XT / Windows 10
Rust 1.98.1

  • Workspace check: PASS
  • Targeted tests: 2/2 PASS
  • Clippy: PASS
  • Synthetic benchmark: 27/27 matched

32768 slots:

Slots per texture Mixed speedup Release speedup
1 61.796x 95.407x
8 20.261x 41.415x
64 3.021x 5.527x

Release measurements include reinsertion.
13 of 27 configurations improved.
All 9 rewrite-only configurations were slower
due to reverse-index maintenance overhead.

PR head: 3ff4bc0
Benchmark source:
VlREX@b626297

Seven alternating-order samples per configuration.
Real workload profiling remains necessary.
Synthetic CPU benchmarks, not game FPS.

AI-assisted development (ChatGPT).
Native local measurements.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified 3ff4bc053cd9aed53f125b4f6caf001e06347dd4 merged onto origin/main (63bcca43c6a00a758510398fa43096ce7e4f7df0) on Windows 11 x64 (RTX 5090 + Microsoft WARP, --features diagnostics with VICTORY_D3D12_DEBUG=1, Rust 1.98.1 MSVC).

Code Audit

  • Audited every .textures and .slots access in crates/victory-gpu/src/bindless.rs: Inner::replace (L83-91), Inner::forget_texture (L93-100), and Inner::count (L137-146) maintain a strict bijection between slots (HashMap<u32, Seen>) and the reverse index textures (BTreeMap<usize, BTreeSet<u32>>), removing empty texture entries on overwrite/clear and removing only slots mapped to resource on forget (L372).
  • Existing readers (uploads iterating inner.textures.keys() and log reading inner.textures.len()) remain semantically unchanged, and debug_assert!(matches!(old, Some(Seen::Texture(r)) if r == resource)) (L97) guards against index drift in debug builds.

Local Verification

  • cargo xtask policy — pass (192 files ok).
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features) — 0 warnings.
  • cargo test --locked -p victory-gpu --features diagnostics --lib bindless:: (RTX 5090 and WARP) — 5/5 passed, including slot_tests::release_preserves_overwritten_and_unrelated_slots and slot_tests::seeded_slot_updates_match_full_scan (200 seeds x 256 operations).

(Minor non-blocking nit: the PR title is currently truncated at preserve u....)

Looks good to merge.

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).

  • Indexing bindless texture slots for targeted release cleanly avoids full scans while preserving remaining slot references.
  • cargo test -p victory-gpu --lib bindless:: -- --test-threads=1: all passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants