vkback: report VRAM/GTT reserve lines and refusal counters in UMEM_MEMREPORT #185

Open
github-bot wants to merge 1 commit from github-bot/gh-185 into main AGit
Owner

@⁠deuxque on GitHub · 2026-12-02 06:06 UTC · original
deuxque:pr/vram-budget-telemetry → main · +151 −8 · 2 files · 1 commits · open

Problem

8 GB cards (#103 RX 6650 XT, #111) still exhibit texture refusals and refill churn,
but UMEM_MEMREPORT only prints heap use/budget. The reserve-line math is inline in
residency.rs, untested, and not surfaced alongside the refusal counters.

Relevant sites:

  • greenfield/vkback/src/residency.rs:62-98 — VRAM/GTT line calculation (over_line)
  • greenfield/vkback/src/srclife.rs:97-108 — texture_place refusal
  • greenfield/vkback/src/slotwrite.rs:367-374 — refused slot write
  • greenfield/umem/src/lib.rs:801-840 — budget / vram_headroom

Change

  • Extract the existing pure integer reserve-line arithmetic into
    greenfield/vkback/src/vramline.rs (wired via #[path = "vramline.rs"] in
    residency.rs to keep lib.rs within policy::file_size), with zero Vulkan
    dependencies.
  • Preserve over_line() byte calculations identically and delegate past_line()
    to the same helper with saturating arithmetic.
  • Append non-breaking fields to UMEM_MEMREPORT right after the existing
    VRAM/GTT (use/budget) summary:
    • VRAM and GTT keep, line, and clamped integer percent (0% if budget == 0)
    • cumulative refused both (self.life.refused_both)
    • current refused slots (self.refused_slots.len())
  • Zero allocator, eviction, fence, placement, or shader behavior changes.

Computed Reserve Lines

VRAM reserves max(25% of budget, 4 GiB) and GTT reserves max(10% of budget, 2 GiB);
the resulting usable percentage is clamped to 50..=90% (and line = (budget / 100) * pct):

Budget Heap Keep Line (printed MB) Line %
8,176 MiB VRAM 4,096 MiB 4,087 MiB 50%
8,176 MiB GTT 2,048 MiB 6,050 MiB 74%
12,288 MiB VRAM 4,096 MiB 8,110 MiB 66%
12,288 MiB GTT 2,048 MiB 10,199 MiB 83%
16,384 MiB VRAM 4,096 MiB 12,287 MiB 75%
16,384 MiB GTT 2,048 MiB 14,254 MiB 87%

Verification

  • 7 pure unit tests in greenfield/vkback/src/vramline.rs covering 8,176 / 12,288 /
    16,384 MiB VRAM & GTT, sub-4-GiB 50..=90% floor clamping, zero-budget handling,
    strict past boundaries, and free-space saturation.
  • cargo test --manifest-path greenfield/Cargo.toml --workspace --no-fail-fast:
    252 passed, 6 ignored, 0 failed.
  • cargo clippy --manifest-path greenfield/Cargo.toml -p vkback --all-targets -- -D warnings:
    0 warnings.
  • cargo test --manifest-path greenfield/Cargo.toml -p vkback --test policy:
    6 passed, 0 failed (lib.rs line count unchanged).

AI use

Assisted by DeepSeek V4.1 Flash Free (initial extraction) and Gemini 4 Neon (integer-percent
formatting polish and verification), human-directed scope. All unit, policy, and clippy
checks ran on an isolated Linux / RDNA 2 host with zero allocation or eviction behavior
change; full-title on-card GPU capture remains pending.

Refs #103 #111

**@⁠deuxque** on GitHub · 2026-12-02 06:06 UTC · [original](https://github.com/vktory6/VKtory/pull/185) `deuxque:pr/vram-budget-telemetry` → `main` · +151 −8 · 2 files · 1 commits · open ## Problem 8 GB cards (#103 RX 6650 XT, #111) still exhibit texture refusals and refill churn, but `UMEM_MEMREPORT` only prints heap use/budget. The reserve-line math is inline in `residency.rs`, untested, and not surfaced alongside the refusal counters. Relevant sites: - `greenfield/vkback/src/residency.rs:62-98` — VRAM/GTT line calculation (`over_line`) - `greenfield/vkback/src/srclife.rs:97-108` — `texture_place` refusal - `greenfield/vkback/src/slotwrite.rs:367-374` — refused slot write - `greenfield/umem/src/lib.rs:801-840` — budget / `vram_headroom` ## Change - Extract the existing pure integer reserve-line arithmetic into `greenfield/vkback/src/vramline.rs` (wired via `#[path = "vramline.rs"]` in `residency.rs` to keep `lib.rs` within `policy::file_size`), with zero Vulkan dependencies. - Preserve `over_line()` byte calculations identically and delegate `past_line()` to the same helper with saturating arithmetic. - Append non-breaking fields to `UMEM_MEMREPORT` right after the existing `VRAM`/`GTT` `(use/budget)` summary: - VRAM and GTT `keep`, `line`, and clamped integer percent (`0%` if `budget == 0`) - cumulative `refused both` (`self.life.refused_both`) - current `refused slots` (`self.refused_slots.len()`) - Zero allocator, eviction, fence, placement, or shader behavior changes. ## Computed Reserve Lines VRAM reserves `max(25% of budget, 4 GiB)` and GTT reserves `max(10% of budget, 2 GiB)`; the resulting usable percentage is clamped to `50..=90%` (and `line = (budget / 100) * pct`): | Budget | Heap | Keep | Line (printed MB) | Line % | |---:|---|---:|---:|---:| | 8,176 MiB | VRAM | 4,096 MiB | 4,087 MiB | 50% | | 8,176 MiB | GTT | 2,048 MiB | 6,050 MiB | 74% | | 12,288 MiB | VRAM | 4,096 MiB | 8,110 MiB | 66% | | 12,288 MiB | GTT | 2,048 MiB | 10,199 MiB | 83% | | 16,384 MiB | VRAM | 4,096 MiB | 12,287 MiB | 75% | | 16,384 MiB | GTT | 2,048 MiB | 14,254 MiB | 87% | ## Verification - 7 pure unit tests in `greenfield/vkback/src/vramline.rs` covering 8,176 / 12,288 / 16,384 MiB VRAM & GTT, sub-4-GiB `50..=90%` floor clamping, zero-budget handling, strict `past` boundaries, and free-space saturation. - `cargo test --manifest-path greenfield/Cargo.toml --workspace --no-fail-fast`: 252 passed, 6 ignored, 0 failed. - `cargo clippy --manifest-path greenfield/Cargo.toml -p vkback --all-targets -- -D warnings`: 0 warnings. - `cargo test --manifest-path greenfield/Cargo.toml -p vkback --test policy`: 6 passed, 0 failed (`lib.rs` line count unchanged). ## AI use Assisted by DeepSeek V4.1 Flash Free (initial extraction) and Gemini 4 Neon (integer-percent formatting polish and verification), human-directed scope. All unit, policy, and clippy checks ran on an isolated Linux / RDNA 2 host with zero allocation or eviction behavior change; full-title on-card GPU capture remains pending. Refs #103 #111
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 06:10:14 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-12-02 06:07 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-12-02 06:07 UTC · [original](https://github.com/vktory6/VKtory/pull/185#pullrequestreview-6145604641) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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