perf(hwrt): batch structure invalidation and adapt address indexing #429

Open
github-bot wants to merge 38 commits from github-bot/gh-429 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-04 02:22 UTC · original
tommiehansen:perf/rt-freed-gathered → main · +25675 −90 · 34 files · 38 commits · open

Stacked PR — ready for review and community testing, not independent merge. Do not merge before LOCKhart07's replacement HWRT stages 1–7 (starting with #468) have landed and the isolated change has been reconciled and revalidated against main. The main-based diff includes borrowed prerequisite commits. See the isolated review diff and outstanding checks below.

Final Standard benchmark — latest HWRT foundation (2026-12-05)

CI: all 6 jobs passed · head b07015e · LOCKhart07 rt-7-reuse @ 621120b · paired CPU Standard, eight ABBA blocks.

Workload Baseline (ms) Candidate (ms) Time change
RT invalidation 5.179 0.378 −92.73%
Index churn 0.008 0.004 −44.65%
Sparse invalidation 0.100 0.021 −78.75%
Dense aliased −81.83%
Dense refill −89.20%
Empty overlap −93.04%
Iteration 0.016 0.015 −0.35%, inconclusive
Contended gate −0.99%, inconclusive
Pending gate +1.35%, inconclusive

All correctness digests identical. Native debug and release: 18/18 tests each. Shader checks passed. The foundation-only control found no significant regressions. #452 also passed its paired and native remap tests on this stack. The previous churn regression is resolved; marginal gate changes are inconclusive. Absolute costs above are per synthetic workload, not per gameplay frame.

Isolated current comparison. Still stacked: do not merge independently. Physical AMD gameplay timing remains unverified for this exact revision.

Historical Standard benchmark — 2026-12-05

Reproducible CI result · head 750e9b7441ec · Linux hosted CPU-only, Standard, four ABBA blocks (8 runs per arm).

Workload Baseline (ms) Candidate (ms) Time change Verification
RT invalidation 3.470 0.247 −93.38% Identical
Dense aliased index 0.073 0.017 −77.17% Identical
Empty overlap 0.435 0.033 −92.43% Identical
Index churn 0.011 0.012 +12.31% Regression
Contended gate 0.233 0.242 +4.76% Regression

Same head; VICTORY_HW_RT_FREED_GATHERED and VICTORY_HW_RT_FREED_INDEX both 0 → 1. Dense and invalidation cases improve substantially, but churn and gate contention need attention. No hardware RT timing.

Negative values indicate reduced CPU time. Synthetic workloads, not gameplay FPS.


Needs merged first

  • #468
  • Remaining replacement HWRT stages 2–7 (upstream PR numbers not yet published; pinned rt-7-reuse @ c3a0500). Strip borrowed commits and rebase onto main before merge.

What this does

batch structure invalidation and adapt address indexing.

Checks

  • Off-by-default and main parity: Parent VICTORY_HW_RT is opt-in; both sub-controls default on within HWRT. Verify disabled-path equivalence against landed foundation and decide sub-control defaults before merge.
  • Docs move with code: Both controls are documented; reconcile menu/defaults after prerequisite stack lands.
  • No unrelated cleanup: Own invalidation/index change is isolated; main-based diff contains borrowed HWRT foundation.
  • A test must exercise the change: 16 portable tests at pinned integration; joined_eviction_matches_single_spans_on_randomized_registries and index boundary tests. Rerun after dependency rebase; fail-before evidence pending.
  • Queue checked on 2026-12-04: Follows replacement HWRT stack beginning at #468; #452 follows this. Replaces old #342-based integration.
  • Run cargo xtask policy on the final revision; no new game assets or build output intended.

Verified

Current review head: 2eb4706ec25c43ee41dacc263146de018ed82def. Existing measurements and commands are retained below at their original revisions. No fresh compile, policy or hardware test is claimed by this metadata review.

Cost

Synthetic CPU invalidation −89.94%; previous insertion regression +46.22% on old revision, current GPU and gameplay effect unknown.


Detailed implementation and historical validation

Current integration — proposed HWRT stage 8

The updated implementation targets LOCKhart07's replacement HWRT stack starting at #468, not the retired integration plan in #342.

Revision
New foundation rt-7-reuse @ c3a0500
Updated optimization codex/rt-8-freed-integration @ 750e9b7
Review Isolated diff: 4 files, +1,320 / −71

Historical integration head: 750e9b7; current head: 2eb4706. The previous implementation (bb184d8) is preserved in an archive branch. Review the isolated diff above: GitHub's main-based diff includes the prerequisite HWRT stack until it lands. LOCKhart07 agreed to the proposed order: rt-7-reuse → #429 → #452. #452 is now integrated directly on this PR (benchmarked revision 455dfdb, current diagnostic follow-up c8edd2f). This is coordination with the stack author, not maintainer merge approval. The foundation is pinned to c3a0500; later shader-cache fixes in the upstream stack have not been included in this benchmarked revision.

Why this matters

Each guest page free can scan the RT registry, decoded and validated index caches, and the submission ledger. During world streaming, repeated frees and build-overlap queries can make this expensive.

  • Batched frees: join overlapping and adjacent half-open ranges within a serialized mapping group, reducing repeated registry scans. Isolated frees retain the single-range path.
  • Adaptive address index: retain a flat hash table for dispersed workloads; clustered addresses can use direct 16 MiB partitions across two adjacent 256 MiB bands. Fully covered partitions can be drained in bulk, while sparse operations skip unrelated keys.
  • Synchronization: an atomic activity gate avoids taking the free-queue mutex when no batch is pending. Observers flush pending frees before accessing affected state; earlier submissions retain their ordered ledger view.

The updated integration preserves the replacement stack's lease-aging policy, overwrite reclamation and named diagnostics. reuse_step is a flush boundary, and registry, named and reuse invalidation use matching half-open ranges. BLAS removals advance the remap generation.

Controls

Both optimizations default to enabled when VICTORY_HW_RT=1 is requested. They can be disabled independently:

Variable Disable
VICTORY_HW_RT_FREED_GATHERED 0
VICTORY_HW_RT_FREED_INDEX 0

Latest benchmark — replacement stack (750e9b7)

Apple M5, CPU-only, Benchmark Suite #322, Standard, four paired A/B/B/A blocks. Both controls off vs both on at the same integrated revision.

Workload Both off Both on Paired change
Invalidation 1,959.459 µs 201.292 µs −89.94%
Dense eviction + refill 66.459 µs 10.291 µs −83.70%
Disjoint dense ranges 129.521 µs 126.876 µs −2.05%
Phased churn 6.375 µs 6.334 µs −0.49% (not significant)
Scattered churn 6.417 µs 6.375 µs −0.48% (inconclusive)

All listed correctness digests matched. The invalidation fixture saves approximately 1.76 ms of CPU time per synthetic sample; this is not a measured per-frame saving. The direct comparison against c3a0500 cannot run a common production freed workload because the foundation lacks the planner module. These results isolate the controls, not whole application builds.

