WIP: Opt-in ordered mesh dispatch fusion, deferred mesh outputs and a compute tiling prototype #601

Draft
deama wants to merge 60 commits from deama/Darner:pr/8-mesh-fusion into Main
First-time contributor

Not run in the game on Darner. Ported from a local VIctory-NVIDIA branch (before the rename). The notes below describe that branch.

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: runs of small mesh dispatches with the same pipeline each pay their own root setup and execution. Read from the code, plus the VIctory branch's mesh-group census.

Fourteen commits (the last one fixes the shader cache key for the new switches); the features are all behind switches that are off by default:

  • gpu: measure pixel-root compatibility of recorded mesh groups

  • gpu: count compatible pixel-root subruns within mesh groups

  • gpu: validate ordered mesh dispatch fusion with varying per-draw data

  • shader: add explicit per-draw mesh fusion variants with semantic admission

  • gpu: fuse ordered mesh runs through bounded batch prefixes and retained pipelines

  • gpu: measure mesh fusion GPU selection and prepared execution cost

  • shader: add shared ordinary and fused mesh transport with uniform selection

  • gpu: execute admitted mesh batches through a shared full-width pipeline

  • gpu: keep mesh root runs across unused input-assembler changes

  • gpu: batch mesh aliases only when exact host pipeline identity matches

  • gpu: compare final mesh heap state and resolve the effective pipeline once

  • gpu: prototype exact compute group tiling for selected load-stalled passes

  • gpu: retain mesh outputs and bound allocations by their complete writes

  • shader cache: key DARNER_COMPUTE_TILE_SHADERS; the fusion and tiling tests' variables change no translation

  • DARNER_MESH_ROOT_CENSUS: counts pixel-root-compatible runs and subruns within recorded mesh groups.

  • DARNER_MESH_FUSION=1 (needs DARNER_INDIRECT_ROOTS=1): ordered mesh runs are fused through bounded batch prefixes and retained pipelines. The shader translator adds explicit per-draw fusion variants with semantic admission: quad operations stay inside one primitive's quad, and the fusion quad scope covers main's helper-lane fix. A shared ordinary/fused transport with uniform selection (DARNER_MESH_FUSION_SHARED). Mesh roots are kept across unused input-assembler changes. Aliases batch only when the exact host pipeline identity matches. The final heap state is compared. DARNER_MESH_FUSION_SAMPLE / _TIMES measure selection and execution cost.

  • DARNER_MESH_OUTPUT_DEFER: mesh outputs are retained, and allocations bounded, by their complete writes. This is exclusive with main's DARNER_MESH_COUNTS=exact: when that is on, its counts are used.

  • DARNER_COMPUTE_TILING_EXECUTE and DARNER_COMPUTE_TILE_SHADERS: a prototype of exact compute group tiling for selected load-stalled passes.

