Texture pass: cards over 12 GiB keep twice the baseline time past the card's line #552

Open
Nyutt wants to merge 1 commit from nyutt/texspk-cap-large-cards into Main AGit
Contributor

What it changes

  • The problem on main: in the city flight on a 16 GB card, a frame's texture passes stop at their time and textures picked by index wait for the layer. Bench kit, cam-city60, in-game flight, three runs of main: 345-751 slots due on average waiting for the layer (tex_due_layer_late), 45-72 % of the passes stopped at their time (passes out of time), the pass at 10-17 ms a frame in the median.

The frame's cap (texspk_cap_ms, from DARNER_TEXSPK_PASS_MS, 8 ms in darner play and play-nvidia.ps1) is doubled on cards over 12 GiB only while the card has room below its line. In this flight the card is past its line for half the time or more, so the cap falls back to 8 ms. Most of the slots that wait bring textures already on the card up to date, which needs no room: room only decides whether new host copies are made, and the pass checks it for each one.

This change starts cards over 12 GiB from twice the baseline: 16 ms past the line or under host-RAM pressure, 32 ms with room, 48 ms catching up. That is what DARNER_TEXSPK_PASS_MS=16 already gave such cards. Cards at 12 GiB and below are unchanged (8 / 8 / 24 ms); the 8 ms baseline was measured on the walking route on an RTX 4090. One function and its test, crates/darner-gpu/src/draw.rs.

What the cap was not: DirectStorage served the title's requests in 15-20 ms on average with under one of its four workers busy (DARNER_DSTORAGE_LOG, three runs), and eight workers changed nothing that was delivered. Slots waiting for the title (tex_due_title_late) stayed at 50-95.

How it was tested

  • Tested revision: 864b5b7 (on main c8258f9), built with the bench kit's in-game route patch and #361's pin-write fix, both added only to the bench builds.

  • Commands and results:

    • cargo xtask policy: asset policy, 576 files ok
    • cargo clippy --workspace --all-targets --locked -- -D warnings: pass
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass
    • cargo test -p darner-gpu --locked --lib texspk: 2 passed
    • cargo test -p darner-gpu --locked --lib: passed in 2 of 6 runs. The failing test changed from run to run (watch::watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs, watch::tests::streamed_texture_written_through_an_alias_reaches_a_full_queue, descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync), each passes alone, and main c8258f9 in the same worktree failed in 2 of 5 runs with the same kind of failures (watch::tests::streamed_texture_written_through_an_alias_reaches_a_full_queue, host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end, host::refresh_tests::refresh_front_zero_arc_matches_and_runs_due).
  • Changes a default: yes, for cards with more than 12 GiB of video memory.

  • A/B result: bench kit, cam-city60 (65 s over the city), in-game flight, alternated orders (A B A, then B A B), A = main c8258f9, B = this change. Two runs of the first batch compiled about 140 pipelines each (cache seeded just before) and are left out; the four below compiled 2-6 each.

    run tex_due_layer_late avg passes out of time texture pass ms a frame, median fps median fps 10th percentile
    A 751 69 % 16.7 23.4 19.7
    B 351 21 % 8.2 23.9 21.2
    A 727 64 % 16.7 22.6 18.7
    B 273 20 % 9.1 23.6 20.8

    The same scaling as a switch on a main build (DARNER_TEXSPK_PASS_MS=16, four runs against three of 8 ms, alternated): 197-251 against 345-620 waiting, 11-21 % against 45-60 % of passes out of time, median fps 26.8 against 25.5 (spread 2.1 and 0.9). No frame-rate gain is claimed from these; the frame rate did not drop.

  • Gates run on that revision: cargo xtask policy and both clippy gates. cargo test --workspace --locked was not run; cargo test -p darner-gpu --locked --lib as above.

  • Gameplay: RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, 31 GB RAM, Series X profile, DLSS Quality 1080p to 1440p, DLSS frame generation 2x, hardware ray tracing on.

  • Hardware dependence: cards over 12 GiB only. Measured on one PC; untested on other CPUs, where the pass's thread may have less time to spare.

  • Coverage gaps: one route (cam-city60); no walking or driving route; no card at 12 GiB or below (unchanged by design).

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #528 (which slots the pass serves first: fresh ones before rechecks), #509 (fewer guarded-texture hashes), #461 (tells the pass of the title's own writes). They change what the pass spends its time on; this one changes how much time it has.
  • Replaces or overlaps: none found