Run from a checkout of the Benchmark Suite (#322), not the game PR branch itself. The command records the comparison used for the reported results.

./tools/benchmark-suite/run compare 750e9b7 750e9b7 --cpu-only --suite raytracing --profile standard --blocks 4 \
  --base-env VICTORY_HW_RT_FREED_GATHERED=0 --base-env VICTORY_HW_RT_FREED_INDEX=0 \
  --cand-env VICTORY_HW_RT_FREED_GATHERED=1 --cand-env VICTORY_HW_RT_FREED_INDEX=1 \
  --out local/benchmarks/rt8-integration/toggle

Previous gameplay evidence

An RX 7900 XTX Linux tester reported approximately 15–25 → 25–40 FPS while driving after adding the earlier #429 implementation to #374. This was a qualitative report, not a controlled benchmark, and does not establish FPS gains for the new integration. Exact graphics settings and the tested #429 revision were not reported.

Verification and limitations

  • Updated integration: 16 portable freed-module tests passed, including randomized differential and concurrent observer tests.
  • Windows MSVC-target checks for victory-gpu and victory-hle with tests passed using the local check-only allocator shim.
  • Earlier independent native Windows review reported approximately 90,000 differential comparisons without mismatch using the earlier production data structures with a single-threaded test copy of the integration glue. This was not a live GPU test. Its empty-queue synchronization and diagnostic feedback were addressed in subsequent revisions and retained in this integration.
  • Earlier Full-profile testing at bb184d8 found a clustered insertion/replacement regression of 5.209 → 7.667 µs (+46.22%). That result is historical and has not been remeasured on the replacement stack.
  • Native GPU execution, real workload distribution, live resource retirement and gameplay performance of 750e9b7 remain unverified.

Historical benchmark details and reproduction commands.

Community testing welcome

Tests from all compatible AMD GPUs (RDNA 2–4) and other compatible hardware are welcome. Use the PR head (2eb4706), set VICTORY_HW_RT=1, and keep all other HWRT switches and graphics settings fixed. Baseline: VICTORY_HW_RT_FREED_GATHERED=0 VICTORY_HW_RT_FREED_INDEX=0; candidate: set both to 1. Separate batching/index tests are also useful.

Prefer native resolution, no frame generation or upscaling, warmed caches and repeated A/B/B/A runs. Other configurations are welcome if settings remain consistent. Report GPU/driver, revision, graphics settings, average FPS, 1% lows, frame times, memory usage, RT loss counters and any visual or stability issues. Positive, neutral and negative results are equally useful.

Credit: batching adapted from Darner's range-collection implementation; HWRT foundation by @⁠LOCKhart07.

Regression audit follow-up

The +4.76% contended gate row compared 750e9b7 against itself with two feature switches toggled. Raw reports show the same atomic Gate on both sides; gate_benches does not read those switches. Therefore that result is a same-code noise/control measurement, not an established switch-induced regression (repeat control pending). Index churn +12.31% (CI +11.17% to +13.46%) is a genuine measured microbenchmark regression candidate. Experimental ffcbb94 reduces direct partition lookup to one bounds check with address-boundary parity tests. Testing on a separate branch to preserve the #452 dependency stack; not yet integrated.

Repeated Standard control (2026-12-05)

Eight-block switch-off/on comparison on the original 750e9b7 head: invalidation −92.07%, dense index −99.68%, sparse index −78.81%, empty overlap −91.71%, with identical output digests. Index churn +12.69% reproduces the previous +12.31%; index iteration +8.45% is an additional regression candidate. Gate contention +0.85% is inconclusive (same gate implementation in both arms); earlier +4.76% is not reproduced. The separate ffcbb94 repair comparison is still pending. Raw CI. CPU microbenchmarks, not gameplay FPS.

Index regression follow-up (2026-12-05)

Workload Original indexed vs flat (750e9b7) First repair indexed vs flat (ffcbb94)
Index churn +12.69% +4.83%
Index iteration +8.45% +1.58% (no significant difference)
Phased churn +0.42% +0.26%
Scattered churn +0.76% −0.15%
Invalidation −92.07% −92.26%
Dense index −99.68% −99.77%

These are two separately paired 8-block comparisons, not a direct measurement of improvement across hosts. The direct original-index→first-repair comparison shows +2.17% churn, +9.56% phased churn and +7.34% scattered churn, so do not adopt that revision. Original control · First repair direct comparison · First repair flat control.

Second experimental revision e8e025d starts from the original PR head, isolates direct index insertions from cold layout transitions and overflow handling, and traverses direct and overflow shards separately. Added exact mutation/eviction/visit parity test. New three-way paired + native audit. Neither repair is merged into this PR or #452 pending regression-free evidence.

Second index repair results (e8e025d)

All four audit jobs completed successfully. Correctness tests pass, but the performance gate remains open. Against the original indexed revision, churn −8.98%, phased churn −14.28%, scattered churn −15.98%, iteration −2.79%; dense aliased refill +2.01% (reported regression). Against the original flat revision, churn +3.66%, invalidation −92.22%, dense −99.69%. The same-revision flat/index control instead reports churn +16.30%, iteration −1.72%, invalidation −92.72%, dense −99.78%. Do not combine independent hosts' ratios or adopt the repair as regression-free. Audit. Both experimental revisions remain separate from #429/#452.

Third compact-index repair results (4fbc8c9)

Completed audit: all 5 jobs passed, including 17/17 native tests in debug and release. Four independent 8-block ABBA comparisons, identical correctness digests.

Workload Original indexed → compact Original flat → compact Compact flat → compact indexed Previous indexed → compact
Index churn −4.43% +7.03% +18.51% +1.17%
Index iteration −1.65% +6.84% +4.66% −0.43%
Dense refill −18.21% −87.07% −87.36% −6.15%
Empty overlap −17.59% −93.14% −93.06% −13.05%
Invalidation −5.05% −92.48% −92.32% −1.91%
Dense aliased +2.03% −80.45% −81.76% −0.79%
Phased churn −10.84% −11.09% +0.46% +4.01%
Scattered churn −11.19% −11.13% +0.26% +3.77%

The same-head churn and iteration regressions remain; phased/scattered churn also regress against the preceding experimental candidate. A +6.42% gate contention result in the original-flat comparison is a same-code control and does not reproduce in the compact same-head comparison (−0.17%, inconclusive). Do not combine independent host ratios or integrate as regression-free. Current PR and #452 heads remain unchanged. CPU microbenchmarks, not gameplay or physical GPU timings.

Fourth repair — current head 2eb4706 (2026-12-05)

Eight-job Standard/native audit passed. 18/18 native tests in debug and release; 72 composite-key cases exact. Direct partitions use seeded integer hashing; flat and overflow maps retain their original hashing. Same-head off/on, eight paired blocks:

Workload CPU time change
Index churn −44.63%
Index iteration +0.33% (not significant)
Dense index −99.74%
Dense refill −89.15%
Empty overlap −93.08%
RT invalidation −92.70%
Sparse index −78.73%
Dense aliased −81.80%
Contended gate −0.37% (not significant)
Phased churn −0.55%
Scattered churn +0.26% (not significant)

Identical correctness digests. Direct comparison with the third indexed candidate: churn −50.35%, refill −20.54%, iteration +2.95% (~0.6 µs per synthetic sweep). The fifth folded traversal candidate was rejected because iteration regressed +5.09% against its own flat control. Explicit registry maintenance visits are conditional, with 250 ms scan intervals; their microbenchmark cost is not a measured frame-time regression. Fourth repair is now published here; #452 integration is being independently tested on this audit. No gameplay or hardware RT performance claim. Prerequisite/merge restrictions remain unchanged.

**@⁠tommiehansen** on GitHub · 2026-12-04 02:22 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429) `tommiehansen:perf/rt-freed-gathered` → `main` · +25675 −90 · 34 files · 38 commits · open > **Stacked PR — ready for review and community testing, not independent merge.** Do not merge before LOCKhart07's replacement HWRT stages 1–7 (starting with #468) have landed and the isolated change has been reconciled and revalidated against main. The main-based diff includes borrowed prerequisite commits. See the isolated review diff and outstanding checks below. ## Final Standard benchmark — latest HWRT foundation (2026-12-05) [CI: all 6 jobs passed](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47526488261) · head `b07015e` · LOCKhart07 `rt-7-reuse @ 621120b` · [paired CPU Standard](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47526488261/job/145694064518), eight ABBA blocks. | Workload | Baseline (ms) | Candidate (ms) | Time change | |---|---:|---:|---:| | RT invalidation | 5.179 | 0.378 | **−92.73%** | | Index churn | 0.008 | 0.004 | **−44.65%** | | Sparse invalidation | 0.100 | 0.021 | **−78.75%** | | Dense aliased | | | **−81.83%** | | Dense refill | | | **−89.20%** | | Empty overlap | | | **−93.04%** | | Iteration | 0.016 | 0.015 | −0.35%, inconclusive | | Contended gate | | | −0.99%, inconclusive | | Pending gate | | | +1.35%, inconclusive | All correctness digests identical. Native debug and release: 18/18 tests each. Shader checks passed. The [foundation-only control](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47526488261/job/145694064558) found no significant regressions. #452 also passed its paired and native remap tests on this stack. The previous churn regression is resolved; marginal gate changes are inconclusive. Absolute costs above are per synthetic workload, not per gameplay frame. [Isolated current comparison](https://github.com/tommiehansen/VIctory-xmem/compare/621120b...b07015e). Still stacked: do not merge independently. Physical AMD gameplay timing remains unverified for this exact revision. ## Historical Standard benchmark — 2026-12-05 [Reproducible CI result](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47503640056/job/145622974701) · head `750e9b7441ec` · Linux hosted CPU-only, Standard, four ABBA blocks (8 runs per arm). | Workload | Baseline (ms) | Candidate (ms) | Time change | Verification | |---|---:|---:|---:|---| | RT invalidation | 3.470 | 0.247 | **−93.38%** | Identical | | Dense aliased index | 0.073 | 0.017 | **−77.17%** | Identical | | Empty overlap | 0.435 | 0.033 | **−92.43%** | Identical | | Index churn | 0.011 | 0.012 | +12.31% | Regression | | Contended gate | 0.233 | 0.242 | +4.76% | Regression | Same head; `VICTORY_HW_RT_FREED_GATHERED` and `VICTORY_HW_RT_FREED_INDEX` both 0 → 1. Dense and invalidation cases improve substantially, but churn and gate contention need attention. No hardware RT timing. Negative values indicate reduced CPU time. Synthetic workloads, not gameplay FPS. --- ## Needs merged first - [ ] #468 - [ ] Remaining replacement HWRT stages 2–7 (upstream PR numbers not yet published; pinned `rt-7-reuse @ c3a0500`). Strip borrowed commits and rebase onto main before merge. ## What this does batch structure invalidation and adapt address indexing. ## Checks - [ ] Off-by-default and main parity: Parent `VICTORY_HW_RT` is opt-in; both sub-controls default on within HWRT. Verify disabled-path equivalence against landed foundation and decide sub-control defaults before merge. - [ ] Docs move with code: Both controls are documented; reconcile menu/defaults after prerequisite stack lands. - [ ] No unrelated cleanup: Own invalidation/index change is isolated; main-based diff contains borrowed HWRT foundation. - [ ] A test must exercise the change: 16 portable tests at pinned integration; `joined_eviction_matches_single_spans_on_randomized_registries` and index boundary tests. Rerun after dependency rebase; fail-before evidence pending. - [x] Queue checked on 2026-12-04: Follows replacement HWRT stack beginning at #468; #452 follows this. Replaces old #342-based integration. - [ ] Run `cargo xtask policy` on the final revision; no new game assets or build output intended. ## Verified Current review head: `2eb4706ec25c43ee41dacc263146de018ed82def`. Existing measurements and commands are retained below at their original revisions. No fresh compile, policy or hardware test is claimed by this metadata review. ## Cost Synthetic CPU invalidation −89.94%; previous insertion regression +46.22% on old revision, current GPU and gameplay effect unknown. --- ## Detailed implementation and historical validation ## Current integration — proposed HWRT stage 8 **The updated implementation targets LOCKhart07's replacement HWRT stack starting at #468, not the retired integration plan in #342.** | | Revision | | --- | --- | | New foundation | [`rt-7-reuse @ c3a0500`](https://github.com/LOCKhart07/VIctory-xmem/tree/c3a0500cd519885aa1ff71ee6a91641cc1fbb25f) | | Updated optimization | [`codex/rt-8-freed-integration @ 750e9b7`](https://github.com/tommiehansen/VIctory-xmem/tree/750e9b7441eceda2c54409e409d03c9ee7d5e7c6) | | Review | **[Isolated diff: 4 files, +1,320 / −71](https://github.com/tommiehansen/VIctory-xmem/compare/c3a0500cd519885aa1ff71ee6a91641cc1fbb25f...750e9b7441eceda2c54409e409d03c9ee7d5e7c6)** | **Historical integration head: `750e9b7`; current head: `2eb4706`.** The previous implementation (`bb184d8`) is preserved in [an archive branch](https://github.com/tommiehansen/VIctory-xmem/tree/archive/rt-freed-gathered-bb184d8). Review the isolated diff above: GitHub's main-based diff includes the prerequisite HWRT stack until it lands. [LOCKhart07 agreed to the proposed order](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/429): `rt-7-reuse` → #429 → #452. #452 is now integrated directly on this PR (benchmarked revision `455dfdb`, current diagnostic follow-up `c8edd2f`). This is coordination with the stack author, not maintainer merge approval. The foundation is pinned to `c3a0500`; later shader-cache fixes in the upstream stack have not been included in this benchmarked revision. ## Why this matters Each guest page free can scan the RT registry, decoded and validated index caches, and the submission ledger. During world streaming, repeated frees and build-overlap queries can make this expensive. - **Batched frees:** join overlapping and adjacent half-open ranges within a serialized mapping group, reducing repeated registry scans. Isolated frees retain the single-range path. - **Adaptive address index:** retain a flat hash table for dispersed workloads; clustered addresses can use direct 16 MiB partitions across two adjacent 256 MiB bands. Fully covered partitions can be drained in bulk, while sparse operations skip unrelated keys. - **Synchronization:** an atomic activity gate avoids taking the free-queue mutex when no batch is pending. Observers flush pending frees before accessing affected state; earlier submissions retain their ordered ledger view. The updated integration preserves the replacement stack's lease-aging policy, overwrite reclamation and named diagnostics. `reuse_step` is a flush boundary, and registry, named and reuse invalidation use matching half-open ranges. BLAS removals advance the remap generation. ### Controls Both optimizations default to enabled when `VICTORY_HW_RT=1` is requested. They can be disabled independently: | Variable | Disable | | --- | --- | | `VICTORY_HW_RT_FREED_GATHERED` | `0` | | `VICTORY_HW_RT_FREED_INDEX` | `0` | ## Latest benchmark — replacement stack (`750e9b7`) Apple M5, CPU-only, Benchmark Suite #322, Standard, four paired A/B/B/A blocks. Both controls off vs both on at the same integrated revision. | Workload | Both off | Both on | Paired change | | --- | ---: | ---: | ---: | | Invalidation | 1,959.459 µs | 201.292 µs | **−89.94%** | | Dense eviction + refill | 66.459 µs | 10.291 µs | **−83.70%** | | Disjoint dense ranges | 129.521 µs | 126.876 µs | −2.05% | | Phased churn | 6.375 µs | 6.334 µs | −0.49% (not significant) | | Scattered churn | 6.417 µs | 6.375 µs | −0.48% (inconclusive) | All listed correctness digests matched. The invalidation fixture saves approximately 1.76 ms of CPU time per synthetic sample; this is not a measured per-frame saving. The direct comparison against `c3a0500` cannot run a common production freed workload because the foundation lacks the planner module. These results isolate the controls, not whole application builds. Run from a checkout of the Benchmark Suite (#322), not the game PR branch itself. The command records the comparison used for the reported results. ```sh ./tools/benchmark-suite/run compare 750e9b7 750e9b7 --cpu-only --suite raytracing --profile standard --blocks 4 \ --base-env VICTORY_HW_RT_FREED_GATHERED=0 --base-env VICTORY_HW_RT_FREED_INDEX=0 \ --cand-env VICTORY_HW_RT_FREED_GATHERED=1 --cand-env VICTORY_HW_RT_FREED_INDEX=1 \ --out local/benchmarks/rt8-integration/toggle ``` ## Previous gameplay evidence [An RX 7900 XTX Linux tester](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/429) reported approximately **15–25 → 25–40 FPS while driving** after adding the earlier #429 implementation to #374. This was a qualitative report, not a controlled benchmark, and does not establish FPS gains for the new integration. Exact graphics settings and the tested #429 revision were not reported. ## Verification and limitations - Updated integration: 16 portable freed-module tests passed, including randomized differential and concurrent observer tests. - Windows MSVC-target checks for `victory-gpu` and `victory-hle` with tests passed using the local check-only allocator shim. - [Earlier independent native Windows review](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/429) reported approximately 90,000 differential comparisons without mismatch using the earlier production data structures with a single-threaded test copy of the integration glue. This was not a live GPU test. Its empty-queue synchronization and diagnostic feedback were addressed in subsequent revisions and retained in this integration. - Earlier Full-profile testing at `bb184d8` found a clustered insertion/replacement regression of 5.209 → 7.667 µs (+46.22%). That result is historical and has not been remeasured on the replacement stack. - Native GPU execution, real workload distribution, live resource retirement and gameplay performance of `750e9b7` remain unverified. [Historical benchmark details and reproduction commands](https://github.com/tommiehansen/VIctory-xmem/blob/3efbed0/tools/benchmark-suite/PROGRESS.md#429-default-on-layout-and-regression-checks). ## Community testing welcome Tests from **all compatible AMD GPUs (RDNA 2–4)** and other compatible hardware are welcome. Use the PR head (`2eb4706`), set `VICTORY_HW_RT=1`, and keep all other HWRT switches and graphics settings fixed. Baseline: `VICTORY_HW_RT_FREED_GATHERED=0 VICTORY_HW_RT_FREED_INDEX=0`; candidate: set both to `1`. Separate batching/index tests are also useful. Prefer native resolution, no frame generation or upscaling, warmed caches and repeated A/B/B/A runs. Other configurations are welcome if settings remain consistent. Report GPU/driver, revision, graphics settings, average FPS, 1% lows, frame times, memory usage, RT loss counters and any visual or stability issues. Positive, neutral and negative results are equally useful. Credit: batching adapted from [Darner's range-collection implementation](https://github.com/tyr0nsur/Darner/commit/775a0c7f36adfa2049820fc540a9d98fb632e7f4); HWRT foundation by @⁠LOCKhart07. ### Regression audit follow-up The +4.76% contended gate row compared `750e9b7` against itself with two feature switches toggled. Raw reports show the same `atomic` Gate on both sides; gate_benches does not read those switches. Therefore that result is a same-code noise/control measurement, not an established switch-induced regression (repeat control pending). Index churn +12.31% (CI +11.17% to +13.46%) is a genuine measured microbenchmark regression candidate. Experimental `ffcbb94` reduces direct partition lookup to one bounds check with address-boundary parity tests. Testing on a separate branch to preserve the #452 dependency stack; not yet integrated. ### Repeated Standard control (2026-12-05) Eight-block switch-off/on comparison on the original `750e9b7` head: invalidation −92.07%, dense index −99.68%, sparse index −78.81%, empty overlap −91.71%, with identical output digests. Index churn +12.69% reproduces the previous +12.31%; index iteration +8.45% is an additional regression candidate. Gate contention +0.85% is inconclusive (same gate implementation in both arms); earlier +4.76% is not reproduced. The separate `ffcbb94` repair comparison is still pending. [Raw CI](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47517950486/job/145667598026). CPU microbenchmarks, not gameplay FPS. ### Index regression follow-up (2026-12-05) | Workload | Original indexed vs flat (`750e9b7`) | First repair indexed vs flat (`ffcbb94`) | |---|---:|---:| | Index churn | +12.69% | +4.83% | | Index iteration | +8.45% | +1.58% (no significant difference) | | Phased churn | +0.42% | +0.26% | | Scattered churn | +0.76% | −0.15% | | Invalidation | −92.07% | −92.26% | | Dense index | −99.68% | −99.77% | These are two separately paired 8-block comparisons, not a direct measurement of improvement across hosts. The direct original-index→first-repair comparison shows +2.17% churn, +9.56% phased churn and +7.34% scattered churn, so do not adopt that revision. [Original control](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47517950486/job/145667598026) · [First repair direct comparison](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47517950486/job/145667598004) · [First repair flat control](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47517950486/job/145667597985). Second experimental revision `e8e025d` starts from the original PR head, isolates direct index insertions from cold layout transitions and overflow handling, and traverses direct and overflow shards separately. Added exact mutation/eviction/visit parity test. [New three-way paired + native audit](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47518839487). Neither repair is merged into this PR or #452 pending regression-free evidence. ### Second index repair results (e8e025d) All four audit jobs completed successfully. Correctness tests pass, but the performance gate remains open. Against the original indexed revision, churn −8.98%, phased churn −14.28%, scattered churn −15.98%, iteration −2.79%; dense aliased refill +2.01% (reported regression). Against the original flat revision, churn +3.66%, invalidation −92.22%, dense −99.69%. The same-revision flat/index control instead reports churn +16.30%, iteration −1.72%, invalidation −92.72%, dense −99.78%. Do not combine independent hosts' ratios or adopt the repair as regression-free. [Audit](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47518839487). Both experimental revisions remain separate from #429/#452. ### Third compact-index repair results (`4fbc8c9`) [Completed audit](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47521053601): all 5 jobs passed, including 17/17 native tests in debug and release. Four independent 8-block ABBA comparisons, identical correctness digests. | Workload | Original indexed → compact | Original flat → compact | Compact flat → compact indexed | Previous indexed → compact | |---|---:|---:|---:|---:| | Index churn | −4.43% | +7.03% | +18.51% | +1.17% | | Index iteration | −1.65% | +6.84% | +4.66% | −0.43% | | Dense refill | −18.21% | −87.07% | −87.36% | −6.15% | | Empty overlap | −17.59% | −93.14% | −93.06% | −13.05% | | Invalidation | −5.05% | −92.48% | −92.32% | −1.91% | | Dense aliased | +2.03% | −80.45% | −81.76% | −0.79% | | Phased churn | −10.84% | −11.09% | +0.46% | +4.01% | | Scattered churn | −11.19% | −11.13% | +0.26% | +3.77% | The same-head churn and iteration regressions remain; phased/scattered churn also regress against the preceding experimental candidate. A +6.42% gate contention result in the original-flat comparison is a same-code control and does not reproduce in the compact same-head comparison (−0.17%, inconclusive). Do not combine independent host ratios or integrate as regression-free. Current PR and #452 heads remain unchanged. CPU microbenchmarks, not gameplay or physical GPU timings. ### Fourth repair — current head `2eb4706` (2026-12-05) [Eight-job Standard/native audit](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47523266492) passed. 18/18 native tests in debug and release; [72 composite-key cases](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47523511681) exact. Direct partitions use seeded integer hashing; flat and overflow maps retain their original hashing. Same-head off/on, eight paired blocks: | Workload | CPU time change | |---|---:| | Index churn | −44.63% | | Index iteration | +0.33% (not significant) | | Dense index | −99.74% | | Dense refill | −89.15% | | Empty overlap | −93.08% | | RT invalidation | −92.70% | | Sparse index | −78.73% | | Dense aliased | −81.80% | | Contended gate | −0.37% (not significant) | | Phased churn | −0.55% | | Scattered churn | +0.26% (not significant) | Identical correctness digests. Direct comparison with the third indexed candidate: churn −50.35%, refill −20.54%, iteration +2.95% (~0.6 µs per synthetic sweep). The fifth folded traversal candidate was rejected because iteration regressed +5.09% against its own flat control. Explicit registry maintenance visits are conditional, with 250 ms scan intervals; their microbenchmark cost is not a measured frame-time regression. Fourth repair is now published here; #452 integration is being independently tested on [this audit](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47524529854). No gameplay or hardware RT performance claim. Prerequisite/merge restrictions remain unchanged.
The title's ray-tracing programs walk the console's structures in a loop
of their own. With VICTORY_HW_RT=1 the translator recognises each such
loop and writes a DXIL RayQuery in its place, keeping the title's own
hit tests, masks and ordering rules as the candidate and commit steps.
A loop it cannot prove equivalent stays as translated before.