How it was tested

  • Tested revision: 8b9b080458
  • Commands and results: on 8b9b080458 (this branch's head), Windows 10 22H2 with its built-in Direct3D 12 (no Shader Model 6.6), Rust 1.98.1:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passed
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed
    • cargo --config 'profile.test.package.darner-shader.opt-level=3' test --workspace --locked --no-fail-fast (the opt-level only speeds up darner-shader's exhaustive float tests): 66 failed, all of which fail on unmodified main (c8258f9556) on this PC too (darner-shader tests that need Shader Model 6.6).
    • darner-gpu's test process aborts at the first test that needs Shader Model 6.6, on main too, so its tests were run in batches that survive the abort and compared one by one with main (main: 1658 pass, 8 fail, 139 need Shader Model 6.6, 81 ignored): no test that passes on main fails here, none removed; 94 new tests: 39 ignored, 55 pass.
    • cargo xtask policy: ok (640 files).
    • Not run: tests that need Shader Model 6.6 or a GPU, and the strict-WARP tests behind the diagnostics/gpu-validation features.
  • Changes a default: no.
  • A/B result: not applicable. Everything is off by default; it was checked by the unit tests above only (its strict-WARP and hardware tests were not run here).
  • Gates run on that revision: see above.
  • Gameplay: not run on Darner.
  • Shader wave sizes tested: unit tests only.
  • Hardware dependence: unknown; the fused paths were not run on hardware on Darner.
  • Coverage gaps: no in-game run and no frame-time measurement. Fusion is experimental.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Not run in the game on Darner.
  • This PR contains one change based on main. No: one experimental feature set across GPU and shader code, stacked on the PRs below.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on #600 (stacked branch; builds on the indirect roots in #598 and the cost meters in #599; contains all earlier PRs)

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #39, #40 and #41 (Intel mesh fixes; different problems in mesh translation).
  • Replaces or overlaps: none found
**Not run in the game on Darner.** Ported from a local VIctory-NVIDIA branch (before the rename). The notes below describe that branch. ## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: runs of small mesh dispatches with the same pipeline each pay their own root setup and execution. Read from the code, plus the VIctory branch's mesh-group census. Fourteen commits (the last one fixes the shader cache key for the new switches); the features are all behind switches that are off by default: - gpu: measure pixel-root compatibility of recorded mesh groups - gpu: count compatible pixel-root subruns within mesh groups - gpu: validate ordered mesh dispatch fusion with varying per-draw data - shader: add explicit per-draw mesh fusion variants with semantic admission - gpu: fuse ordered mesh runs through bounded batch prefixes and retained pipelines - gpu: measure mesh fusion GPU selection and prepared execution cost - shader: add shared ordinary and fused mesh transport with uniform selection - gpu: execute admitted mesh batches through a shared full-width pipeline - gpu: keep mesh root runs across unused input-assembler changes - gpu: batch mesh aliases only when exact host pipeline identity matches - gpu: compare final mesh heap state and resolve the effective pipeline once - gpu: prototype exact compute group tiling for selected load-stalled passes - gpu: retain mesh outputs and bound allocations by their complete writes - shader cache: key DARNER_COMPUTE_TILE_SHADERS; the fusion and tiling tests' variables change no translation - `DARNER_MESH_ROOT_CENSUS`: counts pixel-root-compatible runs and subruns within recorded mesh groups. - `DARNER_MESH_FUSION=1` (needs `DARNER_INDIRECT_ROOTS=1`): ordered mesh runs are fused through bounded batch prefixes and retained pipelines. The shader translator adds explicit per-draw fusion variants with semantic admission: quad operations stay inside one primitive's quad, and the fusion quad scope covers main's helper-lane fix. A shared ordinary/fused transport with uniform selection (`DARNER_MESH_FUSION_SHARED`). Mesh roots are kept across unused input-assembler changes. Aliases batch only when the exact host pipeline identity matches. The final heap state is compared. `DARNER_MESH_FUSION_SAMPLE` / `_TIMES` measure selection and execution cost. - `DARNER_MESH_OUTPUT_DEFER`: mesh outputs are retained, and allocations bounded, by their complete writes. This is exclusive with main's `DARNER_MESH_COUNTS=exact`: when that is on, its counts are used. - `DARNER_COMPUTE_TILING_EXECUTE` and `DARNER_COMPUTE_TILE_SHADERS`: a prototype of exact compute group tiling for selected load-stalled passes. ## How it was tested - Tested revision: `8b9b080458` - Commands and results: on `8b9b080458` (this branch's head), Windows 10 22H2 with its built-in Direct3D 12 (no Shader Model 6.6), Rust 1.98.1: - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed - `cargo --config 'profile.test.package.darner-shader.opt-level=3' test --workspace --locked --no-fail-fast` (the opt-level only speeds up darner-shader's exhaustive float tests): 66 failed, all of which fail on unmodified `main` (c8258f9556) on this PC too (darner-shader tests that need Shader Model 6.6). - darner-gpu's test process aborts at the first test that needs Shader Model 6.6, on `main` too, so its tests were run in batches that survive the abort and compared one by one with `main` (`main`: 1658 pass, 8 fail, 139 need Shader Model 6.6, 81 ignored): no test that passes on `main` fails here, none removed; 94 new tests: 39 ignored, 55 pass. - `cargo xtask policy`: ok (640 files). - Not run: tests that need Shader Model 6.6 or a GPU, and the strict-WARP tests behind the diagnostics/gpu-validation features. - Changes a default: no. - A/B result: not applicable. Everything is off by default; it was checked by the unit tests above only (its strict-WARP and hardware tests were not run here). - Gates run on that revision: see above. - Gameplay: not run on Darner. - Shader wave sizes tested: unit tests only. - Hardware dependence: unknown; the fused paths were not run on hardware on Darner. - Coverage gaps: no in-game run and no frame-time measurement. Fusion is experimental. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). **Not run in the game on Darner.** - [ ] This PR contains one change based on `main`. **No:** one experimental feature set across GPU and shader code, stacked on the PRs below. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on #600 (stacked branch; builds on the indirect roots in #598 and the cost meters in #599; contains all earlier PRs) ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #39, #40 and #41 (Intel mesh fixes; different problems in mesh translation). - Replaces or overlaps: none found
Ported to Darner from VIctory-NVIDIA b1443849.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refuse unsupported strict/software requests, retain bounded validation history, and guard host queue submissions. Preserve removal reports in a dedicated module. Add software-only regressions and optional link-time Agility declarations for tests.

Ported to Darner from VIctory-NVIDIA 3f156266.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebuild per-recording caches at both cut sites while retaining descriptor ownership. The current-renderer WARP regression read recycled 0xdeadbeef data before the fix and the expected constants after it; same-part and internal-pass reuse remain intact.

Ported to Darner from VIctory-NVIDIA 615e070f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep current size classes and retention accounting while checking rounding and CPU-visible limits. Cap mapped-VRAM staging and avoid oversized spare reuse. Optional one-pass predictions outside the limit fall back to ordinary staging; six focused CPU checks pass.

Ported to Darner from VIctory-NVIDIA f7f0f1ec.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reconcile the legacy transition repair with the current memory wrappers and enhanced barriers. Strict WARP catches the previous invalid COPY_DEST-to-CBV use before submission. Constant, texture-source, cross-buffer and overlapping-copy regressions pass with legacy and enhanced barriers.

Ported to Darner from VIctory-NVIDIA 0e7a5c71.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route relay fetches, card fetches and settling through the existing checked host wait. CPU regressions reject failed waits, incomplete fences and device-removal sentinels; a strict WARP copy/readback check still passes.

Ported to Darner from VIctory-NVIDIA bb4da85e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The current compiled root signature omitted DATA_VOLATILE. A software regression checks that contract and reads both successive synthetic depth values through the same bound descriptor.

Ported to Darner from VIctory-NVIDIA 838504a0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep readonly depth plus shader-read states legal across views and avoid narrowing an already-compatible state. Preserve alias/read-watch observers and exact transitions for writes and COMMON. The WARP fixture goes from two tracked transitions to none; it and the CPU state checks pass. No game FPS result asserted.

Ported to Darner from VIctory-NVIDIA a04c61e1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first guarded rework run stopped on 1024 stored cache-miss warnings rather than a GPU error. Filter only nonfatal severities in strict storage while retaining bounded, persistent errors and corruption. Software tests cover 6144 nonfatal messages followed by both fatal severities, real overflow, repeated refusal and concurrent reporting.

Ported to Darner from VIctory-NVIDIA 651f2399.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 3c6511be.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA fae572a0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA eaee9c79.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA af64880d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reuse the previously verified pose implementation and background desktop/audio setup. Restore optional frame captures and their output policy, guarded process supervision, and benchmark analysis. Keep normal play opt-in and all artifacts outside source. Pose, capture, desktop-refusal, analyzer and CPU-only watchdog checks pass.

Ported to Darner from VIctory-NVIDIA 90df996f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 0493d6cb.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA e744607a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 49ce022d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 42aa3f0f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 4dee6a3b.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 6edfc508.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA fc34fb12.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 32f7ae60.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA e7d26434.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adapted from lobomfz/VIctory-xmem fd19a20614b5e080b4bf6211ac5b7ebda682afc9 by lucalocastro. Preserve the existing alias-aware passes and default 447; add bit 512 with CPU graph and strict software DXIL execution coverage.

Ported to Darner from VIctory-NVIDIA fb5a0c84.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep guarded reads and zero-trip paths unchanged, reject every loop write, barrier, unknown effect and volatile read, and preserve the existing 447 defaults. Cover control-flow placement and exact software-rendered output; no frame-rate gain claimed.

Ported to Darner from VIctory-NVIDIA c56196e2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA b194f581.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA f1d91c6e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per-binding timestamps substantially disturbed the measured frame. Restore hashed optional sampling, retain fractional time in nanoseconds and preserve sample weights through query resolution. Whole-list and class timings remain unsampled. CPU selection/accounting and actual WARP query resolution pass. Escape existing synthetic fixture control bytes without changing their values.

Ported to Darner from VIctory-NVIDIA 2b101942.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Avoid per-list timestamp and resolve commands unless requested. Diagnostic builds retain timing by default; explicit zero overrides profiling requests. Software checks cover ordinary rendering without timing and requested sampled query resolution. Unavailable benchmark timing columns remain empty; the measured 20.6 FPS trial is preliminary, not the performance target.

Ported to Darner from VIctory-NVIDIA 221418ef.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 36a0340c.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 9bf82ffe.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA a7c1b507.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 18d50d22.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 631af449.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep profiling opt-in and read-only. Retain eight slow updates per path with cached copy metadata, separate elapsed sums by update type, and test bounded concurrent collection plus the disabled metadata contract. No allocation, copy, ordering or graphics-policy change.

Ported to Darner from VIctory-NVIDIA 3e34f76e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA b195d4d6.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 43586387.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 37b1ea40.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 88f4b130.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 2995305f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adapt the per-subresource ownership approach from lobomfz/VIctory-xmem 2039e43. Keep conservative atlas/external-write protection, capture masks before parallel preludes, and validate same-list, reordered, abandoned and array writes on strict WARP. Opt in with DARNER_GPU_WRITTEN_MIPS=1 pending game validation.

Ported to Darner from VIctory-NVIDIA 62d2715d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 1cd08bc4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cover promotions, partial writes, demotions, shader-write handoff and real renderer copy-back. Keep original hardware benchmark guards. Label declared view ranges as estimates and remove unmeasured GPU-time-saving claims.

Ported to Darner from VIctory-NVIDIA cfe12bd3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA ea3d9903.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 08edbb2e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA be64612e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 5240fa64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 0f1bd2aa.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA ce368dab.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA bb1f81f5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA cf61e0a0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 50b737c0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 9508734b.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA e5403eb3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA f5b6570a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA cbb8e32a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 15f9fbf5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 74e0822e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA e162a235.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
every_switch_of_the_translator_is_in_the_key found eleven names the mesh
fusion, mesh output and compute tiling commits added to the translator. The
tiled-program list picks how a program is translated, so it joins the key;
the others are where the tests' console programs are, whether a test runs on
the card, and a semantic name (DARNER_DRAW_ROW), not a switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TrustNo1 changed title from WIP: [pr-performance][rendering][shaders] Opt-in ordered mesh dispatch fusion, deferred mesh outputs and a compute tiling prototype to WIP: Opt-in ordered mesh dispatch fusion, deferred mesh outputs and a compute tiling prototype 2026-12-06 03:26:30 +00:00
This pull request has changes conflicting with the target branch.
  • crates/darner-game/src/lib.rs
  • crates/darner-gpu/src/cardmeter.rs
  • crates/darner-gpu/src/draw.rs
  • crates/darner-gpu/src/gpu_owned.rs
  • crates/darner-gpu/src/host.rs
  • crates/darner-gpu/src/host/bus.rs
  • crates/darner-gpu/src/host/upq.rs
  • crates/darner-shader/src/emit/mod.rs
  • docs/README-nvidia.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr/8-mesh-fusion:deama-pr/8-mesh-fusion'
git switch 'deama-pr/8-mesh-fusion'

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 'deama-pr/8-mesh-fusion'
git switch 'deama-pr/8-mesh-fusion'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'deama-pr/8-mesh-fusion'
git switch 'deama-pr/8-mesh-fusion'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'deama-pr/8-mesh-fusion'
git switch 'Main'
git merge --squash 'deama-pr/8-mesh-fusion'
git switch 'Main'
git merge --ff-only 'deama-pr/8-mesh-fusion'
git switch 'Main'
git merge 'deama-pr/8-mesh-fusion'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!601
No description provided.