perf(vk): the Lens eye pass looks for the eye's multiply before it maps a program's uses #2743

Merged
HumanBean merged 1 commit from bulldogsajr22/Longshot:perf/lens-eye-scan-first into main 2026-11-28 18:57:16 +00:00
Contributor

Summary

Follow-up to #2713 for its review's L3 (BeanBot, #2713 (comment)): the cost of the Lens of Truth eye pass at shader translation.

LensEyePass runs on every graphics fragment program that reads the effect camera bank (13) as it is translated. On main it first puts every instruction's uses in a map, and only then looks for the eye's multiply by 1.26984131 (16:9 / 1.4). In a cold shader preparation that is 13,222 fragment programs and 59.4 million instructions mapped, for the one program that has the multiply (d547af983903a518, the eye's): 5.0 s of CPU time spread over the preparation's workers.

Now the pass looks at each instruction for that multiply first, and a program with none leaves with "no eye" and nothing allocated. The uses are mapped only for a program that has one, the same map as before (the same loop over the same blocks, only after the look), so the eye and every other program translate as they did: 263 ms in all for the same programs, and the same SPIR-V (measured below).

Read first: the start of LensEyePass in gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h, then tests/lens_eye_ir.cpp (the NoScale shape and the allocation count).

See #2713.

Testing

Tested: Windows 11 Pro (26H2, build 26300), Ryzen 9 9950X3D (16 cores, 32 threads), RTX 5090, NVIDIA 621.40.

  • Cold shader preparations (longshot --prepare-shaders --compile-shaders most, what longshot-builder runs) of this PR and of main @ 22d0d200, each with an empty program cache, an empty shader store and an empty NVIDIA shader cache of its own (LONGSHOT_SHADER_CACHE, LONGSHOT_SHADER_STORE, __GL_SHADER_DISK_CACHE_PATH), 32 workers, interleaved main, PR, main, PR: all 38,809 programs prepared, 0 failed, and in each vk: program d547af983903a518: the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too.
  • The SPIR-V they made, compared by the shader store's index (each blob's content hash and length): see Measurements.
  • In the game, a build of this head (the builder's own preparation, then play): the Shadow Temple B4 save at 5120x2160 (21:9), HDR, DLSS; the Lens of Truth on, off and on again, the camera turned both ways: the eye as on main and on #2713, its tips 1.40 half heights from the centre, meeting the reveal, no unrevealed strip, the swirl round, its sides not burnt out. In play the game translated nothing (program census (play): created 0, every frame's translation 0 ms in all): a warm start never runs the pass.
  • tests/test_lens_eye_pass.py passes with clang++ (libstdc++) on Linux and llvm-mingw's clang++ (libc++) on Windows; with main's pass and this test, it fails on both for the reason it checks: no eye's multiply: 24 allocations, not 0 (26 with libc++).
  • mise run test (Ubuntu 24.04 on WSL, 32 at once): 858 passed, 20 failed, 10 skipped (Windows-only). 19 of the failures fail the same way on main @ 22d0d200 on this PC (859 passed there): test_bug_report, test_cloth_kernels, test_control_picture, test_crash_record, test_framegen_hdr, test_framegen_resources, test_guest_holes, test_input_background, test_lifter, test_linux_saves_move, test_log_open_failure, test_oot_cloth, test_perf_send, test_pipeline_tour, test_present_source_crop, test_screensaver, test_switch_table, test_temporal_present_bandwidth, test_xinput_thread. The 20th, test_fsr4_own_cache ("longshot_fsr4_pipelines.bin.tmp-123-4 was not swept"), reads none of this PR's files and passed 5 runs of 5 alone on this head and on main: it failed once under the suite's load.
  • The renderer built for Linux as CI's renderer build check does (longshot-builder compile --only renderer, the pinned llvm, sysroot and cpm): 271 of 271 units, longshot_vk.so linked; and for Windows by longshot-builder from this commit's source (the test build above).
  • mise run lint passes.