Ported from VIctory-NVIDIA PR #3706 (GPL-3.0), with the lifter's
exactness rules of dakisback2/VIctory-Nvidia-Linux (85b0b11b, 5485daf7)
by way of Leslie-d-a/VIctory-NVIDIA-HWRT; see the header of
emit/rayquery.rs.

New here: the 14 loops those leave unlifted (6 programs, given a forced
miss there). The console compiler reuses three registers as loop scratch
on the lanes that run the loop and reads their old values on the lanes
that do not; the lane sets pass through mask joins the lifter could not
relate. Joins whose inputs are all one mask now collapse to it, and the
reading lanes are refuted against the loop's entry lanes by an exact
search (Bools::sat_with; out of budget refuses). All 64 ray-tracing
programs and their 397 loops lift and pass the DXIL validator.

Two fixes on the way, with the switch off too (translator version up):
the sign of zero in v_mad_legacy, and partial stores through a counter
view. Apart from those, the output with the switch off is unchanged.

`victory translate` names an emit panic per program and prints a
ray-tracing summary. A run refuses the switch until the host side is in.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The host side of the lifted ray queries. Started from VIctory-NVIDIA
PR #3706 (GPL-3.0) as ported to RADV by
MJ26gaming/victory-rdna4-linux-rt-MJ26 365fad515; see the header of
hwrt.rs for what was taken and what was left out.

