WIP: [pr-performance][shaders][INTEL] Port the paired-lanes form for wave64 compute on 32-lane hosts #43

Draft
kisekinopureya wants to merge 10 commits from kisekinopureya:kisekinopureya/pr/paired-lanes into main
Contributor

Contributor role (optional)

  • Fluxer ID: 1576376229534109696

What it changes

From the Whiplash-NVIDIA tree: one host wave of 32 lanes runs one console wave of 64, each thread
running console lanes n and n + 32.

  • Every per-lane branch is taken wave-wide.
  • LDS inside the wave is ordered by fences, not group barriers.
  • The only barrier added is on entry, where a group of several console waves numbers them.
  • Programs using ray queries are refused in this form.

It is tried only when asked for: DARNER_WAVE_PAIRS=1 (every wave64 compute program) or
DARNER_PAIRED_ONLY=<digest prefix or program text>. Both are in the shader cache key.

On an Intel card the light clustering takes the paired form: 289 ms on the card in a replay of the
prison cell (wave-wide 523, approximate 281), 50.0 dB against the wave-wide picture.
DARNER_CLUSTER_LIGHTS=paired|approximate|exact picks the form, replacing
DARNER_CLUSTER_LIGHTS_EXACT.

Open question: the paired form's lane swap was written for VIctory-NVIDIA's lowering. Darner's lowering
has an lds_batch state that I could not confirm the swap covers.

Merge notes:

  • This branch and the barycentrics PR (#32) edit the same place in lower.rs; whichever merges
    second needs a rebase there.
  • See also the mesh-corners guard (#40).

How it was tested

  • Tested revision: 8eae5f2542 (rebased onto 1a5286a7; the gates re-run there)
  • Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass;
    paired_tests and wave64_tests pass.
  • Gameplay: in the base-branch runs on an Arc A770 (the clustering in the paired form); not judged
    separately.
  • Coverage gaps: the replay numbers are from VIctory-NVIDIA.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on #33 (light clustering), which depends on #31

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #10 (also changes crates/darner-shader/src/emit/lower.rs).

🤖 Generated with Claude Code

## Contributor role (optional) - Fluxer ID: 1576376229534109696 ## What it changes From the Whiplash-NVIDIA tree: one host wave of 32 lanes runs one console wave of 64, each thread running console lanes n and n + 32. - Every per-lane branch is taken wave-wide. - LDS inside the wave is ordered by fences, not group barriers. - The only barrier added is on entry, where a group of several console waves numbers them. - Programs using ray queries are refused in this form. It is tried only when asked for: `DARNER_WAVE_PAIRS=1` (every wave64 compute program) or `DARNER_PAIRED_ONLY=<digest prefix or program text>`. Both are in the shader cache key. On an Intel card the light clustering takes the paired form: 289 ms on the card in a replay of the prison cell (wave-wide 523, approximate 281), 50.0 dB against the wave-wide picture. `DARNER_CLUSTER_LIGHTS=paired|approximate|exact` picks the form, replacing `DARNER_CLUSTER_LIGHTS_EXACT`. Open question: the paired form's lane swap was written for VIctory-NVIDIA's lowering. Darner's lowering has an `lds_batch` state that I could not confirm the swap covers. Merge notes: - This branch and the barycentrics PR (#32) edit the same place in `lower.rs`; whichever merges second needs a rebase there. - See also the mesh-corners guard (#40). ## How it was tested - Tested revision: 8eae5f2542 (rebased onto `1a5286a7`; the gates re-run there) - Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass; `paired_tests` and `wave64_tests` pass. - Gameplay: in the base-branch runs on an Arc A770 (the clustering in the paired form); not judged separately. - Coverage gaps: the replay numbers are from VIctory-NVIDIA. ## Checklist - [ ] 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 #33 (light clustering), which depends on #31 ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #10 (also changes `crates/darner-shader/src/emit/lower.rs`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The vendor is part of the host settings and the translation fingerprint
(lower::host_intel, set when the device is made), for the Intel-only forms
that follow.

In VIctory-NVIDIA this came with leaving the particle light atlas
unfolded on Intel cards (the folded CS_lightAtlas programs hung an Arc
A770's device in the prison cell in three runs of three). Darner already
leaves it unfolded on every card (UNFOLDED_BY_DEFAULT), so only the vendor
detection is ported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 18e8c457d1c80244e9da74b094dc70311e397428)
tiled_lighting:CS_ClusterLightsWorldSpace (groups of 64) fell back to an
approximate local-waves form, each host wave building its own half of a
console wave's light lists: the blocky checkerboard on lit surfaces seen
on an Arc A770. It joins the wave-wide-by-default list. Adds the ignored
forms_of_dumped_containers diagnostic test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit e5b1788c470b8fd9c70e3b5092d8f814d7de332d)
A first-lane read in the wave-wide form exchanged the two halves' "has a
lane" flags and then their values, four group barriers. Both words now go
through one exchange of four LDS words a console wave (two barriers),
falling back to the two exchanges where private LDS is short. On the
Arc A770 the light clustering's dispatch went from 228 to about 125 ms a
frame (127 to 75 barrier sites). The forms test can also save each
translation (DARNER_FORMS_OUT).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b173c163cfae6716acbc1a4c30621d4a0d6f4bff)
tiled_lighting:CS_ClusterLightsWorldSpace was made exact (wave-wide
branches) for the Arc's checkerboard, which turned out to be the
shadow masks' LDS race. On an A770 its exact form costs most of the
frame: in a replay of the prison cell 244 of 523 ms on the card. In its
approximate form the frame took 281 ms, with a picture as close to the
exact one (46.3 dB) as two runs of the exact form are to each other.
On an Intel card it now keeps that form; DARNER_CLUSTER_LIGHTS_EXACT=1
restores the exact one (in the shader cache key). Other cards are
unchanged.