Still to test:

  • Linux, AMD, 21:9: the Lens of Truth on this head and on main, expecting the same eye on both (its tips meeting the reveal, about 59 % of the picture's width) and the eye's log line; this also runs #2713's eye on Linux AMD, its review's L1 (@Beanstalk linux, amd).
  • Steam Deck, its own 16:10: the same, expecting the eye about 88 % of the picture's width on both sides; #2713's L2 (@Beanstalk).

Measurements

Verdict: the pass's own time at a cold translation of every program down from 5,034 ms to 263 ms of CPU time (−95 %), with the same SPIR-V; on this 32-thread PC that is about 0.15 s of the translation's 50 s, within the spread of the whole preparation. A warm start translates nothing, so it is unchanged.

Baseline (first two rows): the pass's time is measured in one build, this PR plus a timing commit not in this PR (70a90119), which runs main's first part (the uses mapped first, then the look; a copy that only reads) and this PR's pass on each of the same programs, which of them first alternating. The other rows are main @ 22d0d200 and this PR, built alike from source.

Setup: Windows 11 Pro 26300, Ryzen 9 9950X3D, RTX 5090, NVIDIA 621.40; longshot --prepare-shaders --compile-shaders most with empty caches of its own each run (Testing), 32 workers; the game's own log lines; interleaved main, PR, main, PR.

Before: main @ 22d0d200 After: this PR @ b6766b8a
the Lens pass at translation, CPU time summed over the workers 5,034 ms (main's scan, timed beside the PR's) 263 ms
fragment programs whose uses it maps 13,222 (59.4 M instructions, at most 10,181 in one) 1 (the eye's)
translation, cold ("prepared 38809 shader programs ... in"), run 1 / run 2 50.5 / 51.4 s 50.6 / 50.2 s
the whole preparation, cold, run 1 / run 2 216.7 / 201.7 s 217.1 / 200.1 s
program cache / shader store, run 1 / run 2 2,378 / 2,377 MB; 3,674 / 3,674 MB 2,377 / 2,377 MB; 3,674 / 3,674 MB
SPIR-V 50,841 blobs in all four runs; run 2 made exactly those the same 50,841 in both runs

The SPIR-V: 50,841 blobs are in every run; main's second run made exactly those and nothing else, so every program as main translates it is in both of this PR's runs. Each other run also made 1 to 4 large blobs of its own (14,183 to 135,131 words), never the same twice, main's first run too: the preparation's run-to-run variation, not this change.

The timing build's line, after the preparation:

[hos host] lens diag (prepared): 106832 translations in 501369.9 ms (thread time summed); graphics fragment 47061 in 261899.1 ms, 13222 read the camera bank (59371977 instructions, at most 10181), 1 with the eye's multiply, 1 made the eye; main's uses-first scan 5033.71 ms, the pass now 262.81 ms (sink 26429668)

The preparations' lines (main 1, PR 1, main 2, PR 2):

[hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 50.5 s
[hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 50.6 s
[hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 51.4 s
[hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 50.2 s

Risks

The same eye and the same SPIR-V for every program, by construction and as measured: a program with no eye's multiply returned "no eye" on main too, after the map. A revert is enough.

What a player notices after updating: lens_eye_pass.h is in the shader translator's stamp, so the nightly that carries this prepares the shaders again once (as any translator change does; 19 commits on main moved the stamp in the past week). Nothing else: no setting, no save, no switch.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary Follow-up to #2713 for its review's L3 (BeanBot, https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2713#issuecomment-86794): the cost of the Lens of Truth eye pass at shader translation. `LensEyePass` runs on every graphics fragment program that reads the effect camera bank (13) as it is translated. On `main` it first puts every instruction's uses in a map, and only then looks for the eye's multiply by 1.26984131 (16:9 / 1.4). In a cold shader preparation that is 13,222 fragment programs and 59.4 million instructions mapped, for the one program that has the multiply (`d547af983903a518`, the eye's): 5.0 s of CPU time spread over the preparation's workers. Now the pass looks at each instruction for that multiply first, and a program with none leaves with "no eye" and nothing allocated. The uses are mapped only for a program that has one, the same map as before (the same loop over the same blocks, only after the look), so the eye and every other program translate as they did: 263 ms in all for the same programs, and the same SPIR-V (measured below). Read first: the start of `LensEyePass` in `gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h`, then `tests/lens_eye_ir.cpp` (the `NoScale` shape and the allocation count). See #2713. ## Testing **Tested:** Windows 11 Pro (26H2, build 26300), Ryzen 9 9950X3D (16 cores, 32 threads), RTX 5090, NVIDIA 621.40. - Cold shader preparations (`longshot --prepare-shaders --compile-shaders most`, what longshot-builder runs) of this PR and of `main` @ 22d0d200, each with an empty program cache, an empty shader store and an empty NVIDIA shader cache of its own (`LONGSHOT_SHADER_CACHE`, `LONGSHOT_SHADER_STORE`, `__GL_SHADER_DISK_CACHE_PATH`), 32 workers, interleaved main, PR, main, PR: all 38,809 programs prepared, 0 failed, and in each `vk: program d547af983903a518: the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too`. - The SPIR-V they made, compared by the shader store's index (each blob's content hash and length): see Measurements. - In the game, a build of this head (the builder's own preparation, then play): the Shadow Temple B4 save at 5120x2160 (21:9), HDR, DLSS; the Lens of Truth on, off and on again, the camera turned both ways: the eye as on `main` and on #2713, its tips 1.40 half heights from the centre, meeting the reveal, no unrevealed strip, the swirl round, its sides not burnt out. In play the game translated nothing (`program census (play): created 0`, every frame's `translation 0 ms in all`): a warm start never runs the pass. - `tests/test_lens_eye_pass.py` passes with clang++ (libstdc++) on Linux and llvm-mingw's clang++ (libc++) on Windows; with `main`'s pass and this test, it fails on both for the reason it checks: `no eye's multiply: 24 allocations, not 0` (26 with libc++). - `mise run test` (Ubuntu 24.04 on WSL, 32 at once): 858 passed, 20 failed, 10 skipped (Windows-only). 19 of the failures fail the same way on `main` @ 22d0d200 on this PC (859 passed there): test_bug_report, test_cloth_kernels, test_control_picture, test_crash_record, test_framegen_hdr, test_framegen_resources, test_guest_holes, test_input_background, test_lifter, test_linux_saves_move, test_log_open_failure, test_oot_cloth, test_perf_send, test_pipeline_tour, test_present_source_crop, test_screensaver, test_switch_table, test_temporal_present_bandwidth, test_xinput_thread. The 20th, test_fsr4_own_cache ("longshot_fsr4_pipelines.bin.tmp-123-4 was not swept"), reads none of this PR's files and passed 5 runs of 5 alone on this head and on `main`: it failed once under the suite's load. - The renderer built for Linux as CI's renderer build check does (`longshot-builder compile --only renderer`, the pinned llvm, sysroot and cpm): 271 of 271 units, `longshot_vk.so` linked; and for Windows by `longshot-builder` from this commit's source (the test build above). - `mise run lint` passes. **Still to test:** - Linux, AMD, 21:9: the Lens of Truth on this head and on `main`, expecting the same eye on both (its tips meeting the reveal, about 59 % of the picture's width) and the eye's log line; this also runs #2713's eye on Linux AMD, its review's L1 (@Beanstalk linux, amd). - Steam Deck, its own 16:10: the same, expecting the eye about 88 % of the picture's width on both sides; #2713's L2 (@Beanstalk). ## Measurements **Verdict:** the pass's own time at a cold translation of every program down from 5,034 ms to 263 ms of CPU time (−95 %), with the same SPIR-V; on this 32-thread PC that is about 0.15 s of the translation's 50 s, within the spread of the whole preparation. A warm start translates nothing, so it is unchanged. Baseline (first two rows): the pass's time is measured in one build, this PR plus a timing commit not in this PR (70a90119), which runs `main`'s first part (the uses mapped first, then the look; a copy that only reads) and this PR's pass on each of the same programs, which of them first alternating. The other rows are `main` @ 22d0d200 and this PR, built alike from source. Setup: Windows 11 Pro 26300, Ryzen 9 9950X3D, RTX 5090, NVIDIA 621.40; `longshot --prepare-shaders --compile-shaders most` with empty caches of its own each run (Testing), 32 workers; the game's own log lines; interleaved main, PR, main, PR. | | Before: main @ 22d0d200 | After: this PR @ b6766b8a | |---|---|---| | the Lens pass at translation, CPU time summed over the workers | 5,034 ms (`main`'s scan, timed beside the PR's) | 263 ms | | fragment programs whose uses it maps | 13,222 (59.4 M instructions, at most 10,181 in one) | 1 (the eye's) | | translation, cold ("prepared 38809 shader programs ... in"), run 1 / run 2 | 50.5 / 51.4 s | 50.6 / 50.2 s | | the whole preparation, cold, run 1 / run 2 | 216.7 / 201.7 s | 217.1 / 200.1 s | | program cache / shader store, run 1 / run 2 | 2,378 / 2,377 MB; 3,674 / 3,674 MB | 2,377 / 2,377 MB; 3,674 / 3,674 MB | | SPIR-V | 50,841 blobs in all four runs; run 2 made exactly those | the same 50,841 in both runs | The SPIR-V: 50,841 blobs are in every run; `main`'s second run made exactly those and nothing else, so every program as `main` translates it is in both of this PR's runs. Each other run also made 1 to 4 large blobs of its own (14,183 to 135,131 words), never the same twice, `main`'s first run too: the preparation's run-to-run variation, not this change. The timing build's line, after the preparation: ``` [hos host] lens diag (prepared): 106832 translations in 501369.9 ms (thread time summed); graphics fragment 47061 in 261899.1 ms, 13222 read the camera bank (59371977 instructions, at most 10181), 1 with the eye's multiply, 1 made the eye; main's uses-first scan 5033.71 ms, the pass now 262.81 ms (sink 26429668) ``` The preparations' lines (`main` 1, PR 1, `main` 2, PR 2): ``` [hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 50.5 s [hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 50.6 s [hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 51.4 s [hos host] vk: prepared 38809 shader programs (46667 new, 0 failed, 5006 compute pipelines; 9927 compute variants, 831 programs with texture variants, 59 at the limit) in 50.2 s ``` ## Risks The same eye and the same SPIR-V for every program, by construction and as measured: a program with no eye's multiply returned "no eye" on `main` too, after the map. A revert is enough. What a player notices after updating: `lens_eye_pass.h` is in the shader translator's stamp, so the nightly that carries this prepares the shaders again once (as any translator change does; 19 commits on `main` moved the stamp in the past week). Nothing else: no setting, no save, no switch. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
perf(vk): the Lens eye pass looks for the eye's multiply before it maps a program's uses
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 10s
beanstalk/approval not approved yet
b6766b8a88
Every graphics fragment program that reads the camera bank (13) came to
LensEyePass as it was translated, and each had all its instructions'
uses put in a map before the pass knew whether it had the eye's
multiply by 1.26984131 at all. Now a first look at each instruction
finds those multiplies, and a program with none leaves with "no eye"
and nothing allocated; the map is made only for a program that has one,
the same map as before, so the eye and every other program translate as
they did.

The test adds such a program (the game's, its multiply 1.3) and checks
that the pass allocates nothing on it (24 allocations with main's pass),
and each shape it refuses now for its own reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11 Pro 26300, RTX 5090, NVIDIA 621.40, HDR, DLSS: a build of this head, the Shadow Temple B4 save at 5120x2160 (21:9), the Lens of Truth on, off and on again, the camera turned both ways. The eye as on main and #2713: its tips 1.40 half heights from the centre, meeting the reveal, no unrevealed strip, the swirl round. Cold shader preparations of this head and of main 22d0d200 (empty caches each): 38,809 programs prepared, 0 failed, the eye's program made in each (log line "the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too"), the same SPIR-V.

Tested in game: Windows 11 Pro 26300, RTX 5090, NVIDIA 621.40, HDR, DLSS: a build of this head, the Shadow Temple B4 save at 5120x2160 (21:9), the Lens of Truth on, off and on again, the camera turned both ways. The eye as on main and #2713: its tips 1.40 half heights from the centre, meeting the reveal, no unrevealed strip, the swirl round. Cold shader preparations of this head and of main 22d0d200 (empty caches each): 38,809 programs prepared, 0 failed, the eye's program made in each (log line "the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too"), the same SPIR-V.
Author
Contributor

@Beanstalk linux, amd, and a Steam Deck: this head (b6766b8a) against main @ 22d0d200, the same steps on each. It also runs #2713's eye on both, its review's L1 and L2.

  1. Graphics: on Linux AMD, Aspect ratio 21:9 and Output resolution 2560x1080; on the Steam Deck, its own shape (the default, 16:10). Restart the game so it applies from the start.
  2. Load the repo save kokiri-start. On the Insert menu's Debug tab, Inventory: unlock Lens of Truth and Magic Meter (Items section). Then Teleport to Bottom of the Well.
  3. Put the Lens of Truth on a button in the item menu and use it. Standing still with the Lens on, take a screenshot; take it off and put it on again.

Expected, the same on both sides: the purple eye's tips meeting the edge of what the Lens reveals, the eye about 59 % of the picture's width at 21:9 and about 88 % on the Steam Deck, no unrevealed strip inside its tips, the swirl round, not stretched. In each side's longshot_log.txt (or the shader preparation's): vk: program d547af983903a518: the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too.

@Beanstalk linux, amd, and a Steam Deck: this head (`b6766b8a`) against `main` @ 22d0d200, the same steps on each. It also runs #2713's eye on both, its review's L1 and L2. 1. Graphics: on Linux AMD, Aspect ratio **21:9** and Output resolution **2560x1080**; on the Steam Deck, its own shape (the default, 16:10). Restart the game so it applies from the start. 2. Load the repo save `kokiri-start`. On the Insert menu's Debug tab, Inventory: unlock **Lens of Truth** and **Magic Meter** (Items section). Then Teleport to **Bottom of the Well**. 3. Put the Lens of Truth on a button in the item menu and use it. Standing still with the Lens on, take a screenshot; take it off and put it on again. Expected, the same on both sides: the purple eye's tips meeting the edge of what the Lens reveals, the eye about 59 % of the picture's width at 21:9 and about 88 % on the Steam Deck, no unrevealed strip inside its tips, the swirl round, not stretched. In each side's `longshot_log.txt` (or the shader preparation's): `vk: program d547af983903a518: the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too`.
Member

@bulldogsajr22 only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@bulldogsajr22 only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The pass preserves the original matching and rewrite logic while avoiding the use map when the multiply is absent. The reported pass-time reduction is promising, but repeated measurements against the actual base are still needed. Recommend approval; not approved on the forge.

Cold shader translation skips use-map allocations for fragment programs without the eye’s multiply. The code is simpler on that common path, at the cost of a second instruction scan for programs that contain the multiply; warm starts that translate nothing are unchanged.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h:75: The pass-time comparison is from one instrumented preparation using a copy of the base scan, and the whole preparation timings overlap. (more on the line) Do: Measure the pass and cold preparation in repeated interleaved runs of instrumented builds of the actual base and head, with the same setup and empty caches.

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven as a repeatable player-facing gain. One instrumented preparation reports 5,034 ms versus 263 ms summed CPU time for the pass, but its baseline was a copy of main’s scan in the PR build; cold translation was 50.5/51.4 s versus 50.6/50.2 s, within run-to-run spread.

Other systems: The pass runs during graphics fragment translation on Windows and Linux and can affect the eye’s linked vertex pass. The matching and map contents are unchanged for programs with the multiply; the reported Windows NVIDIA run and shader-store comparison support equivalent output. Linux AMD and Steam Deck game runs remain outstanding.

Switches: None.

Reviewed: b6766b8a88 against 22d0d20098: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the commit, both changed files and the test runner in full; inspected the translation and vertex-pass call sites and the reported runs. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. No generated files or translations changed.; nothing run (a code review).

Checked and fine:

  • The early return has the same result as the former empty-scales path, and the use map is built in the same order when scales exist.
  • The allocation test exercises a camera-bank program without the target multiply and is reported to fail with the base pass.
  • The commit records AI assistance; the diff adds no game-derived output, switches, generated files or renderer API changes.

Testing: Read-only review; no tests or project code run. The author reports Windows and Linux fixture runs, renderer builds, lint and game testing; CI is still running.

Overlaps and merge order: Follow-up to #2713; no other overlaps identified from the supplied information.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The pass preserves the original matching and rewrite logic while avoiding the use map when the multiply is absent. The reported pass-time reduction is promising, but repeated measurements against the actual base are still needed. Recommend approval; not approved on the forge. Cold shader translation skips use-map allocations for fragment programs without the eye’s multiply. The code is simpler on that common path, at the cost of a second instruction scan for programs that contain the multiply; warm starts that translate nothing are unchanged. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h:75`: The pass-time comparison is from one instrumented preparation using a copy of the base scan, and the whole preparation timings overlap. (more on the line) **Do:** Measure the pass and cold preparation in repeated interleaved runs of instrumented builds of the actual base and head, with the same setup and empty caches. **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven as a repeatable player-facing gain. One instrumented preparation reports 5,034 ms versus 263 ms summed CPU time for the pass, but its baseline was a copy of main’s scan in the PR build; cold translation was 50.5/51.4 s versus 50.6/50.2 s, within run-to-run spread. **Other systems:** The pass runs during graphics fragment translation on Windows and Linux and can affect the eye’s linked vertex pass. The matching and map contents are unchanged for programs with the multiply; the reported Windows NVIDIA run and shader-store comparison support equivalent output. Linux AMD and Steam Deck game runs remain outstanding. **Switches:** None. **Reviewed:** b6766b8a8837 against 22d0d20098d6: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the commit, both changed files and the test runner in full; inspected the translation and vertex-pass call sites and the reported runs. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. No generated files or translations changed.; nothing run (a code review). **Checked and fine:** - The early return has the same result as the former empty-scales path, and the use map is built in the same order when scales exist. - The allocation test exercises a camera-bank program without the target multiply and is reported to fail with the base pass. - The commit records AI assistance; the diff adds no game-derived output, switches, generated files or renderer API changes. **Testing:** Read-only review; no tests or project code run. The author reports Windows and Linux fixture runs, renderer builds, lint and game testing; CI is still running. **Overlaps and merge order:** Follow-up to #2713; no other overlaps identified from the supplied information. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -74,2 +72,4 @@
for (IR::Block* block : program.blocks)
for (IR::Inst& inst : block->Instructions())
if (inst.GetOpcode() == IR::Opcode::FPMul32 && (IsImm(inst.Arg(0), kEyeScale) != IsImm(inst.Arg(1), kEyeScale)))
scales.push_back(&inst);
Member

L1 (should fix): The pass-time comparison is from one instrumented preparation using a copy of the base scan, and the whole preparation timings overlap.

When: On the reported 32-worker machine, cold translation varies from 50.2 to 51.4 seconds across the two versions, so the observed wall-time difference does not establish a repeatable gain.

Do: Measure the pass and cold preparation in repeated interleaved runs of instrumented builds of the actual base and head, with the same setup and empty caches.

**L1** (should fix): The pass-time comparison is from one instrumented preparation using a copy of the base scan, and the whole preparation timings overlap. *When:* On the reported 32-worker machine, cold translation varies from 50.2 to 51.4 seconds across the two versions, so the observed wall-time difference does not establish a repeatable gain. **Do:** Measure the pass and cold preparation in repeated interleaved runs of instrumented builds of the actual base and head, with the same setup and empty caches.
HumanBean deleted branch perf/lens-eye-scan-first 2026-11-28 18:57:17 +00:00
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 10s
beanstalk/approval not approved yet
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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
MagicBeanDev/Longshot!2743
No description provided.