The title's structure builder keeps running (a tap, not a replacement):
its build, refit and copy calls are passed on, and the same triangles
and instances go into host bottom- and top-level structures that the
lifted programs trace.

- Inputs follow the console builder's rules: only a NaN in X makes a
  triangle inactive; infinite and far positions pass through; indices
  and meshlets past the stated counts read the title's real bytes.
  Every departure is counted by what it changed, and bytes that cannot
  be read are a counted loss, never a silent zero.
- No budget evicts a structure and no instance is masked.
- Host work is recorded in the title's lists at the title's call, and a
  ledger keeps it in the card's order. Structures that are not refit
  are compacted exactly.
- Loss counters are printed with the frame-rate lines; all 0 over the
  check runs.
- VICTORY_RT_STAMPS=rt (diagnostics) stamps only the ray-tracing
  dispatches and the host builds. Over two 5 minute runs in the same
  place: trace passes 5.4 ms a frame as translated loops, 0.9 ms as
  ray queries, plus 0.5 ms for the host builds.
- A run takes VICTORY_HW_RT=1. Not yet checked hit for hit against the
  console's own walk on a captured frame.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
In free play the host structures grew past 7 GB in a few minutes and
kept growing. Measured by what each buffer holds, almost all of it was
structures kept at the driver's largest size:

- An updatable structure costs about four times a compacted one's bytes
  a triangle on RADV (its refit needs a fixed leaf region), and the
  title allows updates of many structures it never updates, or updates
  once. A structure is now built without ALLOW_UPDATE on the host, and
  becomes updatable only when the title updates it again within a
  second of its last update; an update short of that is built in full,
  the same triangles.
- Every structure built without ALLOW_UPDATE is compacted by the host
  once built, through the tickets the title's own COMPACT copies use:
  rehydrates (ready-made on the console, never copied by the title) and
  the title's builds it does not copy.
- Structures the title builds over are dropped: the builder's own
  prebuild sizes are tapped, and a structure kept at an address inside
  the bytes a new build was given goes, as with freed title memory.

The report says where the bytes are: alive by what they hold, in the
tap's map or outside it, updatable ones by their last update and by
how many updates they had, the host's own cost (buffers made,
compaction points), and the console's bytes next to the host's where
the console's are known. An event the card's order refuses is logged
with what the ledger held there.

Over a 3 minute drive: 7.3 GB and growing before; steady between 2.1
and 2.5 GB after, every loss counter 0.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
With hardware ray tracing nothing of ours reads what the title's
structure builder writes: every traversal loop is a ray query on the
host's structures, and those are built from the title's inputs. The
title reads one result of it: the compacted size a build is asked for,
which is the node count of the tree that build made, read back a frame
or two later to size the copy. No other program can give that number.

With the switch (only with VICTORY_HW_RT=1) each request of a tapped
call is kept or skipped:

- A bottom-level build that carries postbuild descriptions is kept:
  the builder runs it as ever and the title reads its own size. A copy
  of a structure a kept build made is kept too.
- Every other build, update, top-level build, rehydrate and copy is
  skipped. The title's export is still called, so its checks and
  results stay its own, between two marks in the list: the builder's
  dispatches recorded between them are dropped when the list is
  translated, before anything is bound. A batch is given to the export
  as runs, in its order.
- A request that asks a size and cannot be kept (a top-level build, an
  update of a structure no kept build made) is skipped, counted and
  logged as an error. None was seen.

The builder's stages run all or none, so whole calls are kept or
skipped, and a kept stage reads only what a kept one wrote.

A report line counts requests kept, skipped by kind, copies, losses
and dispatches dropped; an error is logged if a dispatch reads title
memory by address while the switch is on (a program not lifted).

By the builder's own stamps, standing still: 2.05 ms of card time a
frame before, 0.1 ms with the switch (98 dispatches dropped a frame).
Driving: 1.4 ms mean. Losses 0 in both, every hardware ray-tracing
loss counter 0.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Four files of the shader crate conflicted with #283, which fixed the same two things another way:

- legacy_fmad's zero addend: kept this branch's form, worked on the bits (-0 gives +0, and a NaN addend comes out quieted as the console's arithmetic gives it); main's comparison against zero covers the sign alone.
- the joined mask and number test, the image store test and the container hash test: kept this branch's, which check more (a full and a partial wave, every channel mask against the store of one, the validator's hash).

TRANSLATOR_VERSION 14: main's 13 is the legacy multiply, and this branch changes the legacy mad's NaN and partial stores through a counter view with the switch off.

Shader crate tests: 412 passed, 0 failed. The gpu crate's hardware ray-tracing tests: 43 passed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Every submission in flight made an upload buffer of its own for what it sends up, sized to what was asked, and kept it until the submission was done. A buffer given back was used again only by a request of the same size, so most were made new: about 570 MB of them stood on the card at the end of a six minute run.

Now a buffer is made at the next power of two (64 KiB at least) and, once its submission is done, kept spare for the next request of that size. Spare buffers not taken for 10 s are let go, and so is what passes 768 MB of spare; both go through host::retire, as other memory the card may still read.

Measured on an RX 9070 XT (RADV), 2560x1440, six minutes with the camera turning, hardware ray tracing on: 3 buffers alive (0.9 MB), 6 made in the whole run, 3 let go by the trim, none for the cap. Three runs, no error line, no device loss.

Two report lines say it: what submissions send up (alive, in flight, spare, made, let go), and the host's buffers by who makes them.

Tests: host::send, 6 passed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Every host bottom-level structure was a committed buffer of its own: 73,703 buffers made in 6.9 s of one play (the longest 73 ms), and 363 MB lost to their 64 KiB placement.

Now they are cut from 64 MiB blocks at 4 KiB (VICTORY_HW_RT_ARENA, on by default; =0 gives every structure its own buffer as before). Two sets of blocks, by how long a structure lives: one for those built in full and not updatable, which are compacted or replaced soon and go; one for updatable, copied and compacted ones, which stay. Mixed in one set, the short-lived left holes among the long-lived and no block ever emptied: 1,664 MB of blocks for 888 MB of structures. A piece is given back when the structure is dropped, which host::retire already does only after the lists that used it, so it rests no further and is free at once. Top-level structures keep their own buffers.

Measured on an RX 9070 XT (RADV), 2560x1440, six minutes with the camera turning: 32 structure buffers made in 11 ms (the longest 5 ms); 20 blocks (1,280 MB) for 1,023 MB of structures, nothing resting, 6 of the short-lived set's blocks made and 4 given back. Three runs, all loss counters 0, no error line. The gain is in the buffers no longer made; the bytes are about what the buffers took (a different scene from the 363 MB above, so not a pair).

Report lines with it, which the next changes are read from:
- the blocks of structures of each set (alive, held, resting, free, made, given back);
- the build memory (scratch, instances and sanitised copies): what lists hold now, asked for against handed out, buffers made and how long that took, the spare by size and how much of it was not taken lately;
- texture blocks by the tenth of them textures hold, their free space, and the textures' copy footprints against the pieces they lie in (what the pieces' rounding costs);
- the texture queue's slots held back for want of room on the card.

Tests: pool 13 passed, hwrt 47 passed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Every texture cut from a texture block was asked at 64 KiB, so each took a multiple of 64 KiB. Most of the title's textures are small: their copy footprints came to 1,599 MB in 2,760 MB of pieces, 1,161 MB of rounding.

Now a texture is asked with D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT where the host says it has it (D3D12_FEATURE_D3D12_TIGHT_ALIGNMENT, tier 1 or more), and its piece is the size at the alignment the host answers: 4 KiB multiples for a small one (256 bytes for the smallest), 64 KiB as before for a large one. The host is asked once and the texture is made with the description the size was asked for. A host without the tier is asked as before.

The earlier 4 KiB placement (VICTORY_POOL_SMALL, removed after two device losses on 2026-11-25) asked at 4 KiB and, refused, asked again at 0; the flag is never refused. What those losses were was not proven. The new test places 11 kinds of small texture three times over back to back from 0x6000 into a heap (the kind and place of those losses first), in each of the three ways of asking, writes every level with bytes of its own, reads them back by a copy and then by a shader through a view of the whole chain and one of each level, and compares with the same texture on a 64 KiB multiple: 500 reads compared, none differ, on an RX 9070 XT (RADV), where the driver lays such textures out at 4 KiB (so nothing is padded).

Measured there, 2560x1440, six minutes with the camera turning, against the run before it (not a pair: the scene streams): rounding 1,161 MB -> 108 MB (2,014 MB of footprints in 2,123 MB of pieces); texture blocks 64 -> 56; slots held back for want of room on the card 152 -> 0; host copies let go for room 6,495 MB -> 3,359 MB; card in use 13,326 -> 13,020 MB with 415 MB more of texture loaded. No error line, no device loss, the picture looked right.

Tests: pool 14 passed (the new one among them), resource 16, texture 11.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A structure the title updates twice within a second is built with ALLOW_UPDATE from then on and stays so for good. Much of what earns that is updated for a while and then left alone (it is still read by the top level). On RADV an updatable structure keeps a fixed layout of about 177 bytes a triangle that compaction cannot shrink, against about 46 for a compacted one, so the idle ones hold most of the structure memory they do not need.

With the switch on:

- A build of an updatable structure keeps its inputs (the staged vertex, index and transform pieces and the geometry descriptions) with the structure, in pieces of its own. Inputs under 256 KiB, inputs decoded or staged in place, boxes and copies are not kept, and such a structure is left as it is.
- At the card point at the start of a submission, every 250 ms, structures not updated and not read as a refit source for 10 s are built again from the kept inputs without ALLOW_UPDATE, at most 16 MiB of them a pass, and then compacted by the path that exists. The swap is an event in card order like a compaction, so reads and copies tapped before it see the old structure and those after it the new one.
- An update of such a structure is never a refit: it is a full build, and the existing rule makes it updatable again if the title keeps updating it. The wait before it is put to sleep again doubles each time, up to 80 s.
- The old structure, its inputs and the scratch are let go only after the submissions that may use them are done, as elsewhere.

The kept inputs come from a pool of their own. Sharing the build pool made it overflow its 256 MB of spare pieces every frame (39,166 buffers made in five minutes); with their own pool none are let go past the bound.

This also changes the pool of build pieces itself, switch or no switch: a spare piece is picked by how lately it was used and one idle for 10 s is let go. That part alone was not shown to gain anything in play.

Measured on an RX 9070 XT (RADV, Mesa 26.3.1), 2560x1440, nine minutes of driving, one run: 448 structures put to sleep, 444 of them compacted, 1,695 MB -> 455 MB; none failed; 25 were updated afterwards and 24 became updatable again; inputs held at the end 129 MB; the card points took 387 ms in all, the longest 10.8 ms; 120 idle updatable structures left (25 MB: small ones and one staged in place). No error line, no device loss, every loss counter 0, the picture looked as before.

What it does not do: the freed bytes stay inside the 64 MiB structure blocks until a block empties (1,487 MB free in 49 blocks at the end), and the card still fills, because compacted structures nothing names any more are never let go. Buffers made for builds are more than without the switch (about 2,300 a minute against about 600), though the longest wait for one was shorter (57 ms against 203 ms). Other drivers and cards were not tried.

Tests: hwrt 57 passed (the verdict table, the swap at the card point, refits and copies tapped before the swap, an update after it not a refit, what is kept, the pick and the wait, the pool of kept pieces).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Long-lived bottom-level structures share 64 MiB blocks, and a block goes back to the card only when nothing is left in it. When compaction, or the rebuild of idle updatable structures, shrinks what the blocks hold, the survivors stay spread over all of them: at the end of one nine-minute play 49 blocks (3,136 MB) held 1,648 MB, and none had emptied in the last four minutes. The holes are used again by later structures, so this is a high-water mark rather than fragmentation, but the card does not get the memory back.

With the switch on:

- Updatable structures are cut from blocks of their own. They are never moved, and so no longer pin a block of the others.
- At the card point at the start of a submission, every 250 ms, while more than a quarter of the long-lived blocks' bytes is free (four blocks' worth at least), the emptiest blocks are marked to be emptied, as many as the free bytes of the rest can take with 128 MB to spare. Nothing new is cut from a marked block while another has room.
- Structures in marked blocks are copied (a clone) into the fullest block that stays, at most 8 MB and 32 structures a card point, and put in their place in card order as a compaction is: reads and copies tapped before see the one moved from, those after the one moved into. A move never makes a block; no room is a skip, counted.
- A structure is moved only if the tap and the ledger agree on it, it is not updatable, no write of its address is tapped and not yet in card order, no compaction waits at its address, it is 10 s old, and it was not moved in the last 60 s (the ledger's alias names one structure back).
- The one moved from is let go only after the submissions that may use it are done, as elsewhere. A top-level structure built before the move keeps it until its next build.

With the switch off nothing is marked or moved and updatable structures stay where they were. Three things on shared paths change form but not result: the texture report's count of blocks cut from again is kept per pool, a structure piece is given back through a function that also looks for a mark (there is none), and a compacted structure is stamped with when it was made. The new report line prints with the switch off too.

Measured on an RX 9070 XT (RADV, Mesa 26.3.1), 2560x1440, one play of 36 minutes on my local tree (this change with a counting-only switch of mine also on): 31 blocks marked, 25 empty after moves and 3 by themselves, 17 given back to the card (1,088 MB); 4,080 structures moved (822 MB) in two bursts of about half a minute; the card points' part 238 ms in all, the longest 1.7 ms; no try found no room; the old places not yet free came to 210 MB at most. Every loss counter 0, the two of card order among them (a write after a newer one at the same address, a refit or copy whose source is not the one assumed).

That play ended in a device loss at minute 36, with the card and the memory shared with it both full and structures grown from 2.4 GB to 3.8 GB in the last quarter of an hour. The last move was 17 minutes before it and the blocks were 98% full by then. What caused it is not known, and this change does not stop that growth: it returns space that is free, no more.

Not tried: this branch itself in play (the diagnostics build compiles and its tests pass), other cards or drivers, the cost of the copies on the card (not measured; the bytes a card point moves are bounded).

Tests: hwrt 64 passed (7 new: the verdict table, the swap, a compaction waiting, copies tapped before a move and two moves back, the pick, the blocks of updatable ones, the count of blocks), pool 18 passed (4 new: the marking, the destination, the fallback, an emptied marked block).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings the lifted ray queries and host structures (VICTORY_HW_RT=1), the
structure blocks, the send-memory and texture-block changes, and the two
structure-memory switches (VICTORY_HW_RT_DEMOTE=1, VICTORY_HW_RT_PACK=1)
up to main. All of these switches stay off by default.

Two files conflicted:

- crates/victory-gpu/src/descriptor/host.rs, TextureQueue::scan. Main
  now walks only the due front of `by_due` and reads the kinds of slots
  from counts kept as slots change; this side had added, to the old walk
  of every slot, the count of slots held back for want of room on the
  card (QUEUE_HELD). Kept main's walk and counts, and put the held-back
  count before it: it walks `held` alone, not every slot.

- crates/victory-shader/src/lib.rs, TRANSLATOR_VERSION. Main went from
  13 to 19, this side from 13 to 14 for two fixes that change
  translations with the switches off (the sign of zero in
  v_mad_legacy, partial stores through a counter view). Both sets of
  changes are in, so the version is 20: translations cached by either
  side are made again.

Nothing else needed a change: the other files merged as they were, and
the 64 ray-tracing programs still lift whole on main's translator (397
of 397 loops, all 64 validated).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings VICTORY_HW_RT_LEAN_BUILDER=1 (off by default; only with
VICTORY_HW_RT=1): the title's structure builder runs only where the
title reads its result.

Nothing conflicted. The change to the work a title list runs at a place
of its own (it is now given the draw state too) merged with the
hardware ray-tracing operations recorded the same way, and the report
line is called from the hardware ray-tracing report as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Collect half-open ranges between hardware RT operations, merge adjacent or overlapping spans, and visit the tap and index caches once. Publish the batch at its tap sequence so earlier ledger calls still see their structures. Flush at RT observation boundaries and keep immediate single-range invalidation when the switch is off or an operation is active.

Adapted from Darner 775a0c7f36adfa2049820fc540a9d98fb632e7f4.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 02:27:53 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-04 02:34 UTC · original

Tested natively on Windows 11 (MSVC) with one NVIDIA desktop card plus WARP, looking only at a70bd85..7de401d.

  • The three new tests pass 10/10 in a loop. Full victory-gpu lib suite is 416 passed / 5 failed / 23 ignored here vs 413 / 5 / 23 on a70bd85, with the same five known local failures on both sides. hwrt runs 67 tests on the PR and 64 on the base, none ignored, but none of them create a device or the manager. So setting VICTORY_HW_RT=1 VICTORY_HW_RT_FREED_GATHERED=1 for the suite doesn't actually exercise the gathered path, it only shows nothing else changes. No new clippy warnings in victory-gpu or victory-hle.
  • I also ran a throwaway differential locally (not pushed). It drives the real Pending, Spans::joined, freed::invalidate and Ledger, but the glue around them (title_memory_freed, rt_activity, freed_gathered) is my single-threaded copy. Random frees, group open/close, RT ops and frees issued while an op is active, compared after every op against the immediate path (ledger map, registry keys, index cache keys, version moved or not). About 90k comparisons, no mismatch, and it fails immediately if I drop the flush on entry.

Reading the code I found no RT table access that isn't behind a guarded entry point, and next_seq is only taken inside a guard or in invalidate_freed, so one seq per batch gives the same ledger as one per free. Lock order and the flush under the mapping guard look fine to me, and drops of removed entries don't reach back into a guard.

Things worth a look

  • With the switch on, execute_op, tlas_gpu_va, tlas_for_descriptor and interlude_due all take the global FREES mutex every time, even with nothing pending. The benchmark only covers invalidation, so an atomic fast path for the empty case might be worth adding before frame times are compared.
  • The TLAS freed log line now prints the merged span rather than the range the title freed.
  • If #374 lands first, reuse_step has to become a flush boundary, as you noted.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-04 02:34 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7399091729) Tested natively on Windows 11 (MSVC) with one NVIDIA desktop card plus WARP, looking only at a70bd85..7de401d. - The three new tests pass 10/10 in a loop. Full victory-gpu lib suite is 416 passed / 5 failed / 23 ignored here vs 413 / 5 / 23 on a70bd85, with the same five known local failures on both sides. hwrt runs 67 tests on the PR and 64 on the base, none ignored, but none of them create a device or the manager. So setting VICTORY_HW_RT=1 VICTORY_HW_RT_FREED_GATHERED=1 for the suite doesn't actually exercise the gathered path, it only shows nothing else changes. No new clippy warnings in victory-gpu or victory-hle. - I also ran a throwaway differential locally (not pushed). It drives the real Pending, Spans::joined, freed::invalidate and Ledger, but the glue around them (title_memory_freed, rt_activity, freed_gathered) is my single-threaded copy. Random frees, group open/close, RT ops and frees issued while an op is active, compared after every op against the immediate path (ledger map, registry keys, index cache keys, version moved or not). About 90k comparisons, no mismatch, and it fails immediately if I drop the flush on entry. Reading the code I found no RT table access that isn't behind a guarded entry point, and next_seq is only taken inside a guard or in invalidate_freed, so one seq per batch gives the same ledger as one per free. Lock order and the flush under the mapping guard look fine to me, and drops of removed entries don't reach back into a guard. Things worth a look - With the switch on, execute_op, tlas_gpu_va, tlas_for_descriptor and interlude_due all take the global FREES mutex every time, even with nothing pending. The benchmark only covers invalidation, so an atomic fast path for the empty case might be worth adding before frame times are compared. - The TLAS freed log line now prints the merged span rather than the range the title freed. - If #374 lands first, reuse_step has to become a flush boundary, as you noted. AI-assisted: yes
Track the key order of the four RT tables under their existing locks when explicitly enabled. Limit frees and build-overlap queries to matching guest addresses while keeping hash lookups for the translation path. Maintain the index only when inserting or removing a key and keep sequencing and retirement at their existing boundaries.
Fall back to a sequential hash sweep when range hits exceed the sparse removal budget. Trim the ordered index in one pass, using a tree split for an edge-aligned range. Keep the two structures consistent across partial sparse removals and fall back to hash-only lookups if the dense retirement callback unwinds.
Register RT activity and pending batches in one atomic state. Entering work waits for a published batch and mapping cannot collect into a batch while an RT operation is active. Preserve the first original notice for TLAS diagnostics and cover concurrent gate entry and nested work.
Keep sorted keys within address blocks and store singleton blocks inline. Dense frees discard fully covered buckets without comparing or removing individual index keys. Keep half-open boundary matching exact for composite keys and preserve the original hash table for hot lookups.
Publish the queue bit only for the first notice and use the queue mutex to order later appends with waiting entrants. Build a single span directly when notices form one growing interval, preserving original diagnostic order and falling back to sorted joining for fragmented batches.
Author
Owner

@⁠khift363 on GitHub · 2026-12-04 09:04 UTC · original

Did a dirty merge of this onto #374 and I've got to say, this is the biggest single improvement in FPS I've seen so far, especially while driving. Qualitative numbers, but, without this I get around 15 to 25 FPS while driving around, and with this I get 25 to 40 FPS. It's absolutely monstrous. Benefits slower scenes as well, but disproportionately helps driving. 7900 XTX on Linux.

**@⁠khift363** on GitHub · 2026-12-04 09:04 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7406799062) Did a dirty merge of this onto #374 and I've got to say, this is the biggest single improvement in FPS I've seen so far, especially while driving. Qualitative numbers, but, without this I get around 15 to 25 FPS while driving around, and with this I get 25 to 40 FPS. It's absolutely monstrous. Benefits slower scenes as well, but disproportionately helps driving. 7900 XTX on Linux.
Remove the secondary ordered key index. Use the guest block to choose a hash-table partition, find affected partitions with a bounded mask, and drain partitions covered by one free span without scanning unrelated entries. Preserve half-open matching where addresses collide in a partition.
Use fewer hash partitions to reduce the number of short walks on wide address ranges. Keep direct lookups bounds-check free and skip partition-mask construction for single-block overlap queries. Update range bounds only when an address is introduced.
Retain the direct hash partitions for the first address band and own more distant bands in a range-addressable table. Dense frees can drain complete bands instead of repeatedly filtering unrelated entries with the same partition slot. Keep adjacent and disjoint spans exact without revisiting any overflow band in the batch.
Use exact hash lookups for overflow bands to reduce scattered mutation costs. Probe small invalidation ranges directly and sweep only populated bands for wide ranges. Retire emptied hash partitions during the same sweep and keep direct-home lookup unchanged.
Select the representation while the table is small, using address locality to keep dispersed keys in a single hash table. Use a reserved adjacent band for workloads that grow continuously beyond their first band. Add a differential check that promotion preserves keys and dispersed tables stay flat.
Apply the same locality check beyond the direct bands. Keep a single hash table for dispersed spill and promote a concentrated band in place. Preserve half-open invalidation when a clustered table later acquires far-apart addresses.
Collapse a still-small registry when early overflow proves scattered. Keep whole-resource visits in the underlying table loops, and derive direct partition bounds from address bits instead of updating them on inserts.
Use the tested automatic layout when hardware RT is enabled, with independent zero-valued overrides for diagnosis. Preserve the registry borrow across bulk visitor calls so remap construction can retain references until it finishes.
Keep the same direct address band with fewer hash tables. This reduces whole-map iterator setup while limiting a local free to the covered portions of the band.
Classify address locality from a bounded sample already in the original hash table. Keep its exact allocation and hash state when the sample is dispersed. Use fewer direct partitions to reduce full traversal overhead further.
Extend the direct address window to two adjacent bands. Use the same offset lookup and fixed bounds in both bands, so additional clustered keys update no secondary state. Classify sparse address bands by exact identity and test the top-of-address-space boundary.
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 10:58 UTC · original

There is clearly real work here, and the hardware ray-tracing numbers are the kind of thing this project needs. I want to raise one thing before it gets further, because it is much cheaper to fix now than after a rebase.

The shape: 30 commits, 36 files, +22,818/−138. crates/victory-gpu/src/hwrt.rs alone is ~8,962 new lines, crates/victory-shader/src/emit/rayquery.rs ~8,269, pool.rs 1,190, hwrt/freed.rs 1,142, plus 409 lines of run.conf.default and the removal of ~300 lines of vehicle_notch. That is not one change with one risk; it is five or six subsystems in one review.

The two concrete problems that creates:

  • Nothing can be attributed. With the layers stacked, no reader can say which commit produced which part of the gain, and which parts are inert or useless on a given GPU. A reviewer cannot tell what to keep if a regression shows up, and a bisect lands on a 22k-line commit.
  • It is a rebase treadmill. It touches pool.rs, watch.rs, list.rs, queue.rs, host.rs — the files the rest of the queue is fixing. Every independent fix that lands conflicts with this branch, and every conflict is resolved inside a diff nobody can re-read.

A split that keeps the value and makes each piece reviewable, in dependency order:

  1. hardware RT structures + the VICTORY_HW_RT switch (off by default), with the structure tests
  2. the shader-side ray-query lowering (emit/rayquery.rs, structure.rs, lower.rs)
  3. pool/memory packing (pool.rs, memory.rs, host/send.rs)
  4. HLE xboxbvh and the loader-side changes
  5. the lean structure-builder switch
  6. docs and run.conf.default (a 409-line config diff deserves its own PR regardless)

Each of those is big enough to be interesting and small enough to be reviewed in one sitting, and each carries its own measurement. If the layers genuinely cannot be separated, that itself is worth saying up front — but from the commit list they look separable.

This project moves fast (about twenty merges in a day, ~85 open PRs). On that cadence the bottleneck is review throughput, not authoring speed, and a 22k-line PR consumes the former without producing the latter.