🤖 Generated with Claude Code

## What it changes - The problem on main: in the city flight on a 16 GB card, a frame's texture passes stop at their time and textures picked by index wait for the layer. Bench kit, cam-city60, in-game flight, three runs of main: 345-751 slots due on average waiting for the layer (`tex_due_layer_late`), 45-72 % of the passes stopped at their time (`passes out of time`), the pass at 10-17 ms a frame in the median. The frame's cap (`texspk_cap_ms`, from `DARNER_TEXSPK_PASS_MS`, 8 ms in `darner play` and `play-nvidia.ps1`) is doubled on cards over 12 GiB only while the card has room below its line. In this flight the card is past its line for half the time or more, so the cap falls back to 8 ms. Most of the slots that wait bring textures already on the card up to date, which needs no room: room only decides whether new host copies are made, and the pass checks it for each one. This change starts cards over 12 GiB from twice the baseline: 16 ms past the line or under host-RAM pressure, 32 ms with room, 48 ms catching up. That is what `DARNER_TEXSPK_PASS_MS=16` already gave such cards. Cards at 12 GiB and below are unchanged (8 / 8 / 24 ms); the 8 ms baseline was measured on the walking route on an RTX 4090. One function and its test, `crates/darner-gpu/src/draw.rs`. What the cap was not: DirectStorage served the title's requests in 15-20 ms on average with under one of its four workers busy (`DARNER_DSTORAGE_LOG`, three runs), and eight workers changed nothing that was delivered. Slots waiting for the title (`tex_due_title_late`) stayed at 50-95. ## How it was tested - Tested revision: 864b5b7 (on `main` c8258f9), built with the bench kit's in-game route patch and #361's pin-write fix, both added only to the bench builds. - Commands and results: - `cargo xtask policy`: asset policy, 576 files ok - `cargo clippy --workspace --all-targets --locked -- -D warnings`: pass - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: pass - `cargo test -p darner-gpu --locked --lib texspk`: 2 passed - `cargo test -p darner-gpu --locked --lib`: passed in 2 of 6 runs. The failing test changed from run to run (`watch::watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs`, `watch::tests::streamed_texture_written_through_an_alias_reaches_a_full_queue`, `descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync`), each passes alone, and `main` c8258f9 in the same worktree failed in 2 of 5 runs with the same kind of failures (`watch::tests::streamed_texture_written_through_an_alias_reaches_a_full_queue`, `host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end`, `host::refresh_tests::refresh_front_zero_arc_matches_and_runs_due`). - Changes a default: yes, for cards with more than 12 GiB of video memory. - A/B result: bench kit, cam-city60 (65 s over the city), in-game flight, alternated orders (A B A, then B A B), A = `main` c8258f9, B = this change. Two runs of the first batch compiled about 140 pipelines each (cache seeded just before) and are left out; the four below compiled 2-6 each. | run | `tex_due_layer_late` avg | passes out of time | texture pass ms a frame, median | fps median | fps 10th percentile | |---|---|---|---|---|---| | A | 751 | 69 % | 16.7 | 23.4 | 19.7 | | B | 351 | 21 % | 8.2 | 23.9 | 21.2 | | A | 727 | 64 % | 16.7 | 22.6 | 18.7 | | B | 273 | 20 % | 9.1 | 23.6 | 20.8 | The same scaling as a switch on a main build (`DARNER_TEXSPK_PASS_MS=16`, four runs against three of 8 ms, alternated): 197-251 against 345-620 waiting, 11-21 % against 45-60 % of passes out of time, median fps 26.8 against 25.5 (spread 2.1 and 0.9). No frame-rate gain is claimed from these; the frame rate did not drop. - Gates run on that revision: `cargo xtask policy` and both clippy gates. `cargo test --workspace --locked` was not run; `cargo test -p darner-gpu --locked --lib` as above. - Gameplay: RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, 31 GB RAM, Series X profile, DLSS Quality 1080p to 1440p, DLSS frame generation 2x, hardware ray tracing on. - Hardware dependence: cards over 12 GiB only. Measured on one PC; untested on other CPUs, where the pass's thread may have less time to spare. - Coverage gaps: one route (cam-city60); no walking or driving route; no card at 12 GiB or below (unchanged by design). ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #528 (which slots the pass serves first: fresh ones before rechecks), #509 (fewer guarded-texture hashes), #461 (tells the pass of the title's own writes). They change what the pass spends its time on; this one changes how much time it has. - Replaces or overlaps: none found 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The 8 ms baseline (DARNER_TEXSPK_PASS_MS) stopped 45-60 % of the passes at
their time in the city flight on a 16 GB card past its line, with 345-620
slots waiting for the layer; most bring textures already on the card up to
date, which needs no room. Large cards now start from 16 ms (32 with room,
48 catching up), what DARNER_TEXSPK_PASS_MS=16 gave them: 197-251 waiting,
11-21 % of passes out of time, same frame rate. Cards at 12 GiB keep 8 ms.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
First-time contributor