In a five-minute XeSS quality run the cell went from about 2.2 to
4.5-5.8 fps. That run lost the device once after 110 s; a repeat with
full DRED did not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 128101fe53959fbf2ce97004ed31d33eae9b46ea)
Docs that stay in VIctory-NVIDIA (the Arc tracker, the XeSS notes) are
named as its; the product is Darner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 594c87446d023c4268dcfd482d1bdd989ac4fe48)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 1045f0ce51fab3a70dc8e1d1f0f6d39a82e3e419)
From the Whiplash-NVIDIA tree: one host wave of 32 lanes runs one console
wave of 64, each thread running console lanes n and n + 32. Every per-lane
branch is taken wave-wide (structure_wide); LDS inside the wave is ordered
by fences, not group barriers; the only barrier added is on entry, where a
group of several console waves numbers them. It is tried after the folded
form and before the approximate and wave-wide forms, and only when asked
for: DARNER_WAVE_PAIRS=1 (every wave64 compute program) or
DARNER_PAIRED_ONLY=<digest prefix or program text>, both in the shader
cache key.

Differences from Whiplash-NVIDIA: a dispatch counted in threads, and wave
sums of 16-bit floats and of doubles, are refused in this form.

emit/paired_tests.rs (four tests: LDS and lane reads across the halves
without barriers, waves looping apart, permutes and lane writes, a wave OR
in a lane branch) pass on an Arc A770. docs/arc-perf-comparison.md compares
this tree's Arc frame time with the Whiplash AMD and NVIDIA trees.

Darner: tried right after the fold closure is defined (Darner folds later in its ladder), and refused for programs with lifted ray queries, whose per-block state is one lane's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 7c7c0948eb38d2d451a0ce5a65266ca1bf3629d6)
What the merge of arc-perf-compare into intel-arc decided: on an Intel
card tiled_lighting:CS_ClusterLightsWorldSpace takes the paired form
(falling to the approximate one if the lowering refuses it), and
DARNER_CLUSTER_LIGHTS=approximate or exact picks another (replacing
DARNER_CLUSTER_LIGHTS_EXACT, in the shader cache key). Other cards keep
the wave-wide form. Replay of the prison cell on an A770: wave-wide
523 ms a frame on the card, approximate 281 ms, paired 289 ms; against
the wave-wide picture paired 50.0 dB, approximate 46.3 dB, two
wave-wide runs 46.2 dB. DARNER_WAVE_PAIRS=0 turns the paired default
off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 90a9963c85b4d2278af6977332aa27acc3cfff9a)
A program named there now takes the paired form before the plain
lowering, which may translate a console wave64 program as two host
waves exchanging cross-lane values through group barriers. Refused, the
program goes on as before. Defaults are unchanged.

For CS_GenerateMaterialMasks on an Arc A770 this removed its five group
barriers: its list replayed alone fell from 38.6 to 27.0 ms and the
picture is 61.2 dB from the default. The whole frame did not change
(about 182 ms either way): the card had filled those waits with the
next lists' work, so the frame is bound by total work. Recorded in
docs/arc-a770.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 1da6dbb8742d6588a8e2a671d93bcb5fd148d833)
Docs that stay in VIctory-NVIDIA (the Arc tracker, the XeSS notes) are
named as its; the product is Darner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 096379aa62bf4bd4fdd2263f2122c4902b2ae3a5)
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'kisekinopureya/pr/paired-lanes:kisekinopureya-kisekinopureya/pr/paired-lanes'
git switch 'kisekinopureya-kisekinopureya/pr/paired-lanes'

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 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git switch 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git rebase 'main'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git switch 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git rebase 'main'
git switch 'main'
git merge --no-ff 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git switch 'main'
git merge --squash 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git switch 'main'
git merge 'kisekinopureya-kisekinopureya/pr/paired-lanes'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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!43
No description provided.