Speed up bindless planning, BCPack decoding, and shader translation #119

Open
github-bot wants to merge 6 commits from github-bot/gh-119 into main AGit
Owner

@⁠iWebbIO on GitHub · 2026-11-25 14:53 UTC · original
iWebbIO:perf/host-throughput → main · +3871 −794 · 11 files · 6 commits · open

Summary

  • Update bindless plans as slots change. Index resource-backed slots by view so releases and placed-texture evictions visit affected slots, and retain host resources across submission.
  • Speed up BCPack entropy decoding and reuse decoder workspace. Stage decoded output so a malformed stream leaves the destination intact.
  • Speed up GFX10 opcode lookup and decode, skip spill analysis when there are no spills, and reuse work in shader control-flow and I/O passes.

The bindless work targets the host preparation stalls reported in #20. The merge with 000ffdd keeps main's shared descriptor lock, direct-window death gate, plan diagnostics, and VICTORY_PLAN_REUSE=0 comparison mode.

Evidence against current main

Matched synthetic release workloads against 000ffdd, including its thin LTO and single codegen unit, on Windows 11 with an i5-13400F and RTX 5060 Ti.

Workload Before After Change
Bindless planning, 65,536 slots, 256 rewrites and a released bound view 8.043 ms 0.382 ms 21.1× faster
Bindless planning, 65,536 slots, 256 rewrites, a released bound view and a placed texture eviction 9.260 ms 1.008 ms 9.2× faster
Bindless planning, 2,048-slot rewrite burst 8.455 ms 1.869 ms 4.5× faster
BCPack BC1 48.7 MB/s 85.4 MB/s 1.75× throughput
BCPack BC3 50.4 MB/s 88.8 MB/s 1.76× throughput
BCPack BC4 46.8 MB/s 85.0 MB/s 1.82× throughput
BCPack BC5 52.1 MB/s 86.6 MB/s 1.66× throughput
BCPack BC6H 27.1 MB/s 43.8 MB/s 1.62× throughput
BCPack BC7 27.9 MB/s 47.8 MB/s 1.71× throughput
Shader translation, sum of medians across five compute and pixel workloads 12.14 ms 8.45 ms 30.4% less time

Bindless timings are the median of three runs with 25 samples each. The unit-test harness forces plan rebuilds on both revisions, so the timings characterize that path. The eviction scenario asserts that the stale view is dropped and the placed texture is rebuilt. BCPack used the shipped tables, 16,384 blocks per format, and 11 samples of 16 iterations. All six output digests matched. Shader translation used 11 samples of 16 iterations per workload across three interleaved pairs. All five DXIL sizes and digests matched.

cargo test --release --locked -p victory-gpu --lib benchmark_bindless_plan -- --ignored --nocapture --test-threads=1
cargo test --release --locked -p victory-formats --lib bcpack_all_formats_bench -- --ignored --nocapture --test-threads=1
cargo bench --locked -p victory-shader --bench translate_pipeline

Apply the same benchmark harness to the baseline revision for a before-and-after run.

Independent reports on the original PR head 0588225

  • On an RX 7900 XT with RADV and Proton, eight world frames from the same save and location showed bindless planning going from about 26 ms to 3–9 ms, with total frame time going from about 325 ms to 290 ms. The baseline included #123 and the comparison added #119 and #120 together. Linux Radeon report
  • On an i9-11900K with Bazzite, the existing synthetic decoder benchmark isolated 0588225 against 01aadd1. Throughput rose from 73.4 to 147.3 MB/s for BC1, 74.7 to 144.3 MB/s for BC4, and 42.5 to 80.5 MB/s for BC7. The formats suite passed 28 tests with five ignored. Independent decoder report

Local checks at merged head d185dd3

  • cargo check --workspace --all-features --all-targets --locked passed.
  • cargo test --workspace --locked --no-fail-fast passed 13 additional tests and reproduced the same 16 failures as 000ffdd. The baseline failures cover descriptor allocation, xmem, shader validation, and the existing asset-policy size limit.
  • Strict all-features workspace Clippy reproduced main's 10 diagnostics.

Merge risk

The changes are reversible in Git and add no dependencies. Runtime impact is concentrated in submission-time descriptor tracking, texture decompression and shader translation. The GPU indexes use additional memory proportional to active slots, and the decoder reuses per-thread workspace.

Built with Cloudroom

**@⁠iWebbIO** on GitHub · 2026-11-25 14:53 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/119) `iWebbIO:perf/host-throughput` → `main` · +3871 −794 · 11 files · 6 commits · open ## Summary - Update bindless plans as slots change. Index resource-backed slots by view so releases and placed-texture evictions visit affected slots, and retain host resources across submission. - Speed up BCPack entropy decoding and reuse decoder workspace. Stage decoded output so a malformed stream leaves the destination intact. - Speed up GFX10 opcode lookup and decode, skip spill analysis when there are no spills, and reuse work in shader control-flow and I/O passes. The bindless work targets the host preparation stalls reported in [#20](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/issues/20). The merge with `000ffdd` keeps main's shared descriptor lock, direct-window death gate, plan diagnostics, and `VICTORY_PLAN_REUSE=0` comparison mode. ## Evidence against current main Matched synthetic release workloads against `000ffdd`, including its thin LTO and single codegen unit, on Windows 11 with an i5-13400F and RTX 5060 Ti. | Workload | Before | After | Change | | --- | ---: | ---: | ---: | | Bindless planning, 65,536 slots, 256 rewrites and a released bound view | 8.043 ms | 0.382 ms | 21.1× faster | | Bindless planning, 65,536 slots, 256 rewrites, a released bound view and a placed texture eviction | 9.260 ms | 1.008 ms | 9.2× faster | | Bindless planning, 2,048-slot rewrite burst | 8.455 ms | 1.869 ms | 4.5× faster | | BCPack BC1 | 48.7 MB/s | 85.4 MB/s | 1.75× throughput | | BCPack BC3 | 50.4 MB/s | 88.8 MB/s | 1.76× throughput | | BCPack BC4 | 46.8 MB/s | 85.0 MB/s | 1.82× throughput | | BCPack BC5 | 52.1 MB/s | 86.6 MB/s | 1.66× throughput | | BCPack BC6H | 27.1 MB/s | 43.8 MB/s | 1.62× throughput | | BCPack BC7 | 27.9 MB/s | 47.8 MB/s | 1.71× throughput | | Shader translation, sum of medians across five compute and pixel workloads | 12.14 ms | 8.45 ms | 30.4% less time | Bindless timings are the median of three runs with 25 samples each. The unit-test harness forces plan rebuilds on both revisions, so the timings characterize that path. The eviction scenario asserts that the stale view is dropped and the placed texture is rebuilt. BCPack used the shipped tables, 16,384 blocks per format, and 11 samples of 16 iterations. All six output digests matched. Shader translation used 11 samples of 16 iterations per workload across three interleaved pairs. All five DXIL sizes and digests matched. ```text cargo test --release --locked -p victory-gpu --lib benchmark_bindless_plan -- --ignored --nocapture --test-threads=1 cargo test --release --locked -p victory-formats --lib bcpack_all_formats_bench -- --ignored --nocapture --test-threads=1 cargo bench --locked -p victory-shader --bench translate_pipeline ``` Apply the same benchmark harness to the baseline revision for a before-and-after run. ### Independent reports on the original PR head `0588225` - On an RX 7900 XT with RADV and Proton, eight world frames from the same save and location showed bindless planning going from about 26 ms to 3–9 ms, with total frame time going from about 325 ms to 290 ms. The baseline included #123 and the comparison added #119 and #120 together. [Linux Radeon report](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/pulls/119) - On an i9-11900K with Bazzite, the existing synthetic decoder benchmark isolated `0588225` against `01aadd1`. Throughput rose from 73.4 to 147.3 MB/s for BC1, 74.7 to 144.3 MB/s for BC4, and 42.5 to 80.5 MB/s for BC7. The formats suite passed 28 tests with five ignored. [Independent decoder report](https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/pulls/119) ### Local checks at merged head `d185dd3` - `cargo check --workspace --all-features --all-targets --locked` passed. - `cargo test --workspace --locked --no-fail-fast` passed 13 additional tests and reproduced the same 16 failures as `000ffdd`. The baseline failures cover descriptor allocation, xmem, shader validation, and the existing asset-policy size limit. - Strict all-features workspace Clippy reproduced main's 10 diagnostics. ## Merge risk The changes are reversible in Git and add no dependencies. Runtime impact is concentrated in submission-time descriptor tracking, texture decompression and shader translation. The GPU indexes use additional memory proportional to active slots, and the decoder reuses per-thread workspace. Built with [Cloudroom](https://cloudroom.dev)
Eliminate O(total bindless slots) scans and per-frame plan rebuild storms in HostHeap::bindless_plan:

- Add a bounded freed-view journal (FREED_KEPT = 65536) and batched view_at lookup in descriptor.rs, bumping VIEWED after mutating view state so concurrent readers never observe pre-release generations.
- Track resource-backed slots in a compact reverse index (by_view) and placed-texture uses in placed_uses so released views and placed-texture evictions inspect only affected slots while preserving ascending slot order under budget.
- Maintain incremental read (READ_GAP-bucketed), write, sorted-bounce, and deduplicated alias-retained indexes in lockstep with Bindless::uses via Bindless::set_use, avoiding O(N) Arc/COM AddRef+Release storms and redundant sorting on plan rebuilds.
- Use a fast integer hasher (SlotMix) for internal slot tables, batch global VIEWS lookups in chunks of 16, skip redundant bindless/kept_textures locks on aligned CBVs and buffer-only heaps, and avoid a per-lookup Vec allocation in shadow::find_copy.
- Add regression unit tests and a synthetic release CPU benchmark (descriptor::host::tests::benchmark_bindless_plan).
Ensure steady_frame_256_rewrites_64k releases a clean materialized view (not already dirty) so stale-view scanning is genuinely exercised, and ensure steady_frame_eviction_64k binds and evicts a materialized placed texture slot before timing bindless_plan().
Reconcile PR #119 with belobug/main (000ffdd4ee):

- descriptor.rs: keep upstream RwLock (ff920f2) on VIEWS; acquire .write() in forget before bumping VIEWED outside the lock and .read() in freed_views_total, freed_views_since, and views_at_batch.
- descriptor/host.rs: preserve upstream direct-window death gate (died_seen / shadow::died), PLAN_NOTES/LACKS/LACK_FRAMES diagnostics, VICTORY_PLAN_REUSE=0 full-rebuild comparison knob, and LOOSE_FRAMES/extra alias retention, unified with exact incremental ReadIndex/WriteIndex/bounce_entries/alias_retained (with per-field set_use diff), by_view/freed_views_since stale detection (sorted ascending under budget), and placed_uses eviction checks.
- shadow.rs: clean auto-merge preserving upstream direct-window death signal (DIED), through_another_view, retire lifetimes, and buffer_end alongside the zero-alloc find_copy scan.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:09 +00:00
Author
Owner

@⁠sil-kong on GitHub · 2026-11-25 15:08 UTC · original

Data point on Linux (Arch, RX 7900 XT with RADV, Ryzen 9 5900X, GE-Proton10-34's Wine + vkd3d-proton), Belobug main at 01aadd1 + #123, then + this PR (and #120), release build, same save and spot, 8 world frames: "bindless plans" went from ~26 ms to 3-9 ms a frame (3-5 ms once settled), and the frame from ~325 to ~290 ms. Rendering at that spot unchanged.

**@⁠sil-kong** on GitHub · 2026-11-25 15:08 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/119#issuecomment-7166356197) Data point on Linux (Arch, RX 7900 XT with RADV, Ryzen 9 5900X, GE-Proton10-34's Wine + vkd3d-proton), Belobug main at 01aadd1 + #123, then + this PR (and #120), release build, same save and spot, 8 world frames: "bindless plans" went from ~26 ms to 3-9 ms a frame (3-5 ms once settled), and the frame from ~325 to ~290 ms. Rendering at that spot unchanged.
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-25 18:12 UTC · original

Independent CPU decoder measurements on an i9-11900K, Bazzite 45, Rust 1.98.1 release, comparing the baseline cited in this PR (01aadd1) with head 0588225. I used the existing synthetic bcpack_throughput test, whose function body is identical in both revisions. Run order was base, head, head, base, base, head in one Fedora container. Medians of three runs per revision, in MB of output per second:

Format Baseline PR
BC1 73.4 147.3
BC4 74.7 144.3
BC7 42.5 80.5

The synthetic workload uses 16,384 blocks per format and 40 timed decodes per run. On this host the decoder throughput improved for all three formats. The victory-formats library tests at head also completed with 28 passed and 5 ignored. Gameplay FPS was outside this measurement.

**@⁠KernelSmoker** on GitHub · 2026-11-25 18:12 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/119#issuecomment-7170601249) Independent CPU decoder measurements on an i9-11900K, Bazzite 45, Rust 1.98.1 release, comparing the baseline cited in this PR (01aadd1) with head 0588225. I used the existing synthetic bcpack_throughput test, whose function body is identical in both revisions. Run order was base, head, head, base, base, head in one Fedora container. Medians of three runs per revision, in MB of output per second: | Format | Baseline | PR | | --- | ---: | ---: | | BC1 | 73.4 | 147.3 | | BC4 | 74.7 | 144.3 | | BC7 | 42.5 | 80.5 | The synthetic workload uses 16,384 blocks per format and 40 timed decodes per run. On this host the decoder throughput improved for all three formats. The victory-formats library tests at head also completed with 28 passed and 5 ignored. Gameplay FPS was outside this measurement.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:38 UTC · original

Full-corpus check of the shader-translation part, on the game's shaders.rpf (RX 7900 XT, Windows 11 build 26300, Rust 1.98.1, release builds with the same profile, dxil.dll 10.0.26100.0). I compared head d185dd3 with main at 000ffdd, its base, using victory translate --validate --list --host-lanes 32-64 --jobs 8 and a local, uncommitted per-program DXIL hash:

  • Output: all 25,623 emitted programs are byte for byte the same as on main, in each of three runs, and every count is unchanged (VS/PS 14,247/14,247, CS 2,682/2,682, MS 8,694 of 8,765).

  • Time: three interleaved pairs, wall clock for the whole archive with validation:

    • main: 142, 161 and 195 s;
    • this PR: 171, 135 and 137 s.

    The medians are 161 s against 137 s, about 15 % less. Other jobs were running on the machine, so the spread is large, one PR run was slower than one main run, and I would read this only as pointing the same way as the 30 % in the description. The full run also includes validation and archive reading, which this PR does not change.

I did not run the unit tests, the bindless or BCPack parts, or the game.

**@⁠adrianmjim** on GitHub · 2026-11-26 19:38 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/119#issuecomment-7201815238) Full-corpus check of the shader-translation part, on the game's `shaders.rpf` (RX 7900 XT, Windows 11 build 26300, Rust 1.98.1, release builds with the same profile, dxil.dll 10.0.26100.0). I compared head `d185dd3` with `main` at `000ffdd`, its base, using `victory translate --validate --list --host-lanes 32-64 --jobs 8` and a local, uncommitted per-program DXIL hash: - **Output:** all 25,623 emitted programs are byte for byte the same as on `main`, in each of three runs, and every count is unchanged (VS/PS 14,247/14,247, CS 2,682/2,682, MS 8,694 of 8,765). - **Time:** three interleaved pairs, wall clock for the whole archive with validation: - `main`: 142, 161 and 195 s; - this PR: 171, 135 and 137 s. The medians are 161 s against 137 s, about 15 % less. Other jobs were running on the machine, so the spread is large, one PR run was slower than one `main` run, and I would read this only as pointing the same way as the 30 % in the description. The full run also includes validation and archive reading, which this PR does not change. I did not run the unit tests, the bindless or BCPack parts, or the game.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/119/head:github-bot/gh-119'
git switch 'github-bot/gh-119'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-119'
git switch 'github-bot/gh-119'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-119'
git switch 'github-bot/gh-119'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-119'
git switch 'main'
git merge --squash 'github-bot/gh-119'
git switch 'main'
git merge --ff-only 'github-bot/gh-119'
git switch 'main'
git merge 'github-bot/gh-119'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.