Tested on a 4080 SUPER under Linux (Proton Experimental, NVIDIA 620.85.02, vkd3d-proton 3.2.0), a different platform from yours. One run per case, no repeats — so these are one data point, not a variance study.

What I measured (world frames only, >1000 draws/frame; same build 562a8653 both runs, one switch apart):

main default (8 ms) DARNER_TEXSPK_PASS_MS=16
median 73.0 ms 54.7 ms
p90 81.9 ms 67.4 ms
worst frame 171.8 ms 76.6 ms
preparing 29.6 ms 24.5 ms
slots due not yet served, last census 1,542 1–8

Both figures in the last row are the layer's own textures picked by index … N waiting line, which is a snapshot of the queue, not a run total. The worst frame going from 172 to 77 ms is the part a player feels; the queue is what your description predicted and it matches — this card sat past its line for most of the run, no room, new textures wait was the steady state, and the queue was 1,542 deep.

Why raising the cap helps is worth stating: fewer, longer passes mean fewer fence waits and fewer times a slot is dropped because its pass ran out of time. That is consistent with the median falling while preparing falls only slightly.

One thing that changes what the PR does. main already carries the "double the baseline over 12 GiB" half:

let scaled = if catchup_active {
    base_cap_ms.saturating_mul(3)
} else if vram_budget.is_some_and(|b| b > 12 * GIB) {
    base_cap_ms.saturating_mul(2)
} else {
    base_cap_ms
};

but the function returns base_cap_ms before reaching it when !room || pressured. On this card that early return is the steady state, so neither the ×2 nor the ×3 of catch-up is ever reached — under pressure the card gets a smaller cap than an idle one. That is exactly the case your description calls out ("the cap falls back to 8 ms"), and it is why DARNER_TEXSPK_PASS_MS=16 removes this pattern here while main does not. If "past the line" is meant to be covered, the scaling has to move before the early return, or inside it.

Also: the PR page reports mergeable: no — head branch deleted. The branch it points at no longer exists, so it cannot be merged as it stands.

Not measured, for honesty: I did not A/B the branch itself against main. The numbers above are the switch, which your description says gives the same effect. And crossing a zone boundary is far worse for an unrelated reason — preparing reaches 497 ms with GPU 0.0 and frames of 1.9–2.8 s — so the zone-load freeze is not something this cap addresses.

Repro, if you want it: --set DARNER_TEXSPK_PASS_MS=16 on an RTX 4080 SUPER, Linux, WINEDLLOVERRIDES="dxgi=n,b", driving the same route twice.

