Skip to content

Shaders: replay compatible two-pass mesh pipelines at startup - #2828

Open
CryingLaughing wants to merge 1 commit into
xcl-dev:nvidia-devfrom
CryingLaughing:perf/prewarm-two-pass-mesh
Open

CryingLaughing wants to merge 1 commit into
xcl-dev:nvidia-devfrom
CryingLaughing:perf/prewarm-two-pass-mesh

Conversation

@CryingLaughing

@CryingLaughing CryingLaughing commented Nov 26, 2026 •

Copy link
Copy Markdown

Part of #2760. Targets nvidia-dev, where graphics startup history and its worker are available.

Graphics startup can replay legacy descriptor records. This adds a typed record for compatible two-pass console mesh streams so first use can save the shader keys and fixed-function state, and startup can replay the stream with the runtime’s pipeline cache keys.

What is in it

  • Store compatible mesh streams alongside the existing V1 graphics history entries, with ordered subobjects and pointer-free state.
  • Use the normal capture and startup worker for the MS or moved-AS slot and an optional pixel shader. Missing sources retain the existing cold-build path.

Tested

  • Head b04438c7533111277ab2b5b532335682c1989a82 on nvidia-dev af2cecc40886a8682ecf3267f5328c6dc4b66ad7. RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC and DXC 1.8.2502.11, debug.

  • Four normal xcl run launches exited 0 with no capability skips and unchanged synthetic title folders. The base saved no mesh history. The head’s first bind saved one record. On a fresh launch, the ordinary startup worker resolved its loose shader, made one pipeline, and saved two blobs before the bind. The guest reused 2/2 with zero rejections or cold retries. With the loose source missing, the guest built both passes cold. Normal launcher comparison

  • A separate direct worker check saved two blobs with one window, then verified both were accepted on a fresh launch. Moving the same console shader to the AS slot also produced the same cache paths and two accepted blobs.

  • On the unmodified head, cargo build --workspace --locked -j 4 passed. The locked four-thread workspace suite reported 1,748 passed, 5 failed, 48 ignored. The clean parent had the same five failing tests.

  • The same full build and four-thread suites with identical test-only overlays from Tests: wait for late release before checking released pipelines are gone #2770, Tests: some_ranges in texture_upload wraps its generator instead of overflowing #2771 and Tests: a console MS in the AS slot is refused by its MS translation #2788 reported 1,750 passed, 0 failed, 48 ignored on the base and 1,753 passed, 0 failed, 48 ignored on the head. Each included 30 capability skips across 40 harnesses. An earlier overlay run had one shared synthetic game-folder assertion failure. It did not recur in the final paired run.

  • The automatic merge of this head with nvidia-dev ea0698d428f38f63fcc7638e50a86d186eb7e264 built at tree 69310a57126efe88afab2a3e3c204220387a577b. On the same RTX 4080 host, three synthetic xcl run launches exited 0 with Series X selected. The first launch wrote one type-3 mesh record. On a fresh launch the startup worker made one pipeline and saved two blobs. The guest accepted 2/2 with zero rejections or cold retries. With the loose shader absent, startup left the record out and the guest built both passes cold. The focused mesh and record selection passed 15 tests with 0 failures and 0 ignores, with no capability skips.

Regression run

Independent retail smoke by MatyEjsr compared the exact original nvidia-dev parent af2cecc40886a8682ecf3267f5328c6dc4b66ad7 and head b04438c7533111277ab2b5b532335682c1989a82 for 60 seconds each on an RTX 3090 with driver 617.42. Both exited 0 with zero crashes or device removals. The head showed 1,601 frames versus 1,590 on the parent and used 14,927 MB peak commit versus 15,591 MB (95.7%). Mesh history stayed at zero type-3 records, so the retail run covered startup stability and the synthetic launches covered mesh replay. The independent workspace suite found the same six failures on both revisions, and its focused graphics-record and shader-ownership checks passed 10/10.

Not tested

  • Retail launch timing, mesh draw output, optional pixel-shader replay, or runtime reuse with heap-window fallback.

Record supported console mesh streams with their fixed-function state and source shader keys. Replay through the existing graphics worker and two-pass translator to populate the runtime driver caches. Keep legacy graphics history compatible and leave unsupported streams to the existing runtime path.
@Anon64

Anon64 commented Nov 26, 2026 •

Copy link
Copy Markdown

Regression run of b04438c on a newer retail title: no device removal and no crash in three runs, but peak commit over the 125 % limit in two of them (about 7 GB above the base).

Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of this PR's base b49be18 and of its exact head, run back to back, scripts/smoke.ps1 -Game <title> for 60 s with XCL_NETWORK=0 and A pressed every 4 s from 20 s.

base:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1435 (PresentX 1435)
presents per 2 s (last 3): 37 3 1
device removals: 0
crashes: 0
peak commit: 23879 MB

this PR:

xcl-smoke v1
commit: b04438c7533111277ab2b5b532335682c1989a82
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1667 (PresentX 1667)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19118 MB

116 % of the base's frames, 80 % of its peak commit. One run each. Peak commit on this title has varied between 17.4 and 25 GB over the day on this machine, so one run cannot say whether the lower commit and the higher frame count come from this PR.

Update, second run of each (this PR first, then the base): this PR 1444 frames, peak commit 30,739 MB; base 1467 frames, 24,513 MB. That is 98 % of the frames and 125.4 % of the peak commit, just over the limit. This PR's two runs differ by 11.6 GB of peak commit (19,118 and 30,739 MB) against 23.9 and 24.5 GB for the base, so I cannot tell from these runs whether this PR lowers commit, raises it, or makes it vary more. The replay at startup may change how much the first 60 s build, which would explain a wider spread; more runs (or a peak-commit line from the replay itself) would settle it.

Update, third run of each (the base first this time): base 1416 frames, peak commit 24,064 MB; this PR 1494 frames, 31,550 MB, 131 % of the base.

run this PR, peak commit base, peak commit ratio
1 19,118 MB 23,879 MB 80 %
2 30,739 MB 24,513 MB 125 %
3 31,550 MB 24,064 MB 131 %

The base stays within 0.7 GB across its three runs; this PR is about 7 GB higher in two of three. That looks like a real increase, perhaps from what the replay keeps alive at startup, with run 1 a case where it did not run or did less. Frames are 98–116 % of the base.

Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.

AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.

@CryingLaughing

Copy link
Copy Markdown
Author

Two of the reported retail pairs cross 125% peak commit. Their b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 control is 371 commits behind the actual nvidia-dev parent af2cecc40886a8682ecf3267f5328c6dc4b66ad7. That comparison leaves the replay contribution to the difference unresolved.

I isolated one recorded two-pass mesh stream on RTX 4080 driver 621.01, Core i5-13600K and Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11, debug. Across three alternating xcl run pairs at exact head b04438c7533111277ab2b5b532335682c1989a82, the Windows job-wide peak commit was 656.410 / 650.961, 651.328 / 649.211, and 649.227 / 649.805 MiB with graphics preparation on versus off. Three exact NVIDIA parent controls measured 650.383, 649.602, and 651.191 MiB. All nine launches passed. Each replay arm built one pipeline before guest entry and accepted both blobs at first bind. The off and parent arms each built both passes cold. This synthetic case measures one stream using Windows PeakJobMemoryUsed. The retail smoke log reports a different counter.

Could you repeat the 60-second retail smoke on the exact NVIDIA parent af2cecc4 and this head with equivalently primed caches and the same settings? If possible, keep the graphics preparation result and the XCL_PSO_TRACE=1 lines for the mesh passes so we can tell whether the replay ran in each pair.

@MatyEjsr

MatyEjsr commented Nov 26, 2026 •

Copy link
Copy Markdown

Independent Windows / NVIDIA verification of PR #2828 at exact head b04438c7533111277ab2b5b532335682c1989a82 against its exact nvidia-dev parent af2cecc40886a8682ecf3267f5328c6dc4b66ad7 (no local patches).

Tested

  • OS / hardware: Windows 11 Pro for Workstations Build 26200, AMD Ryzen 7 7800X3D, NVIDIA GeForce RTX 3090 24 GB (driver 32.0.16.1742 / 617.42), 31.4 GB RAM, Windows Developer Mode enabled.
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, dxcompiler.dll 1.9.0.5512.
  • cargo build --workspace -j 8: exited 0.
  • cargo test --workspace -j 8 --no-fail-fast -- --test-threads=8 --nocapture (XCL_ADAPTER=NVIDIA): 1751 passed, 6 failed, 48 ignored across 44 harnesses, plus 29 GPU/capability SKIPPED notices (21 no wave64, 3 wave32 per-lane unsupported, 2 no heap windows, 3 missing D3D12 debug layer; skips not counted as coverage).
  • Targeted tests on b04438c7:
    • cargo test -p xcl --lib gfx_records -- --nocapture: 9 passed, 0 failed, 0 ignored.
    • cargo test -p xcl --lib a_graphics_record_is_built_only_with_its_own_shaders -- --nocapture: 1 passed, 0 failed, 0 ignored.
  • Base parity check on af2cecc40886a8682ecf3267f5328c6dc4b66ad7: all 6 failing tests (pieces_hold_the_texels_of_their_levels, gpu_parts_of_a_texture_go_up_and_the_rest_stays, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, async_compute_pso_registers_real_pso_and_not_standin, and both two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs harnesses) fail identically on af2cecc4. Zero regressions from PR Shaders: replay compatible two-pass mesh pipelines at startup #2828.

Regression run
Paired 60-second retail startup smoke (scripts/smoke.ps1, XCL_ADAPTER=NVIDIA, same title label c1cc91a4) on exact nvidia-dev parent af2cecc4 vs PR head b04438c7:

xcl-smoke v1
commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7
gpu: NVIDIA GeForce RTX 3090
title: c1cc91a4
seconds: 60
exit: 0x0
frames shown: 1590 (PresentX 1590)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15591 MB
xcl-smoke v1
commit: b04438c7533111277ab2b5b532335682c1989a82
gpu: NVIDIA GeForce RTX 3090
title: c1cc91a4
seconds: 60
exit: 0x0
frames shown: 1601 (PresentX 1601)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14927 MB
  • Frames shown: 1601 vs 1590 (100.7%); peak commit: 14927 MB vs 15591 MB (95.7%), 0 device removals, 0 crashes. Against the exact nvidia-dev parent af2cecc4, no >125% peak-commit increase appeared.
  • Graphics startup preparation on b04438c7 completed in 0 s (4 made, 0 failed; driver blobs: 0 from disk, 4 kept, 0 of 4 workers failed, 1 of 5 graphics pipelines left out). used-graphics-pipelines.bin stayed at 1109 bytes (tag1=5, tag3=0) before and after the run, so this 60 s startup window did not record or replay any tag-3 two-pass mesh entries.
  • Branch & source review: currently MERGEABLE against origin/nvidia-dev (ea0698d4, 37 commits ahead of af2cecc4, no intervening edits to gfx_records.rs or shaders.rs). Clean V1-compatible MESH_PIPELINE (tag=3) encoding/validation with canonical varints (bounded_var), safe cold-build fallback (None) for unsupported subobjects, and matching pso_async::release cleanup. No duplicate or superseded PR found; shares 3 files (gfx_records.rs, real.rs, shaders.rs) with open PR #2829 (also targeting nvidia-dev).

Not tested

  • AMD / Intel GPUs and native wave64 execution.
  • In-world retail recording and startup replay of two-pass mesh pipelines (the 60 s startup window stayed at 5 legacy tag-1 entries and 0 tag-3 entries; XCL_PSO_TRACE=1 was not enabled).
  • Optional pixel-shader replay in retail runs and heap-window fallback.

AI use

  • Antigravity (agy) with gemini-pro-orchestrator-argon (audited by gemini-pro-orchestrator-argon) ran the builds, workspace/targeted tests, base failure checks, and retail smoke comparison, reviewed the diff, and audited this report.

@SlopTart

Copy link
Copy Markdown

Linux (Wine) dual-lane run at head b04438c7

Same two hosts and suite as our earlier rows on this stack (#2815/#2816/#2817), run against today's nvidia-dev base (af2cecc4) measured the same day:

  • Rig: Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT (Mesa 26.2.5 RADV), Arch, wine-11.0 Proton build + vkd3d-proton, rustc 1.94.0
  • Boxb: i5-10600K, 16 GB DDR4, GTX 1070 (driver 550.163.01), Debian 13, stock wine-10.0 + vkd3d-proton, xvfb

Suite: cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::.

Results at b04438c7:

  • Rig: 872 passed / 6 failed (base 869/6). The +3 are this PR's new gfx_records tests — a_mesh_entry_preserves_moved_shader_slot_order_and_state, mesh_entries_require_supported_unique_layout_and_exact_payload, legacy_pipeline_and_mesh_entries_share_version_one_history — all green on both lanes. Red sets byte-identical to base on both.
  • Boxb: 868 passed / 10 failed (base 865/10), same deltas, same identical red sets (the 10 are our standing NVIDIA-lane set on this branch).

Startup-replay note: this PR replays compatible two-pass mesh pipelines from gfx_records history at startup. Our lanes exercise the record/readback path under Wine where the two-pass family (#2815-17 stack) previously behaved fine on both vendors; the new record format compatibility tests pass without touching that behavior. No startup replay happens in the lib suite itself (no title cache present).

Not tested: actual startup replay against a recorded title cache — needs xcl run on a title, which we don't have.

AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

@throny

throny commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Test report: into the world on an RTX 4080 16 GB, together with #2831. Starts fine, replays 477 pipelines in 1 s, no growth in commit here; the world behaves as before.

Tested

Not tested

  • Whether the mesh draws come out right (frame dumps time out in the world on this card), the two PRs one by one, the suite, AMD.

AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants