Skip to content

DXGI-aware retention for empty D3D12.X texture heaps #804

Backlog

Description

@yaandrei2000

Proposal

XCL retains empty 64 MiB texture heaps after streaming bursts, even when all their tiles become reusable.

I investigated an adaptive reclamation policy that retains a small warm reserve of empty heaps and releases the remaining heaps based on DXGI memory headroom and idle time.

Measurements

Hardware: Ryzen 5 5500, GTX 1660 Ti 6 GB, NVIDIA driver 617.42, 16 GB RAM, Windows 11 build 26300, debug build.

Synthetic workload: 16 RGBA8 textures, 256 MiB total, tested on d208e14.

Strategy LOCAL usage after 4.21 s New heaps (10 cycles) Placement median / p95
Current main 269.95 MiB 0 4.46 / 6.87 ms
Full trimming 13.95 MiB 40 19.84 / 21.05 ms
Keep one heap 77.95 MiB 30 15.52 / 18.77 ms
Keep two heaps 141.95 MiB 20 12.14 / 12.78 ms
Adaptive trimming 141.95 MiB 20 11.85 / 13.09 ms

After an 8.25 s idle period and a maintenance call, adaptive trimming returned all four heaps, reducing LOCAL usage to 13.95 MiB.

Peak VRAM usage remained unchanged.

Safety considerations

The experiments identified several prerequisites for safe reclamation:

  • Tracking external CopyTileMappings aliases.
  • Per-queue fence completion.
  • Generation-safe resource cleanup when COM addresses are reused.
  • Safe handling of allocation failures and device removal.

The prototype targets empty heaps only and does not evict live textures.

Related work: #490, #594, #640, #782.

The prototype is experimental and is not ready for production. Safe reclamation requires resolving the resource lifetime and synchronization issues described above.

Proposed direction

Consider a bounded warm reserve driven by DXGI headroom, hysteresis and idle time.

An experimental implementation and synthetic regression tests are available locally. All 17 matrix runs, 7 safety and policy checks, and 22 related tests completed successfully.

Would this direction be acceptable before preparing a focused PR?

Not tested

Retail games, AMD GPUs, release builds and actual system-wide VRAM pressure. Budget-pressure scenarios used synthetic budget inputs.

AI use

ChatGPT (GPT-6.2) assisted with the research plan. OpenAI Codex (GPT-6 family) investigated the runtime, implemented the experimental prototype and ran the synthetic tests on the hardware listed above.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions