Classify shader write hazards in one instruction decode #529

Open
holoslicer wants to merge 0 commits from holoslicer/Darner:perf/classify-shader-writes-once into Main
Contributor

Tested offline. Gameplay FPS and end-to-end pipeline creation time are unmeasured.

Contributor role (optional)

Please grant the Darner Contributor role on merge. My Fluxer ID is 1577921940104949761.

What it changes

A pipeline could decode the same GFX10 instructions twice while classifying shader writes. Read-only and image-only programs were scanned again for image stores or atomics after checking for buffer and raw-address writes. This change collects all three answers in one pass per stage. Undecodable code stays conservative, scratch stores stay private, and raw-address writes can end the scan early.

How it was tested

  • Tested b5be4d4 against c8258f9. Windows x64, Core i7-12700K, RTX 3090, NVIDIA 617.42.
  • Run cargo test --locked -p darner-gpu --lib pipeline::tests:: -- --test-threads=1. Seven tests passed and two opt-in tests were ignored. The classification fixture covers read-only code, image loads/stores/atomics, buffer/global/flat/scratch writes, indirect jumps, empty or malformed inputs, and stages in both orders.
  • For the CPU comparison, parse the same local pipelines/known-shaders.bin and run both revisions' write classification on each batch of 192 programs. Time the classifier only. Keep parsing, file I/O, result comparisons and decode counters outside the timed region. Alternate which implementation goes first across batches and repetitions. Both implementations use the same decoder. The final run used release-mode code, seven passes, with Darner, the preload and competing builds stopped.
Classification of 19,123 native programs Main Change
Native instruction decodes 35,411 19,123
Median of seven passes 8.971 s 5.377 s
Fastest to slowest pass 8.952–9.044 s 5.359–5.401 s
Programs with different hazard flags 0
  • The median classifier time fell 40.1%. A separate three-pass run while an 18-worker preload was active measured 15.403 s and 9.368 s. No game assets or captures are included.
  • Both workspace Clippy gates passed with --all-targets --locked -- -D warnings, including the separate --all-features run. cargo xtask policy passed.
  • An initial workspace run during heavy load failed three GPU tests. On the Windows host, cargo test --locked --offline --workspace --no-fail-fast -- --test-threads=1 --skip oracle64::legacy_mul_forms_are_exact passed, including all 1,823 enabled GPU tests. Each of those three tests also passed individually on main and on this commit. The unmodified exhaustive all-f32 multiply oracle was excluded from the passing run. The complete unfiltered workspace gate therefore remains outstanding.
  • Existing synchronization decisions and user settings are preserved. The timings cover one host CPU and one shader workload.

Checklist

  • Offline CPU comparisons and correctness tests ran. Gameplay was outside this test.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • This patch has no prerequisites.

Checked for overlap

  • Searched open and closed issues and PRs by symptom and classifier function and checked open PRs touching this file.
  • #187 also touches pipeline.rs for zero-group dispatch handling. I found no PR covering this classification change.
Tested offline. Gameplay FPS and end-to-end pipeline creation time are unmeasured. ## Contributor role (optional) Please grant the Darner Contributor role on merge. My Fluxer ID is `1577921940104949761`. ## What it changes A pipeline could decode the same GFX10 instructions twice while classifying shader writes. Read-only and image-only programs were scanned again for image stores or atomics after checking for buffer and raw-address writes. This change collects all three answers in one pass per stage. Undecodable code stays conservative, scratch stores stay private, and raw-address writes can end the scan early. ## How it was tested - Tested `b5be4d4` against `c8258f9`. Windows x64, Core i7-12700K, RTX 3090, NVIDIA 617.42. - Run `cargo test --locked -p darner-gpu --lib pipeline::tests:: -- --test-threads=1`. Seven tests passed and two opt-in tests were ignored. The classification fixture covers read-only code, image loads/stores/atomics, buffer/global/flat/scratch writes, indirect jumps, empty or malformed inputs, and stages in both orders. - For the CPU comparison, parse the same local `pipelines/known-shaders.bin` and run both revisions' write classification on each batch of 192 programs. Time the classifier only. Keep parsing, file I/O, result comparisons and decode counters outside the timed region. Alternate which implementation goes first across batches and repetitions. Both implementations use the same decoder. The final run used release-mode code, seven passes, with Darner, the preload and competing builds stopped. | Classification of 19,123 native programs | Main | Change | |---|---:|---:| | Native instruction decodes | 35,411 | 19,123 | | Median of seven passes | 8.971 s | 5.377 s | | Fastest to slowest pass | 8.952–9.044 s | 5.359–5.401 s | | Programs with different hazard flags | | 0 | - The median classifier time fell 40.1%. A separate three-pass run while an 18-worker preload was active measured 15.403 s and 9.368 s. No game assets or captures are included. - Both workspace Clippy gates passed with `--all-targets --locked -- -D warnings`, including the separate `--all-features` run. `cargo xtask policy` passed. - An initial workspace run during heavy load failed three GPU tests. On the Windows host, `cargo test --locked --offline --workspace --no-fail-fast -- --test-threads=1 --skip oracle64::legacy_mul_forms_are_exact` passed, including all 1,823 enabled GPU tests. Each of those three tests also passed individually on main and on this commit. The unmodified exhaustive all-f32 multiply oracle was excluded from the passing run. The complete unfiltered workspace gate therefore remains outstanding. - Existing synchronization decisions and user settings are preserved. The timings cover one host CPU and one shader workload. ## Checklist - [x] Offline CPU comparisons and correctness tests ran. Gameplay was outside this test. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] This patch has no prerequisites. ## Checked for overlap - [x] Searched open and closed issues and PRs by symptom and classifier function and checked open PRs touching this file. - #187 also touches `pipeline.rs` for zero-group dispatch handling. I found no PR covering this classification change.
TrustNo1 changed title from [pr-performance][shaders] Classify shader write hazards in one instruction decode to Classify shader write hazards in one instruction decode 2026-12-06 03:27:40 +00:00
Owner

Test needed — commit b5be4d46; what to check: A pipeline could decode the same GFX10 instructions twice while classifying shader writes. Read-only and image-only programs were scanned again for image stores or atomics after checking for buffer and raw-address writes. This change collects all three answers in one pass per stage. Undecodable code stays conservative, scratch stores stay private, and raw-address writes can end the scan early.

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 `b5be4d46`; what to check: A pipeline could decode the same GFX10 instructions twice while classifying shader writes. Read-only and image-only programs were scanned again for image stores or atomics after checking for buffer and raw-address writes. This change collects all three answers in one pass per stage. Undecodable code stays conservative, scratch stores stay private, and raw-address writes can end the scan early. 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 branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/classify-shader-writes-once:holoslicer-perf/classify-shader-writes-once'
git switch 'holoslicer-perf/classify-shader-writes-once'

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 'holoslicer-perf/classify-shader-writes-once'
git switch 'holoslicer-perf/classify-shader-writes-once'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'holoslicer-perf/classify-shader-writes-once'
git switch 'holoslicer-perf/classify-shader-writes-once'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'holoslicer-perf/classify-shader-writes-once'
git switch 'Main'
git merge --squash 'holoslicer-perf/classify-shader-writes-once'
git switch 'Main'
git merge --ff-only 'holoslicer-perf/classify-shader-writes-once'
git switch 'Main'
git merge 'holoslicer-perf/classify-shader-writes-once'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!529
No description provided.