Tested on a 4080 SUPER under Linux (Proton Experimental, NVIDIA 620.85.02, vkd3d-proton 3.2.0), a different platform from yours. One run per case, no repeats — so these are one data point, not a variance study. **What I measured** (world frames only, >1000 draws/frame; same build `562a8653` both runs, one switch apart): | | `main` default (8 ms) | `DARNER_TEXSPK_PASS_MS=16` | |---|---|---| | median | 73.0 ms | **54.7 ms** | | p90 | 81.9 ms | **67.4 ms** | | worst frame | 171.8 ms | **76.6 ms** | | `preparing` | 29.6 ms | 24.5 ms | | slots due not yet served, last census | 1,542 | 1–8 | Both figures in the last row are the layer's own `textures picked by index … N waiting` line, which is a snapshot of the queue, not a run total. The worst frame going from 172 to 77 ms is the part a player feels; the queue is what your description predicted and it matches — this card sat past its line for most of the run, `no room, new textures wait` was the steady state, and the queue was 1,542 deep. **Why raising the cap helps is worth stating**: fewer, longer passes mean fewer fence waits and fewer times a slot is dropped because its pass ran out of time. That is consistent with the median falling while `preparing` falls only slightly. **One thing that changes what the PR does.** `main` already carries the "double the baseline over 12 GiB" half: ```rust let scaled = if catchup_active { base_cap_ms.saturating_mul(3) } else if vram_budget.is_some_and(|b| b > 12 * GIB) { base_cap_ms.saturating_mul(2) } else { base_cap_ms }; ``` but the function returns `base_cap_ms` before reaching it when `!room || pressured`. On this card that early return is the steady state, so neither the ×2 nor the ×3 of catch-up is ever reached — under pressure the card gets a *smaller* cap than an idle one. That is exactly the case your description calls out ("the cap falls back to 8 ms"), and it is why `DARNER_TEXSPK_PASS_MS=16` removes this pattern here while `main` does not. If "past the line" is meant to be covered, the scaling has to move before the early return, or inside it. **Also**: the PR page reports `mergeable: no — head branch deleted`. The branch it points at no longer exists, so it cannot be merged as it stands. **Not measured, for honesty**: I did not A/B the branch itself against `main`. The numbers above are the switch, which your description says gives the same effect. And crossing a zone boundary is far worse for an unrelated reason — `preparing` reaches 497 ms with `GPU 0.0` and frames of 1.9–2.8 s — so the zone-load freeze is not something this cap addresses. Repro, if you want it: `--set DARNER_TEXSPK_PASS_MS=16` on an RTX 4080 SUPER, Linux, `WINEDLLOVERRIDES="dxgi=n,b"`, driving the same route twice.
First-time contributor

Tested 864b5b7 vs origin/main (c8258f9) via two unattended 90 s scripts/bench.ps1 runs (same switches, identical diag profile without --features diagnostics, warm cache, RTX 5070 Ti 16 GB, Series X, 1080p->1440p DLSS Quality, DLSS MFG 3x, RT off, DARNER_RDNA_FLOAT=2, DARNER_SAMPLED_MARKS=0):

Metric (30–120 s window) origin/main (c8258f9) PR #552 (864b5b7)
Median / Mean FPS 17.3 / 17.1 fps (57.8 / 58.5 ms) 21.8 / 22.0 fps (46.1 / 45.6 ms)
4500-7000 draws band 17.5 fps (13 lines) 21.9 fps (14 lines)
7000+ draws band 16.5 fps (5 lines) 21.0 fps (4 lines)
Frame passes / stopped at time 1,568 / 3 2,003 / 0
Neutral shown / written slots 105,577 / 977,667 (10.80%) 102,346 / 1,377,968 (7.43%)
Peak private RAM / crashes 27.3 GB / 0 28.2 GB / 0

This directly exercises the >12 GiB tier (16 GB card) and matches the author's expectation: zero time-capped passes, 31% lower relative neutral-texture rate, oldest backlog slot dropped from 2,688 frames on main to 2 frames at end of run, and draw::tests passed 15/15. (Single A/B pair; not a full ABBA.)

