Skip to content

GPU: Graceful degradation and dynamic recycling for descriptor heaps exceeding 1,000,000 slots - #2189

Open
Xvania7 wants to merge 4 commits into
Marvisak:mainfrom
Xvania7:fix/issue-887-descriptor-heap-limit
Open

Xvania7 wants to merge 4 commits into
Marvisak:mainfrom
Xvania7:fix/issue-887-descriptor-heap-limit

Conversation

@Xvania7

@Xvania7 Xvania7 commented Nov 25, 2026

Copy link
Copy Markdown

Fixes #887 (supersedes tracking issue #902; related to #871, #876, #562).

Summary

  • Multi-tiered Heap Fallback (crates/victory-gpu/src/descriptor/host.rs): When requested views + dynamic headroom exceed PORTABLE_VIEWS (1,000,000) or heap creation fails, gracefully steps down through [PORTABLE_VIEWS, 500_000, 250_000, MIN_DYNAMIC] with 131_072 dynamic slots on capped 1M heaps.
  • Cursor Wraparound & Lifetime-Safe Allocation (descriptor/host.rs, draw.rs): Fixes free-span search across the ring cursor and keeps occupied dynamic slots strictly reserved until owning command lists release them (incorporating @andrewpozdnakov7-jpg's lifetime fix 280d033 + @MichaelSmithAI's review feedback).
  • Safe Out-of-Bounds Mirroring (HostHeap::mirror): Recovers and returns the underlying title View when index >= self.count so resource transitions and barriers continue cleanly.

Verification

@Xvania7
Xvania7 force-pushed the fix/issue-887-descriptor-heap-limit branch from 77d9f68 to 1df7823 Compare November 25, 2026 07:38

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Graceful degradation + dynamic recycling for descriptors — resource-exhaustion handling; relates to #2099's bounded view table.

@MamaLeVrai

Copy link
Copy Markdown

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head 7e1292d6 into main 940d32f in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with --all-features: clean. cargo test --workspace --locked: 704 passed, 0 failed, 10 ignored, two runs (main alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-gpu/src/descriptor/host.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (needs-work) was for an older state of main.


Generated by Claude Code

@Xvania7

Xvania7 commented Nov 25, 2026

Copy link
Copy Markdown
Author

Addressed the triage points in (364c675):

  1. Hardware Tier 1 Anchor & Removal of Arbitrary Steps:
    Removed the 500k/250k loops. The cap is anchored directly to D3D12 Tier 1 limits (D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 = 1_000_000) enforced by NVIDIA drivers (Ampere, Ada, Blackwell). Keeping PORTABLE_VIEWS = 1_000_000 preserves the invariant that translated shaders can safely clamp below HEAP_VIEWS.
  2. Order & Error Branch:
    Restored return None on plain allocation failure (Err(e) when count + MIN_DYNAMIC <= PORTABLE_VIEWS), avoiding retrying larger heaps when the device ran out of memory.
  3. Mirror Path Test Coverage:
    Updated heap_request_over_one_million_caps_gracefully to assert both the zero-tag fallback and the VIEW_TAG branch without host heap indexing.

All checks pass cleanly: unit tests 148 passed, Clippy 0 warnings, asset policy ok.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test report: Win10 19045 + RTX 5060 — #876 clears the black screen, then the descriptor heap caps at count=124518

5 participants