GPU allocation latency, memory queries and descriptor allocation optimizations #3561

Closed
edge2labs wants to merge 7 commits from upstream-pr/3561 into main
edge2labs commented 2026-11-30 01:02:51 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by edge2labs on 2026-11-30T01:02:51Z.


Integrated performance contribution by Edge2Labs, containing seven commits rebased onto v2026.11.29.05 (41adb551).

Synthetic benchmark improvements:

  • Staging allocation peak latency: 99.39% reduction.
  • Accumulated staging allocation time: 90.17% reduction.
  • Mapped memory queries: up to 91.17% reduction.
  • GPU pool selection: 80.72% reduction.
  • Descriptor allocation: 26.97% reduction.
  • BC6H decoding: 1.26% reduction.
  • Fixed three failing BC7 reference parity tests.

Validation:

Release and Diagnostics builds passed. Targeted correctness tests passed. Existing upstream policy and Clippy failures remain, along with intermittent GPU test failures.

Experimental options:

  • VICTORY_STAGING_REFILL=1
  • VICTORY_MAPPED_BLOCK_BATCH=1

Both options remain disabled by default.

Hardware: i9-14900K, RTX 4080 SUPER, 64 GB RAM.

All results are synthetic. No in-game FPS improvement is claimed. Based on the maintainer's feedback, these changes should primarily reduce hitches and improve frame-time stability.

The BC7 correction overlaps with PR #3263.

Looking forward to the in-game benchmark without frame generation.

Edge2Labs

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5557129721 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3561). Originally posted by [edge2labs](https://github.com/edge2labs) on 2026-11-30T01:02:51Z. --- Integrated performance contribution by Edge2Labs, containing seven commits rebased onto v2026.11.29.05 (41adb551). **Synthetic benchmark improvements:** - Staging allocation peak latency: 99.39% reduction. - Accumulated staging allocation time: 90.17% reduction. - Mapped memory queries: up to 91.17% reduction. - GPU pool selection: 80.72% reduction. - Descriptor allocation: 26.97% reduction. - BC6H decoding: 1.26% reduction. - Fixed three failing BC7 reference parity tests. **Validation:** Release and Diagnostics builds passed. Targeted correctness tests passed. Existing upstream policy and Clippy failures remain, along with intermittent GPU test failures. **Experimental options:** - VICTORY_STAGING_REFILL=1 - VICTORY_MAPPED_BLOCK_BATCH=1 Both options remain disabled by default. **Hardware:** i9-14900K, RTX 4080 SUPER, 64 GB RAM. All results are synthetic. No in-game FPS improvement is claimed. Based on the maintainer's feedback, these changes should primarily reduce hitches and improve frame-time stability. The BC7 correction overlaps with PR #3263. Looking forward to the in-game benchmark without frame generation. Edge2Labs
davemathews12 commented 2026-11-30 05:26:37 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by davemathews12 on 2026-11-30T05:26:37Z.


I read the staging refill and the BCPack change.

Staging refill (67d9f4b): one race worth closing. The worker checks p.free_bytes < BLOCK / 2 && p.may_grow(now()), then drops the lock to allocate. Back under the lock it re-checks STAGING_SPARES and free_bytes, but not may_grow. If a required allocation grows the pool to its cap in that window, the worker still adds its block. The pool then goes one 64 MiB block over its growth limit, although the comment says it obeys the idle cap. Adding && p.may_grow(now()) to the condition before p.add(...) closes it. The new block is already dropped outside the lock when it isn't kept. Since the feature is opt-in (VICTORY_STAGING_REFILL=1), the default path is unaffected.

BC6H header plans (c8bbcc2): equivalent to the old loop. The field indices (ep * 3 + ch, partition at 12) match the flat array. The only partition run is D = r(3, 0, 0, 5), so (part >> 0) & 31 over 5 bits equals the old put_unmasked(part, 5), because part = s[31] & 31. The const assertion also checks the 82/65 bit totals.

One gap in the new bc6_header_plan_matches_bit_writer test: its expected value uses put(fields[12] >> run.first, run.len) for the partition, the new interpretation. The old code wrote put_unmasked(part, 5). An assertion that every ch == 3 run is first 0, len 5 would pin the two together.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7269673049 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3561#issuecomment-7269673049). Originally posted by [davemathews12](https://github.com/davemathews12) on 2026-11-30T05:26:37Z. --- I read the staging refill and the BCPack change. **Staging refill (67d9f4b):** one race worth closing. The worker checks `p.free_bytes < BLOCK / 2 && p.may_grow(now())`, then drops the lock to allocate. Back under the lock it re-checks `STAGING_SPARES` and `free_bytes`, but not `may_grow`. If a required allocation grows the pool to its cap in that window, the worker still `add`s its block. The pool then goes one 64 MiB block over its growth limit, although the comment says it obeys the idle cap. Adding `&& p.may_grow(now())` to the condition before `p.add(...)` closes it. The new block is already dropped outside the lock when it isn't kept. Since the feature is opt-in (`VICTORY_STAGING_REFILL=1`), the default path is unaffected. **BC6H header plans (c8bbcc2):** equivalent to the old loop. The field indices (`ep * 3 + ch`, partition at 12) match the flat array. The only partition run is `D = r(3, 0, 0, 5)`, so `(part >> 0) & 31` over 5 bits equals the old `put_unmasked(part, 5)`, because `part = s[31] & 31`. The const assertion also checks the 82/65 bit totals. One gap in the new `bc6_header_plan_matches_bit_writer` test: its expected value uses `put(fields[12] >> run.first, run.len)` for the partition, the new interpretation. The old code wrote `put_unmasked(part, 5)`. An assertion that every `ch == 3` run is `first 0, len 5` would pin the two together.
trustno1-coder commented 2026-12-01 18:51:12 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:51:12Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321675513 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3561#issuecomment-7321675513). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:51:12Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!3561
No description provided.