**@⁠Luxuride** on GitHub · 2026-12-04 10:58 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7409443430) There is clearly real work here, and the hardware ray-tracing numbers are the kind of thing this project needs. I want to raise one thing before it gets further, because it is much cheaper to fix now than after a rebase. The shape: 30 commits, 36 files, +22,818/−138. `crates/victory-gpu/src/hwrt.rs` alone is ~8,962 new lines, `crates/victory-shader/src/emit/rayquery.rs` ~8,269, `pool.rs` 1,190, `hwrt/freed.rs` 1,142, plus 409 lines of `run.conf.default` and the removal of ~300 lines of `vehicle_notch`. That is not one change with one risk; it is five or six subsystems in one review. The two concrete problems that creates: - **Nothing can be attributed.** With the layers stacked, no reader can say which commit produced which part of the gain, and which parts are inert or useless on a given GPU. A reviewer cannot tell what to keep if a regression shows up, and a bisect lands on a 22k-line commit. - **It is a rebase treadmill.** It touches `pool.rs`, `watch.rs`, `list.rs`, `queue.rs`, `host.rs` — the files the rest of the queue is fixing. Every independent fix that lands conflicts with this branch, and every conflict is resolved inside a diff nobody can re-read. A split that keeps the value and makes each piece reviewable, in dependency order: 1. hardware RT structures + the `VICTORY_HW_RT` switch (off by default), with the structure tests 2. the shader-side ray-query lowering (`emit/rayquery.rs`, `structure.rs`, `lower.rs`) 3. pool/memory packing (`pool.rs`, `memory.rs`, `host/send.rs`) 4. HLE `xboxbvh` and the loader-side changes 5. the lean structure-builder switch 6. docs and `run.conf.default` (a 409-line config diff deserves its own PR regardless) Each of those is big enough to be interesting and small enough to be reviewed in one sitting, and each carries its own measurement. If the layers genuinely cannot be separated, that itself is worth saying up front — but from the commit list they look separable. This project moves fast (about twenty merges in a day, ~85 open PRs). On that cadence the bottleneck is review throughput, not authoring speed, and a 22k-line PR consumes the former without producing the latter.
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 11:02 UTC · original

Since the question was how to split it, here is a concrete cut, taken from the diff itself (main…perf/rt-freed-gathered). Each line below is a review unit with its own risk, its own test, and — importantly — its own merge order.

# Title Files Size
1 gpu: pack the pool and memory paths for RT pool.rs, memory.rs, descriptor*.rs, list*.rs, queue.rs, watch.rs, host.rs, pipeline*.rs, shader_cache.rs, draw.rs (24 files) +2,597 / −484
2 loader, app: drop the dead notch and rumble paths vehicle_notch.rs, ps5_rumble.rs, apps/victory/src/{run,translate}.rs, loader (12 files) +115 / −592
3 docs, config: the hardware RT switches run.conf.default (409 lines), docs/SETTINGS.md, README.md +149 / −292
4 hle: the structure-builder entry points for hardware RT modules/{mod,xboxbvh,xmem}.rs (4 files) +491 / −13
5 hwrt: host structures for hardware ray tracing hwrt.rs (8,962), hwrt/freed.rs (1,142), host/rtstamps.rs +10,110
6 shader: lower the structure walks to hardware ray queries emit/rayquery.rs (8,269), emit/{lower,mod,shader}.rs, structure.rs, emit/rayquery_tests.rs, bitcode/opt.rs, emit/intersect_tests.rs, size_tests.rs, lib.rs (12 files) +9,673 / −614

Merge order and bases:

  • 1 and 2 first, based on main. They are the smallest, they are the ones the rest of the queue collides with (pool.rs, watch.rs, queue.rs, list.rs), and 2 is almost entirely deletions — cheap review, immediate conflict relief.
  • 3 next on main — config and docs only, and a 409-line run.conf.default diff is unreadable inside a 22k-line PR by construction.
  • 4 on main, then 5 based on 4, then 6 based on 5. The dependency is real: the shader lowering calls the structures 5 registers, and both are inert without the switch from 3.

Two things to watch when it is cut this way:

  • 5 is still 10k lines in three files, with hwrt.rs at ~9,000. On its own that is a legitimate PR — a new subsystem is allowed to be big — but it is only reviewable if the switch is off by default and the file reads as one thing, not three.
  • 6 is where the correctness argument lives (the guest's structure-walk to a real BLAS/ray query). It is the one that most needs a per-commit measurement, and the one where "the numbers are better" is weakest without one.

Nothing here needs history surgery: the commits are already in these groups, so it is nine git branch / git checkout <sha> -b calls and one gh pr create each, with --base pointing at the parent where the dependency is real.

**@⁠Luxuride** on GitHub · 2026-12-04 11:02 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7409539417) Since the question was how to split it, here is a concrete cut, taken from the diff itself (`main`…`perf/rt-freed-gathered`). Each line below is a review unit with its own risk, its own test, and — importantly — its own merge order. | # | Title | Files | Size | |---|---|---|---| | 1 | `gpu: pack the pool and memory paths for RT` | `pool.rs`, `memory.rs`, `descriptor*.rs`, `list*.rs`, `queue.rs`, `watch.rs`, `host.rs`, `pipeline*.rs`, `shader_cache.rs`, `draw.rs` (24 files) | +2,597 / −484 | | 2 | `loader, app: drop the dead notch and rumble paths` | `vehicle_notch.rs`, `ps5_rumble.rs`, `apps/victory/src/{run,translate}.rs`, `loader` (12 files) | +115 / −592 | | 3 | `docs, config: the hardware RT switches` | `run.conf.default` (409 lines), `docs/SETTINGS.md`, `README.md` | +149 / −292 | | 4 | `hle: the structure-builder entry points for hardware RT` | `modules/{mod,xboxbvh,xmem}.rs` (4 files) | +491 / −13 | | 5 | `hwrt: host structures for hardware ray tracing` | `hwrt.rs` (8,962), `hwrt/freed.rs` (1,142), `host/rtstamps.rs` | +10,110 | | 6 | `shader: lower the structure walks to hardware ray queries` | `emit/rayquery.rs` (8,269), `emit/{lower,mod,shader}.rs`, `structure.rs`, `emit/rayquery_tests.rs`, `bitcode/opt.rs`, `emit/intersect_tests.rs`, `size_tests.rs`, `lib.rs` (12 files) | +9,673 / −614 | Merge order and bases: - **1 and 2 first, based on `main`.** They are the smallest, they are the ones the rest of the queue collides with (`pool.rs`, `watch.rs`, `queue.rs`, `list.rs`), and 2 is almost entirely deletions — cheap review, immediate conflict relief. - **3 next** on `main` — config and docs only, and a 409-line `run.conf.default` diff is unreadable inside a 22k-line PR by construction. - **4 on `main`**, then **5 based on 4**, then **6 based on 5**. The dependency is real: the shader lowering calls the structures 5 registers, and both are inert without the switch from 3. Two things to watch when it is cut this way: - 5 is still 10k lines in three files, with `hwrt.rs` at ~9,000. On its own that is a legitimate PR — a new subsystem is allowed to be big — but it is only reviewable if the switch is off by default and the file reads as one thing, not three. - 6 is where the correctness argument lives (the guest's structure-walk to a real BLAS/ray query). It is the one that most needs a per-commit measurement, and the one where "the numbers are better" is weakest without one. Nothing here needs history surgery: the commits are already in these groups, so it is nine `git branch` / `git checkout <sha> -b` calls and one `gh pr create` each, with `--base` pointing at the parent where the dependency is real.
Author
Owner

@⁠tommiehansen on GitHub · 2026-12-04 11:17 UTC · original · edited 2026-12-04 15:46 UTC

@⁠Luxuride Thanks for taking the time to look at this. As explained in my reply on #452, #429 builds on @⁠LOCKhart07's hardware RT implementation in #342, which had not been merged when this comment was written. Most of the 22k-line diff is inherited from that dependency, rather than introduced by #429. Any decision to split #342 would primarily be for LOCKhart07 and the maintainer.

The performance results are already isolated for #429's own changes in the synthetic benchmarks. Additionally, @⁠khift363 reported roughly 15–25 to 25–40 FPS while driving on an RX 7900 XTX after adding #429 to #374. While qualitative rather than a controlled benchmark, that report specifically evaluates the added patch.

As the prerequisite stack lands, the apparent diff size should become much more representative of the actual optimization. I appreciate your feedback and agree that keeping the individual changes reviewable is important.

Update (Dec 4): #342 is superseded by the seven-stage stack starting at #468. #429 now points to 750e9b7 directly on pinned rt-7-reuse @ c3a0500; review only its four-file change. #452 follows at 455dfdb. LOCKhart07 agreed to that order. The earlier gameplay report is not validation of the replacement revision.

**@⁠tommiehansen** on GitHub · 2026-12-04 11:17 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7409897987) · edited 2026-12-04 15:46 UTC @⁠Luxuride Thanks for taking the time to look at this. As explained in my [reply on #452](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/452), #429 builds on @⁠LOCKhart07's hardware RT implementation in #342, which had not been merged when this comment was written. Most of the 22k-line diff is inherited from that dependency, rather than introduced by #429. Any decision to split #342 would primarily be for LOCKhart07 and the maintainer. The performance results are already isolated for #429's own changes in the synthetic benchmarks. Additionally, @⁠khift363 [reported](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/429) roughly 15–25 to 25–40 FPS while driving on an RX 7900 XTX after adding #429 to #374. While qualitative rather than a controlled benchmark, that report specifically evaluates the added patch. As the prerequisite stack lands, the apparent diff size should become much more representative of the actual optimization. I appreciate your feedback and agree that keeping the individual changes reviewable is important. **Update (Dec 4):** #342 is superseded by the seven-stage stack starting at #468. #429 now points to `750e9b7` directly on pinned `rt-7-reuse @ c3a0500`; [review only its four-file change](https://github.com/tommiehansen/VIctory-xmem/compare/c3a0500...750e9b7). #452 follows at `455dfdb`. LOCKhart07 [agreed to that order](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/429). The earlier gameplay report is not validation of the replacement revision.
Author
Owner

@⁠tommiehansen on GitHub · 2026-12-04 15:21 UTC · original · edited 2026-12-04 15:51 UTC

@⁠LOCKhart07, the isolated #429 follow-up to rt-7-reuse at c3a0500 is 750e9b7. It retains lease aging and your overwrite-reclamation diagnostics, and makes reuse_step a free-flush boundary. Windows-target compilation and 16 portable tests passed. Could we coordinate treating this as the next stage after #468’s stack, with #452 following for unmarked remap snapshots? The original implementation is preserved in archive/rt-freed-gathered-bb184d8.

Update: The actual #429 PR branch now points to 750e9b7, and #452 has been integrated directly above it at 455dfdb. Both PRs include isolated benchmark results. #452's current head is c8edd2f, with two diagnostic-only follow-ups to the benchmarked 455dfdb. Thanks for confirming the proposed order and keeping the upstream stack history stable.

**@⁠tommiehansen** on GitHub · 2026-12-04 15:21 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7415726799) · edited 2026-12-04 15:51 UTC @⁠LOCKhart07, the isolated #429 follow-up to `rt-7-reuse` at `c3a0500` is [`750e9b7`](https://github.com/tommiehansen/VIctory-xmem/commit/750e9b7441eceda2c54409e409d03c9ee7d5e7c6). It retains lease aging and your overwrite-reclamation diagnostics, and makes `reuse_step` a free-flush boundary. Windows-target compilation and 16 portable tests passed. Could we coordinate treating this as the next stage after #468’s stack, with #452 following for unmarked remap snapshots? The original implementation is preserved in `archive/rt-freed-gathered-bb184d8`. **Update:** The actual #429 PR branch now points to `750e9b7`, and #452 has been integrated directly above it at `455dfdb`. Both PRs include isolated benchmark results. #452's current head is `c8edd2f`, with two diagnostic-only follow-ups to the benchmarked `455dfdb`. Thanks for confirming the proposed order and keeping the upstream stack history stable.
github-bot changed title from hwrt: batch structure invalidation within page-mapping groups (on #342) to hwrt: batched structure invalidation and adaptive indexing (replacement RT stack) 2026-12-04 15:27:10 +00:00
github-bot force-pushed github-bot/gh-429 from bb184d82f5 to 750e9b7441 2026-12-04 15:27:15 +00:00 Compare
Author
Owner

@⁠LOCKhart07 on GitHub · 2026-12-04 15:31 UTC · original

@⁠tommiehansen Works for me: your follow-up as the stage after rt-7-reuse, then #452.

One heads-up: rt-1-lift got two commits today (the translator's output is now identical to main with the switch off, TRANSLATOR_VERSION is back to 20, and the switch is part of the shader cache key). The branches above received them as a merge, not a rebase, so c3a0500 is still in rt-7-reuse and your 750e9b7 applies as it is. I won't rebase these branches while you're building on them.

**@⁠LOCKhart07** on GitHub · 2026-12-04 15:31 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7415988700) @⁠tommiehansen Works for me: your follow-up as the stage after `rt-7-reuse`, then #452. One heads-up: `rt-1-lift` got two commits today (the translator's output is now identical to main with the switch off, `TRANSLATOR_VERSION` is back to 20, and the switch is part of the shader cache key). The branches above received them as a merge, not a rebase, so `c3a0500` is still in `rt-7-reuse` and your `750e9b7` applies as it is. I won't rebase these branches while you're building on them.
Author
Owner

@⁠DrArroway on GitHub · 2026-12-04 18:37 UTC · original

48-minute real-play validation on AMD Radeon RX 6900 XT (1002:73bf) (RDNA 2, 16 GB, 2560x1440 FSR4 Quality + Direct FG) running #429 (750e9b7, both VICTORY_HW_RT_FREED_GATHERED and VICTORY_HW_RT_FREED_INDEX on by default) + #452 (c8edd2f) merged cleanly onto LOCKhart07/VIctory-xmem rt-7-reuse (621120b) + main (2382b4c).

  • 0 GPU errors, 0 kernel faults, and 0 across all 16 hardware RT losses counters over 461,875,486 BLAS instances (24,636 overwritten BLASes = 8,758 MB dropped with 0 wrong drops; host RT memory 618 MB at exit, VRAM peak 14,678 MB, shared 12,595 MB at exit).
  • Full verbatim counters and telemetry posted on #452 (session ended at 48m on the unrelated #111/#358 VICTORY_SKIP_BINK=1 TV mini-game crash).
**@⁠DrArroway** on GitHub · 2026-12-04 18:37 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7420678959) 48-minute real-play validation on `AMD Radeon RX 6900 XT (1002:73bf)` (RDNA 2, 16 GB, `2560x1440` FSR4 Quality + Direct FG) running `#429` (`750e9b7`, both `VICTORY_HW_RT_FREED_GATHERED` and `VICTORY_HW_RT_FREED_INDEX` on by default) + `#452` (`c8edd2f`) merged cleanly onto `LOCKhart07/VIctory-xmem` `rt-7-reuse` (`621120b`) + `main` (`2382b4c`). - **`0` GPU errors, `0` kernel faults**, and **`0` across all 16 `hardware RT losses` counters** over **`461,875,486` BLAS instances** (`24,636` overwritten BLASes = `8,758 MB` dropped with `0` wrong drops; host RT memory `618 MB` at exit, VRAM peak `14,678 MB`, shared `12,595 MB` at exit). - Full verbatim counters and telemetry posted on [#452](https://git.gtahub.st/github/lobomfz--VIctory-xmem/pulls/452) *(session ended at 48m on the unrelated `#111`/`#358` `VICTORY_SKIP_BINK=1` TV mini-game crash)*.
github-bot changed title from hwrt: batched structure invalidation and adaptive indexing (replacement RT stack) to perf(hwrt): batch structure invalidation and adapt address indexing 2026-12-04 22:20:00 +00:00
Author
Owner

@⁠tommiehansen on GitHub · 2026-12-05 10:21 UTC · original

Thanks for the reviews and real-play validation. The current isolated Standard CPU comparison shows 93.38% lower invalidation time, while disclosing index-churn and contention regressions. Now ready for review/testing; merge order remains LOCKhart07's replacement HWRT stack, then #429, then #452. Please review the isolated diff linked in the description.

**@⁠tommiehansen** on GitHub · 2026-12-05 10:21 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/429#issuecomment-7436386646) Thanks for the reviews and real-play validation. The current [isolated Standard CPU comparison](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47503640056/job/145622974701) shows 93.38% lower invalidation time, while disclosing index-churn and contention regressions. Now ready for review/testing; merge order remains LOCKhart07's replacement HWRT stack, then #429, then #452. Please review the isolated diff linked in the description.
The lift commit carried two changes that did not depend on its switch
(its message said so: "two fixes on the way, with the switch off too")
and raised TRANSLATOR_VERSION for them:

- v_mad_legacy's zero addend worked on the bits (and a NaN quieted),
  in place of main's comparison;
- a store through a counter view taken as its one integer channel for
  any mask naming channel 0, refused for one that does not.

Both are taken out here, with the store's test, and the version is 20
again. main's form of the first stays; the second is to be proposed on
its own. What a NaN addend gives is not carried anywhere now.

Measured, on one machine (Wine, RADV), over the 25,694 shader
containers of the title's archive, by `victory shaders` translating
again what main (0fd7614) had cached and counting what came out
different, no switch set:

  before this commit   3,980 of 25,694 different
  after                    0 of 25,694 different

("before" was taken on the top of the stack, "after" on this commit;
195 containers hold no program and translate on neither).

With VICTORY_HW_RT=1, after: `victory translate` lifts whole all 64
compute programs with traversal loops, 397 loops of 397, so the lift
does not need either change.

Not measured: the host side (none in this commit), any run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A run refuses VICTORY_HW_RT=1 on this branch, but `victory shaders` and
`translate --warm` take it and write the cache a run reads. Their
lifted programs went in under the key of the plain ones, so a later run
without the switch would have been given them, with no host structure
to bind.

The switch (and VICTORY_HW_RT_LIFT under it) now goes into the key,
only when on: caches made without it keep their keys.

Measured on one machine (Wine, RADV), the title's 25,694 containers,
on a cache holding the plain translations: `victory shaders` with
VICTORY_HW_RT=1 took 105 s (it translated them), and the one after it
with no switch took 5 s and translated none again (the plain entries
were still there, under their own keys).

Not tested by a unit test: the key reads the environment once per
process. No run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings in the two commits added to rt-1-lift (the two translator
changes that did not depend on the switch taken out, TRANSLATOR_VERSION
20 again; the switch in the shader cache's key). Merged, not rebased,
so work based on this branch keeps its base. The cache key here stays
this branch's own.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings in the two commits added to rt-1-lift (the two translator
changes that did not depend on the switch taken out, TRANSLATOR_VERSION
20 again; the switch in the shader cache's key). Merged, not rebased,
so work based on this branch keeps its base.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings in the two commits added to rt-1-lift (the two translator
changes that did not depend on the switch taken out, TRANSLATOR_VERSION
20 again; the switch in the shader cache's key). Merged, not rebased,
so work based on this branch keeps its base.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings in the two commits added to rt-1-lift (the two translator
changes that did not depend on the switch taken out, TRANSLATOR_VERSION
20 again; the switch in the shader cache's key). Merged, not rebased,
so work based on this branch keeps its base.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings in the two commits added to rt-1-lift (the two translator
changes that did not depend on the switch taken out, TRANSLATOR_VERSION
20 again; the switch in the shader cache's key). Merged, not rebased,
so work based on this branch keeps its base.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings in the two commits added to rt-1-lift (the two translator
changes that did not depend on the switch taken out, TRANSLATOR_VERSION
20 again; the switch in the shader cache's key). Merged, not rebased,
so work based on this branch keeps its base.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/structure.rs
  • docs/SETTINGS.md
  • run.conf.default
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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