WIP: Register distinct shader containers concurrently #649

Draft
SmallDevBigNothing wants to merge 1 commit from SmallDevBigNothing/Darner:codex/parallel-shader-intern into Main
Contributor

Refs #541

What it changes

The shared shader table holds its mutex while copying a new container and scanning its bytes for lighting or mirror roles. Give each content hash its own initialisation cell. The table lock covers lookup and insertion, and threads can initialise different shaders independently. Requests for the same shader still share one container and translation. Shader cache keys are unchanged.

How it was tested

  • Tested d0fffa2 against c8258f9 on a Core Ultra 5 225F and Windows 11 build 26100.

  • Replayed 161,376 calls from a local pipeline book in an optimised standalone harness, using the revisions' registration and classification code. The same 19,100 distinct containers and classification counts were observed. File reads and parsing were outside the timed interval. Four fresh processes per build and thread count, alternating which build went first.

    Median registration time Main Patch
    Cold table, 8 threads 468.12 ms 106.97 ms
    Warm table, 8 threads 52.23 ms 50.48 ms
    Cold table, 1 thread 645.70 ms 646.71 ms
    Warm table, 1 thread 329.26 ms 328.54 ms
  • cargo test --locked --profile fast -p darner-gpu --lib pipeline::tests::: 8 passed, 2 ignored. The new test checks that eight concurrent requests share the same classified shader.

  • cargo build --locked --profile fast -p darner, cargo clippy --locked -p darner-gpu --all-targets -- -D warnings, asset policy and git diff --check passed. Full workspace gates were outside this check.

  • Gameplay smoke test: RTX 3060 12 GB, Series S 960×540 to 1080p, DLSS Performance, FSR 3 ×2, RT off. The patched build completed the 42 s scene window with a warm pipeline library, zero dropped CSV rows and zero host pipeline creation failures.

  • Scope: the replay measures CPU time in shader registration. Total loading time, driver compilation and steady-state FPS were outside the A/B.

Checklist

  • Tested the Windows GPU crate and ran the patched build in the game.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • Depends on: none.

Checked for overlap

  • Searched issues and pull requests for the symptom and the changed file.
  • Related: #187 and #529 touch other pipeline code. #554 adds shader metadata. #599 touches the same registration function to record opted-in shader sources, and may need a small merge adjustment.
  • Replaces: none.
Refs #541 ## What it changes The shared shader table holds its mutex while copying a new container and scanning its bytes for lighting or mirror roles. Give each content hash its own initialisation cell. The table lock covers lookup and insertion, and threads can initialise different shaders independently. Requests for the same shader still share one container and translation. Shader cache keys are unchanged. ## How it was tested - Tested `d0fffa2` against `c8258f9` on a Core Ultra 5 225F and Windows 11 build 26100. - Replayed 161,376 calls from a local pipeline book in an optimised standalone harness, using the revisions' registration and classification code. The same 19,100 distinct containers and classification counts were observed. File reads and parsing were outside the timed interval. Four fresh processes per build and thread count, alternating which build went first. | Median registration time | Main | Patch | |---|---:|---:| | Cold table, 8 threads | 468.12 ms | 106.97 ms | | Warm table, 8 threads | 52.23 ms | 50.48 ms | | Cold table, 1 thread | 645.70 ms | 646.71 ms | | Warm table, 1 thread | 329.26 ms | 328.54 ms | - `cargo test --locked --profile fast -p darner-gpu --lib pipeline::tests::`: 8 passed, 2 ignored. The new test checks that eight concurrent requests share the same classified shader. - `cargo build --locked --profile fast -p darner`, `cargo clippy --locked -p darner-gpu --all-targets -- -D warnings`, asset policy and `git diff --check` passed. Full workspace gates were outside this check. - Gameplay smoke test: RTX 3060 12 GB, Series S 960×540 to 1080p, DLSS Performance, FSR 3 ×2, RT off. The patched build completed the 42 s scene window with a warm pipeline library, zero dropped CSV rows and zero host pipeline creation failures. - Scope: the replay measures CPU time in shader registration. Total loading time, driver compilation and steady-state FPS were outside the A/B. ## Checklist - [x] Tested the Windows GPU crate and ran the patched build in the game. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] Depends on: none. ## Checked for overlap - [x] Searched issues and pull requests for the symptom and the changed file. - Related: #187 and #529 touch other pipeline code. #554 adds shader metadata. #599 touches the same registration function to record opted-in shader sources, and may need a small merge adjustment. - Replaces: none.
TrustNo1 changed title from WIP: [pr-performance][shaders][startup] Register distinct shader containers concurrently to WIP: Register distinct shader containers concurrently 2026-12-06 03:25:32 +00:00
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'codex/parallel-shader-intern:SmallDevBigNothing-codex/parallel-shader-intern'
git switch 'SmallDevBigNothing-codex/parallel-shader-intern'

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 'SmallDevBigNothing-codex/parallel-shader-intern'
git switch 'SmallDevBigNothing-codex/parallel-shader-intern'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'SmallDevBigNothing-codex/parallel-shader-intern'
git switch 'SmallDevBigNothing-codex/parallel-shader-intern'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'SmallDevBigNothing-codex/parallel-shader-intern'
git switch 'Main'
git merge --squash 'SmallDevBigNothing-codex/parallel-shader-intern'
git switch 'Main'
git merge --ff-only 'SmallDevBigNothing-codex/parallel-shader-intern'
git switch 'Main'
git merge 'SmallDevBigNothing-codex/parallel-shader-intern'
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!649
No description provided.