Tested `864b5b7` vs `origin/main` (`c8258f9`) via two unattended 90 s `scripts/bench.ps1` runs (same switches, identical `diag` profile without `--features diagnostics`, warm cache, RTX 5070 Ti 16 GB, Series X, 1080p->1440p DLSS Quality, DLSS MFG 3x, RT off, `DARNER_RDNA_FLOAT=2`, `DARNER_SAMPLED_MARKS=0`): | Metric (30–120 s window) | `origin/main` (`c8258f9`) | PR #552 (`864b5b7`) | |---|---|---| | Median / Mean FPS | 17.3 / 17.1 fps (57.8 / 58.5 ms) | **21.8 / 22.0 fps** (46.1 / 45.6 ms) | | `4500-7000 draws` band | 17.5 fps (13 lines) | **21.9 fps** (14 lines) | | `7000+ draws` band | 16.5 fps (5 lines) | **21.0 fps** (4 lines) | | Frame passes / stopped at time | 1,568 / 3 | **2,003 / 0** | | Neutral shown / written slots | 105,577 / 977,667 (**10.80%**) | 102,346 / 1,377,968 (**7.43%**) | | Peak private RAM / crashes | 27.3 GB / 0 | 28.2 GB / 0 | This directly exercises the >12 GiB tier (`16 GB` card) and matches the author's expectation: zero time-capped passes, 31% lower relative neutral-texture rate, oldest backlog slot dropped from `2,688` frames on `main` to `2` frames at end of run, and `draw::tests` passed 15/15. (Single A/B pair; not a full ABBA.)
TrustNo1 changed title from [pr-performance] Texture pass: cards over 12 GiB keep twice the baseline time past the card's line to Texture pass: cards over 12 GiB keep twice the baseline time past the card's line 2026-12-06 03:27:19 +00:00
Owner

Test needed — commit 864b5b7a; what to check:

  • The problem on main: in the city flight on a 16 GB card, a frame's texture passes stop at their time and textures picked by index wait for the layer. Bench kit, cam-city60, in-game flight, three runs of main: 345-751 slots due on average waiting for the layer (tex_due_layer_late), 45-72 % of the passes stopped at their time (passes out of time), the pass at 10-17 ms a frame in the median.

The frame's cap (texspk_cap_ms, from DARNER_TEXSPK_PASS_MS, 8 ms in darner play and play-nvidia.ps1) is doubled on cards over 12 GiB only while the card has room below its line. In this flight the card is past its line for half the time or more, so the cap falls back to 8 ms. Most of the slots that wait bring textures already on the card up to date, which needs no room: room only decides whether new host copies are made, and the pass checks it for each one.

This change starts cards over 12 GiB from twice the baseline: 16 ms past the line or under host-RAM pressure, 32 ms with room, 48 ms catching up. That is what DARNER_TEXSPK_PASS_MS=16 already gave such cards. Cards at 12 GiB and below are unchanged (8 / 8 / 24 ms); the 8 ms baseline was measured on the walking route on an RTX

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `864b5b7a`; what to check: - The problem on main: in the city flight on a 16 GB card, a frame's texture passes stop at their time and textures picked by index wait for the layer. Bench kit, cam-city60, in-game flight, three runs of main: 345-751 slots due on average waiting for the layer (`tex_due_layer_late`), 45-72 % of the passes stopped at their time (`passes out of time`), the pass at 10-17 ms a frame in the median. The frame's cap (`texspk_cap_ms`, from `DARNER_TEXSPK_PASS_MS`, 8 ms in `darner play` and `play-nvidia.ps1`) is doubled on cards over 12 GiB only while the card has room below its line. In this flight the card is past its line for half the time or more, so the cap falls back to 8 ms. Most of the slots that wait bring textures already on the card up to date, which needs no room: room only decides whether new host copies are made, and the pass checks it for each one. This change starts cards over 12 GiB from twice the baseline: 16 ms past the line or under host-RAM pressure, 32 ms with room, 48 ms catching up. That is what `DARNER_TEXSPK_PASS_MS=16` already gave such cards. Cards at 12 GiB and below are unchanged (8 / 8 / 24 ms); the 8 ms baseline was measured on the walking route on an RTX Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
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/552/head:nyutt/texspk-cap-large-cards'
git switch 'nyutt/texspk-cap-large-cards'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'nyutt/texspk-cap-large-cards'
git switch 'nyutt/texspk-cap-large-cards'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'nyutt/texspk-cap-large-cards'
git switch 'nyutt/texspk-cap-large-cards'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'nyutt/texspk-cap-large-cards'
git switch 'Main'
git merge --squash 'nyutt/texspk-cap-large-cards'
git switch 'Main'
git merge --ff-only 'nyutt/texspk-cap-large-cards'
git switch 'Main'
git merge 'nyutt/texspk-cap-large-cards'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!552
No description provided.