WIP: [pr-performance][shaders][INTEL] Use the cheaper legacy products on Intel cards #38

Draft
kisekinopureya wants to merge 3 commits from kisekinopureya/Darner:kisekinopureya/pr/legacy-products into main
Contributor

Contributor role (optional)

  • Fluxer ID: 1576376229534109696

What it changes

v_mul_legacy_f32 and the like (0 times anything is 0) were spelled out in full on every host but
AMD: a product, two comparisons, an OR and a select. On an Intel card they now take AMD's form
(rdna::LEGACY): a plain product where no factor can be infinite or NaN while the other is 0, and one
comparison where it can. A zero may have the other sign. DARNER_INTEL_LEGACY_MUL=0 turns it off.
Also adds the diagnostic DARNER_LEGACY_PLAIN=1 (plain products everywhere, for measuring). Both are
in the shader cache key.

How it was tested

  • Tested revision: 413c343262 (rebased onto 1a5286a7; the gates re-run there)
  • Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass.
  • Gameplay: in the base-branch runs on an Arc A770; not judged separately.
  • Coverage gaps: VIctory-NVIDIA measured at most about 7 ms of ~178 for this; not measured with
    Darner.

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 #31 (host_intel)

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #10 (legacy multiplies on AMD, DARNER_LEGACY_MIN: a different change in the same lowering).

🤖 Generated with Claude Code

## Contributor role (optional) - Fluxer ID: 1576376229534109696 ## What it changes `v_mul_legacy_f32` and the like (0 times anything is 0) were spelled out in full on every host but AMD: a product, two comparisons, an OR and a select. On an Intel card they now take AMD's form (`rdna::LEGACY`): a plain product where no factor can be infinite or NaN while the other is 0, and one comparison where it can. A zero may have the other sign. `DARNER_INTEL_LEGACY_MUL=0` turns it off. Also adds the diagnostic `DARNER_LEGACY_PLAIN=1` (plain products everywhere, for measuring). Both are in the shader cache key. ## How it was tested - Tested revision: 413c343262 (rebased onto `1a5286a7`; the gates re-run there) - Commands and results: both clippy gates clean; the shader cache key, menu and panel tests pass. - Gameplay: in the base-branch runs on an Arc A770; not judged separately. - Coverage gaps: VIctory-NVIDIA measured at most about 7 ms of ~178 for this; not measured with Darner. ## 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 #31 (host_intel) ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #10 (legacy multiplies on AMD, `DARNER_LEGACY_MIN`: a different change in the same lowering). 🤖 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)
v_mul_legacy_f32 and the like (0 times anything is 0) were spelled out
in full on every host but AMD: a product, two comparisons, an OR and a
select. On an Intel card they now take AMD's form (rdna::LEGACY): a
plain product where no factor can be an infinity or no number where the
other is 0, and one comparison where it can; a zero may have the other
sign. DARNER_INTEL_LEGACY_MUL=0 turns it off (in the shader cache key).

Replay of the prison cell on an Arc A770, everything else alike: 931 of
the frame's 1,102 programs translate otherwise; the frame takes 278 ms
on the card instead of 308, CS_GenerateMaterialMasks 21.1 ms instead of
26.9, and the picture is 60.6 dB from the exact one, no pixel off by
more than 24 of 255. A warm game run renders the cell right.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 00ba1d1ac687632eee9075ceb5c234ef95fbf744)
Compute DXIL in the cell frame has 2.5 operations per console
instruction, mostly selects and ands. The legacy products' zero check
and the tiled shadows' predicated deep form account for most of them,
but neither costs much of the frame: skipping all tiled-shadow programs
saves about 3 ms, and plain legacy products (the new diagnostic
DARNER_LEGACY_PLAIN=1, in the shader cache key) at most about 7 ms of
~178. Volumetric scattering (about 12 ms) is native ray-march work.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit de8cfb2c50d96b52bb56f88654be93be17f4075a)
kisekinopureya force-pushed kisekinopureya/pr/legacy-products from 01231e743a to 413c343262 2026-12-03 21:13:41 +00:00 Compare
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 'kisekinopureya/pr/legacy-products:kisekinopureya-kisekinopureya/pr/legacy-products'
git switch 'kisekinopureya-kisekinopureya/pr/legacy-products'

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/legacy-products'
git switch 'kisekinopureya-kisekinopureya/pr/legacy-products'
git rebase 'main'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/legacy-products'
git switch 'kisekinopureya-kisekinopureya/pr/legacy-products'
git rebase 'main'
git switch 'main'
git merge --no-ff 'kisekinopureya-kisekinopureya/pr/legacy-products'
git switch 'main'
git merge --squash 'kisekinopureya-kisekinopureya/pr/legacy-products'
git switch 'main'
git merge --ff-only 'kisekinopureya-kisekinopureya/pr/legacy-products'
git switch 'main'
git merge 'kisekinopureya-kisekinopureya/pr/legacy-products'
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!38
No description provided.