fix(shader): keep each BDA page-table walk to one inlined copy per read #3655

Merged
EdouardSence merged 1 commit from upstream-pr/3655 into main 2026-10-14 09:37:26 +00:00
EdouardSence commented 2026-10-11 14:54:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-11T14:54:58Z.


What

On RADV, Ghost of Yōtei (PPSA26344) cannot create the pipeline of compute shader 0x8000289300: vkCreateComputePipelines takes the process past 26 GB until it is OOM-killed. The title gets there on main a11c8f7f with #757/#758 merged; on main alone it stops earlier, at #2715. The diagnosis is in discussion #2884.

RADV inlines every SPIR-V function, DontInline included. Every get_bda_pointer call site therefore becomes its own copy of the page-table search, and nir_opt_copy_prop_vars (gdb, Mesa 26.2.4 with symbols) clones and rescans its copy set at each of these copies' loops, branches and fault stores. A byte read looked up once per byte, and the byte fallback of a span read did 4 dword reads of 4 lookups each.

This PR keeps one inlined lookup per read, with the same results and faults:

  • DefineBdaLookup keeps the search bounds in loop phis instead of two Function variables.
  • Its header checks and its range checks each record their fault from one site. The reason is the first failing check, in the original order. The two checks that guard out-of-bounds table reads (length < 4 and index == 0) still return on their own.
  • EmitBdaBytes loops over its bytes around one EmitBdaByte.
  • The byte fallback of read_bda_span loops over its 4 dwords around one dword read.

Measured outside the title with a small Vulkan harness: the replayed module of 0x8000289300, RADV, MESA_SHADER_CACHE_DISABLE. To separate the cost of its formatted loads, those are cut after N:

formatted loads kept main this PR this PR + #3656
0 11.1 s, 4.4 GB 4.1 s, 0.6 GB 4.1 s, 0.6 GB
8 39.5 s, 10.4 GB not measured 11.4 s, 0.9 GB
128 out of memory over 10 GB 35.8 s, 8.3 GB

All 128 still need #3656 (one formatted load path instead of 77 cases). With both, the module compiles in 35.8 s and 8.3 GB, and Yōtei runs a 300 s session, 4711 shaders compiled, without the OOM.

Tested

Linux (CachyOS), RX 9070 XT, RADV 26.2.4, GCC, Release.

  • Full ctest: 831 of 832 pass. import_audit fails because its source commit lookup does not work in a git worktree; it fails the same on main.
  • The BDA execution tests run on the GPU.
  • agc_shader_memory now also checks that get_bda_pointer records faults from at most 4 sites and has no OpVariable, and that read_bda_dword_bytes calls the lookup once. On main it fails: one byte load per byte, 4 lookups.
  • tools/check_conventions.py passes.

#2837 also changes DefineBdaLookup (a cached last range in Private variables) and will conflict with this. Its variable stores may also add to the RADV copy-propagation cost; I haven't measured that.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

Tested and written by Claude (AI assistant) on a contributor's machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819942959 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-11T14:54:58Z. --- ### What On RADV, Ghost of Yōtei (PPSA26344) cannot create the pipeline of compute shader `0x8000289300`: `vkCreateComputePipelines` takes the process past 26 GB until it is OOM-killed. The title gets there on `main` a11c8f7f with #757/#758 merged; on `main` alone it stops earlier, at #2715. The diagnosis is in [discussion #2884](https://github.com/boykopovar/AnyPS5/discussions/2884#discussioncomment-18864628). RADV inlines every SPIR-V function, `DontInline` included. Every `get_bda_pointer` call site therefore becomes its own copy of the page-table search, and `nir_opt_copy_prop_vars` (gdb, Mesa 26.2.4 with symbols) clones and rescans its copy set at each of these copies' loops, branches and fault stores. A byte read looked up once per byte, and the byte fallback of a span read did 4 dword reads of 4 lookups each. This PR keeps one inlined lookup per read, with the same results and faults: - `DefineBdaLookup` keeps the search bounds in loop phis instead of two `Function` variables. - Its header checks and its range checks each record their fault from one site. The reason is the first failing check, in the original order. The two checks that guard out-of-bounds table reads (`length < 4` and `index == 0`) still return on their own. - `EmitBdaBytes` loops over its bytes around one `EmitBdaByte`. - The byte fallback of `read_bda_span` loops over its 4 dwords around one dword read. Measured outside the title with a small Vulkan harness: the replayed module of `0x8000289300`, RADV, `MESA_SHADER_CACHE_DISABLE`. To separate the cost of its formatted loads, those are cut after N: | formatted loads kept | `main` | this PR | this PR + #3656 | | ---: | ---: | ---: | ---: | | 0 | 11.1 s, 4.4 GB | 4.1 s, 0.6 GB | 4.1 s, 0.6 GB | | 8 | 39.5 s, 10.4 GB | not measured | 11.4 s, 0.9 GB | | 128 | out of memory | over 10 GB | 35.8 s, 8.3 GB | All 128 still need #3656 (one formatted load path instead of 77 cases). With both, the module compiles in 35.8 s and 8.3 GB, and Yōtei runs a 300 s session, 4711 shaders compiled, without the OOM. ### Tested Linux (CachyOS), RX 9070 XT, RADV 26.2.4, GCC, Release. - Full ctest: 831 of 832 pass. `import_audit` fails because its source commit lookup does not work in a git worktree; it fails the same on `main`. - The BDA execution tests run on the GPU. - `agc_shader_memory` now also checks that `get_bda_pointer` records faults from at most 4 sites and has no `OpVariable`, and that `read_bda_dword_bytes` calls the lookup once. On `main` it fails: one byte load per byte, 4 lookups. - `tools/check_conventions.py` passes. #2837 also changes `DefineBdaLookup` (a cached last range in `Private` variables) and will conflict with this. Its variable stores may also add to the RADV copy-propagation cost; I haven't measured that. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes *Tested and written by Claude (AI assistant) on a contributor's machine.* 🤖 Generated with [Claude Code](https://claude.com/claude-code)
blawesom commented 2026-10-11 15:19:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:19:35Z.


Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Builds; tools/check_conventions.py --base origin/main passes.
  • Full suite: 832/832 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110516039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6110516039). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T15:19:35Z. --- Independent pre-review on **Linux** (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - Builds; `tools/check_conventions.py --base origin/main` passes. - Full suite: **832/832 passed** (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
Dextroid17 commented 2026-10-11 15:23:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T15:23:35Z.


I checked the two things this fix could get wrong, and neither is wrong. The first is subtle enough to spell out.

The fault reason is preserved, and the construction is what makes that work. Collapsing several failure checks into one recording site risks changing which reason is reported when more than one check fails — and the reason is guest-visible. failFirst iterates its checks in reverse and folds each into reason with OpSelect, so the last write wins — and because the iteration is reversed, that last write is the first check in the original order. The earliest failing check's reason therefore survives exactly as before, while the module's lookup records its fault from at most four record_bda_fault call sites — which is what the test's lookupFaults <= 4 pins. The !recordFaults path returning zero, and the two guards that still return on their own, keep their original behaviour.

A loop instead of an unrolled sequence is the real mechanism, and it is the right one on a driver that inlines everything. EmitBdaBytes emitted the bytes as straight-line code, so every byte carried its own copy of the page-table search and nir_opt_copy_prop_vars paid for each one. EmitBdaByteLoop puts the phis and the OpLoopMerge in, which leaves the search as one code copy however many bytes are read. The test pins that structurally instead of by timing: readerLoads from 4u to 1u, lookupFaults <= 4, lookupVariables == 0, readerLookups == 1.

That structural test is what makes this reviewable at all. Counting the calls to get_bda_pointer and record_bda_fault in the emitted SPIR-V is deterministic on the host — no GPU, no Mesa version, no timing — so "on main it fails" is a real RED rather than a flake, and it keeps failing if the unrolled emission ever comes back. Worth as much as the fix.

Two things worth stating before this merges.

  • #3655 and #3656 are a pair; neither alone moves the wall. The table says it plainly: at 128 loads this PR alone still exceeds 10 GB, and only both together give 35.8 s / 8.3 GB and the 300 s session. Whoever merges should land them as a unit, because a reader of either description alone would conclude the other is optional.
  • The #2837 interaction is the one I would sequence deliberately. It changes the same DefineBdaLookup, and its cached-range Private variables are exactly what a copy-set rescan clones — which you say you have not measured. Landing this first and re-measuring with #2837 keeps the improvement attributable; rebasing #2837 onto a design already chosen for copy-propagation cost may be what makes its own cost visible.

One question, on the runtime side of the trade. The loop form shrinks the module, which is what the wall needs, but it replaces straight-line code with phis and a per-iteration branch. Your measured cases do not show a regression — the zero-formatted-loads module at 4.1 s, and 35.8 s for the both-PRs run where the unrolled form ran out of memory — and on a driver that inlines everything, one inlined loop is inherently fewer copies than N unrolled ones, so this may already be settled. Worth confirming anyway: did the 4711-shader session or the four focused cases show the loop form slower anywhere hot, or is the count small enough that it cannot matter? If a long span ever is hot, that would be the argument for unrolling small counts and looping only over long spans.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110552685 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6110552685). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T15:23:35Z. --- **I checked the two things this fix could get wrong, and neither is wrong. The first is subtle enough to spell out.** **The fault reason is preserved, and the construction is what makes that work.** Collapsing several failure checks into one recording site risks changing *which* reason is reported when more than one check fails — and the reason is guest-visible. `failFirst` iterates its checks **in reverse** and folds each into `reason` with `OpSelect`, so the last write wins — and because the iteration is reversed, that last write is the **first** check in the original order. The earliest failing check's reason therefore survives exactly as before, while the module's lookup records its fault from at most four `record_bda_fault` call sites — which is what the test's `lookupFaults <= 4` pins. The `!recordFaults` path returning zero, and the two guards that still return on their own, keep their original behaviour. **A loop instead of an unrolled sequence is the real mechanism, and it is the right one on a driver that inlines everything.** `EmitBdaBytes` emitted the bytes as straight-line code, so every byte carried its own copy of the page-table search and `nir_opt_copy_prop_vars` paid for each one. `EmitBdaByteLoop` puts the phis and the `OpLoopMerge` in, which leaves the search as **one code copy** however many bytes are read. The test pins that structurally instead of by timing: `readerLoads` from `4u` to `1u`, `lookupFaults <= 4`, `lookupVariables == 0`, `readerLookups == 1`. **That structural test is what makes this reviewable at all.** Counting the calls to `get_bda_pointer` and `record_bda_fault` in the emitted SPIR-V is deterministic on the host — no GPU, no Mesa version, no timing — so "on `main` it fails" is a real RED rather than a flake, and it keeps failing if the unrolled emission ever comes back. Worth as much as the fix. **Two things worth stating before this merges.** - **#3655 and #3656 are a pair; neither alone moves the wall.** The table says it plainly: at 128 loads this PR alone still exceeds 10 GB, and only both together give 35.8 s / 8.3 GB and the 300 s session. Whoever merges should land them as a unit, because a reader of either description alone would conclude the other is optional. - **The #2837 interaction is the one I would sequence deliberately.** It changes the same `DefineBdaLookup`, and its cached-range `Private` variables are exactly what a copy-set rescan clones — which you say you have not measured. Landing this first and re-measuring with #2837 keeps the improvement attributable; rebasing #2837 onto a design already chosen for copy-propagation cost may be what makes its own cost visible. **One question, on the runtime side of the trade.** The loop form shrinks the module, which is what the wall needs, but it replaces straight-line code with phis and a per-iteration branch. Your measured cases do not show a regression — the zero-formatted-loads module at 4.1 s, and 35.8 s for the both-PRs run where the unrolled form ran out of memory — and on a driver that inlines everything, one inlined loop is inherently fewer copies than N unrolled ones, so this may already be settled. Worth confirming anyway: did the 4711-shader session or the four focused cases show the loop form slower anywhere hot, or is the count small enough that it cannot matter? If a long span ever is hot, that would be the argument for unrolling small counts and looping only over long spans. Written with AI assistance.
milescoviello commented 2026-10-11 17:04:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-11T17:04:25Z.


Intel results, since this also fixes #2972 (the BDA tests timing out or failing to compile on Intel ANV). Arrow Lake iGPU, Mesa 26.1.8 ANV, Linux 7.2.8, GCC 15.3.0, Release. Every run is a cold compile (ANYPS5_NO_SHADER_CACHE=1, MESA_SHADER_CACHE_DISABLE=true), 3 runs each (1 for the timeout):

Intel ANV, cold agc_driver_flat_store agc_driver_masked_global_store agc_driver_flat_loads_x2_x3
main a11c8f7f times out (300 s) passes, 25 s passes, 4.8 s
this PR 2d3a970d passes, 65 s passes, 4.7 s passes, 0.2 s

Full ctest on Intel with this PR: 830/834. The four failures (emulated_color_compare #3526, gated_dispatch_capture and _short_timeout #3345, vop1_float_unary #2114) fail the same way on main.

flat_store still takes 65 s on a cold compile here, over the 30 s test limit. Recording the lookup's fault from one site instead of four (on top of this PR, guarding the rest of the lookup with selections and passing the reason through phis, still with no function variables) brings it to 51 s and roughly halves the spills ANV reports for its compute pipeline (593 → 275 spills, 1516 → 802 fills), and masked_global_store to 3.8 s. I'll open that as a follow-up once this is merged.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111487888 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6111487888). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-11T17:04:25Z. --- Intel results, since this also fixes #2972 (the BDA tests timing out or failing to compile on Intel ANV). Arrow Lake iGPU, Mesa 26.1.8 ANV, Linux 7.2.8, GCC 15.3.0, Release. Every run is a cold compile (`ANYPS5_NO_SHADER_CACHE=1`, `MESA_SHADER_CACHE_DISABLE=true`), 3 runs each (1 for the timeout): | Intel ANV, cold | `agc_driver_flat_store` | `agc_driver_masked_global_store` | `agc_driver_flat_loads_x2_x3` | |---|---|---|---| | `main` a11c8f7f | times out (300 s) | passes, 25 s | passes, 4.8 s | | this PR 2d3a970d | passes, 65 s | passes, 4.7 s | passes, 0.2 s | Full `ctest` on Intel with this PR: 830/834. The four failures (`emulated_color_compare` #3526, `gated_dispatch_capture` and `_short_timeout` #3345, `vop1_float_unary` #2114) fail the same way on `main`. `flat_store` still takes 65 s on a cold compile here, over the 30 s test limit. Recording the lookup's fault from one site instead of four (on top of this PR, guarding the rest of the lookup with selections and passing the reason through phis, still with no function variables) brings it to 51 s and roughly halves the spills ANV reports for its compute pipeline (593 → 275 spills, 1516 → 802 fills), and `masked_global_store` to 3.8 s. I'll open that as a follow-up once this is merged. AI-assisted: yes
milescoviello commented 2026-10-11 17:25:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-11T17:25:45Z.


One more data point, on NVIDIA this time: Ubuntu 24.04, GCC 13.3, RTX 4070 Ti, driver 580.142, Release with CI's configure flags.

On main a11c8f7f the BDA read tests hang the GPU there the way #3291 describes (and closed #3087 did on 591.86). agc_driver_flat_loads, _x2_x3 and _x4, agc_driver_global_loads, _x2_x3 and _x4, and agc_driver_flat_apertures_2 and _4 print recorded batch still running on the GPU after 10 s and abort after about 65 s with guest allocation ... is still pinned by GPU work or an import (waited 60000 ms for the lease). agc_driver_pixel_interlock fails with vkDeviceWaitIdle: Vulkan result -4.

With this PR (2d3a970d) all of them pass in 0.2 to 3.6 s, along with agc_driver_flat_apertures_1, _3 and _5. So this likely fixes #3291 as well, at least on this driver.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111683012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6111683012). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-11T17:25:45Z. --- One more data point, on NVIDIA this time: Ubuntu 24.04, GCC 13.3, RTX 4070 Ti, driver 580.142, Release with CI's configure flags. On `main` a11c8f7f the BDA read tests hang the GPU there the way #3291 describes (and closed #3087 did on 591.86). `agc_driver_flat_loads`, `_x2_x3` and `_x4`, `agc_driver_global_loads`, `_x2_x3` and `_x4`, and `agc_driver_flat_apertures_2` and `_4` print `recorded batch still running on the GPU after 10 s` and abort after about 65 s with `guest allocation ... is still pinned by GPU work or an import (waited 60000 ms for the lease)`. `agc_driver_pixel_interlock` fails with `vkDeviceWaitIdle: Vulkan result -4`. With this PR (2d3a970d) all of them pass in 0.2 to 3.6 s, along with `agc_driver_flat_apertures_1`, `_3` and `_5`. So this likely fixes #3291 as well, at least on this driver. AI-assisted: yes
EdouardSence commented 2026-10-11 19:22:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-11T19:22:30Z.


@Dextroid17 on the runtime question: not measured. Every number in this PR is compile time and compile memory. In the 300 s Yōtei session the title never presents a frame, so I have no frame time to compare. On main the same session dies in pipeline creation, so there is no baseline to compare against either.

What the loop changes at runtime: a span read that used to emit N unrolled page walks (one per dword, or one per byte for the unaligned fallback) now runs a loop of N iterations, with one walk and a phi per iteration. Reads of 4 bytes or less still take the single straight-line path. Only spans longer than that, and the byte fallback, loop.

If someone has a title that draws frames through long BDA spans, a frame-time comparison with and without this PR would settle it. If it shows a cost, unrolling spans up to a small length and looping past it is a contained change in read_bda_span. I'd rather add it with a measurement than without one.

Agreed on sequencing: #3655 and #3656 should land together, and #2837 should be re-measured on top of them.

Written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6112774964 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6112774964). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-11T19:22:30Z. --- @Dextroid17 on the runtime question: not measured. Every number in this PR is compile time and compile memory. In the 300 s Yōtei session the title never presents a frame, so I have no frame time to compare. On `main` the same session dies in pipeline creation, so there is no baseline to compare against either. What the loop changes at runtime: a span read that used to emit N unrolled page walks (one per dword, or one per byte for the unaligned fallback) now runs a loop of N iterations, with one walk and a phi per iteration. Reads of 4 bytes or less still take the single straight-line path. Only spans longer than that, and the byte fallback, loop. If someone has a title that draws frames through long BDA spans, a frame-time comparison with and without this PR would settle it. If it shows a cost, unrolling spans up to a small length and looping past it is a contained change in `read_bda_span`. I'd rather add it with a measurement than without one. Agreed on sequencing: #3655 and #3656 should land together, and #2837 should be re-measured on top of them. *Written by Claude (AI assistant) on a contributor's machine.*
MarcZX10 commented 2026-10-11 20:48:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T20:48:09Z.


I evaluated the independent single-fault-site change from issue #2972 and briefly submitted it as #3989, then closed that carry PR after reviewing the issue's note that the ready branch was offered for a maintainer to carry. Technically, the issue's change reduces fault-recording call sites and scratch pressure on older Intel Mesa; this PR reduces duplicated page-table walks. They have different goals but overlap in SpirvBdaLookup.cpp, SpirvBdaFault.cpp, and shader memory tests, so merge order may require a rebase. The issue includes the contributor's Intel and NVIDIA test results; my local Linux build did not complete.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113588393 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6113588393). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T20:48:09Z. --- I evaluated the independent single-fault-site change from [issue #2972](https://github.com/boykopovar/AnyPS5/issues/2972) and briefly submitted it as [#3989](https://github.com/boykopovar/AnyPS5/pull/3989), then closed that carry PR after reviewing the issue's note that the ready branch was offered for a maintainer to carry. Technically, the issue's change reduces fault-recording call sites and scratch pressure on older Intel Mesa; this PR reduces duplicated page-table walks. They have different goals but overlap in `SpirvBdaLookup.cpp`, `SpirvBdaFault.cpp`, and shader memory tests, so merge order may require a rebase. The issue includes the contributor's Intel and NVIDIA test results; my local Linux build did not complete.
Scramblrrrr commented 2026-10-12 04:16:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T04:16:32Z.


Windows/Blackwell cross-test: #3655 2d3a970d + #3656 369928dc/6aaae039 applied cleanly on our007 runtime-image-table integration, public combined head bc46e2d6f: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-bda-compact-cross-test . Original author commits retained. Release, SPIRV-Tools OFF, RTX5070Ti/NVIDIA617.14, Vulkan required.

Focused checks 6/6 pass,6.50s, no reported skips: agc_shader_memory0.36s, agc_driver_bda_device3.00s, agc_formatted_buffer_once0.17s, agc_driver_flat_loads0.48s, agc_driver_global_loads0.55s, agc_driver_gpu_buffer_format1.72s. This covers the emitted helper structure, native address/fault behavior and GPU-selected formats; not a full-suite result.

Staging a separate007 run next. No game-output/FPS improvement claimed yet. AI-assisted: yes(Codex).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117646585 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6117646585). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T04:16:32Z. --- Windows/Blackwell cross-test: **#3655 2d3a970d + #3656 369928dc/6aaae039** applied cleanly on our007 runtime-image-table integration, public combined head **bc46e2d6f**: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-bda-compact-cross-test . Original author commits retained. Release, SPIRV-Tools OFF, RTX5070Ti/NVIDIA617.14, Vulkan required. Focused checks **6/6 pass,6.50s**, no reported skips: agc_shader_memory0.36s, agc_driver_bda_device3.00s, agc_formatted_buffer_once0.17s, agc_driver_flat_loads0.48s, agc_driver_global_loads0.55s, agc_driver_gpu_buffer_format1.72s. This covers the emitted helper structure, native address/fault behavior and GPU-selected formats; not a full-suite result. Staging a separate007 run next. No game-output/FPS improvement claimed yet. AI-assisted: yes(Codex).
rebelittle commented 2026-10-12 05:23:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rebelittle on 2026-10-12T05:23:18Z.


This PR also cuts the lavapipe compile time behind the BDA execution tests that Linux CI reports as slower than 30 s.

Measured on Windows 10 with lavapipe from Mesa 25.2.8 (the Mesa version in Ubuntu 24.04 updates; LLVM 21.1.7 in this build), a build with ANYPS5_ENABLE_SPIRV_TOOLS=ON as on Linux CI, and MESA_SHADER_CACHE_DISABLE=true, on main e013f8c9c without and with this PR (2d3a970da) merged:

Test main with this PR Linux CI on main
agc_driver_bda_span_reads 28.5 s 11.0 s 30.8–32.5 s
agc_driver_masked_global_store 37.0 s 12.4 s up to 30.5 s
agc_driver_global_vcc_base 48.3 s 16.0 s 45.4–55.6 s
agc_driver_flat_store 99.2 s 58.5 s 66.7–90.7 s

All four pass with the PR merged. Mesa's disk cache is not active in this Windows build, so every dispatch compiles its pipeline, while on Linux CI a module that was already compiled can come from the cache; both columns here were measured the same way. The CI ranges are the slow-test annotations of runs 38140296210, 38168846650, 38169396667 and 38204420760.

Measured with Claude Code.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118278515 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6118278515). Originally posted by [rebelittle](https://github.com/rebelittle) on 2026-10-12T05:23:18Z. --- This PR also cuts the lavapipe compile time behind the BDA execution tests that Linux CI reports as slower than 30 s. Measured on Windows 10 with lavapipe from Mesa 25.2.8 (the Mesa version in Ubuntu 24.04 updates; LLVM 21.1.7 in this build), a build with `ANYPS5_ENABLE_SPIRV_TOOLS=ON` as on Linux CI, and `MESA_SHADER_CACHE_DISABLE=true`, on `main` e013f8c9c without and with this PR (2d3a970da) merged: | Test | `main` | with this PR | Linux CI on `main` | |---|---|---|---| | `agc_driver_bda_span_reads` | 28.5 s | 11.0 s | 30.8–32.5 s | | `agc_driver_masked_global_store` | 37.0 s | 12.4 s | up to 30.5 s | | `agc_driver_global_vcc_base` | 48.3 s | 16.0 s | 45.4–55.6 s | | `agc_driver_flat_store` | 99.2 s | 58.5 s | 66.7–90.7 s | All four pass with the PR merged. Mesa's disk cache is not active in this Windows build, so every dispatch compiles its pipeline, while on Linux CI a module that was already compiled can come from the cache; both columns here were measured the same way. The CI ranges are the slow-test annotations of runs 38140296210, 38168846650, 38169396667 and 38204420760. Measured with Claude Code.
oneandonlydean commented 2026-10-13 05:02:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T05:02:26Z.


Needs a rebase: #4759 is merged and this now conflicts with it in core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp. The full build of 2d3a970da was green before that merge, so it goes in on a green build of the rebased head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6138625628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6138625628). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T05:02:26Z. --- Needs a rebase: #4759 is merged and this now conflicts with it in `core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp`. The full build of 2d3a970da was green before that merge, so it goes in on a green build of the rebased head.
MarcZX10 commented 2026-10-13 08:31:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T08:31:44Z.


I rebased this onto current main after integrating #4759. The combined change keeps the in-place and fallback paths in separate selections, and retains the bounded loop for the unaligned dword fallback. The rebased Linux Release build of libSceAgcDriver succeeds; agc_shader_memory passes (1/1, 0.34 s), and tools/check_conventions.py --base upstream/main passes. I pushed the rebased commit to my branch codex/rebase-bda-compact-3655 because the original head branch is in your fork and is not writable from this account. Please switch the PR head to MarcZX100:codex/rebase-bda-compact-3655 when convenient.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141565981 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6141565981). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T08:31:44Z. --- I rebased this onto current main after integrating #4759. The combined change keeps the in-place and fallback paths in separate selections, and retains the bounded loop for the unaligned dword fallback. The rebased Linux Release build of `libSceAgcDriver` succeeds; `agc_shader_memory` passes (1/1, 0.34 s), and `tools/check_conventions.py --base upstream/main` passes. I pushed the rebased commit to my branch `codex/rebase-bda-compact-3655` because the original head branch is in your fork and is not writable from this account. Please switch the PR head to `MarcZX100:codex/rebase-bda-compact-3655` when convenient.
oneandonlydean commented 2026-10-13 08:55:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T08:55:10Z.


Heads-up before this is switched or rebased again: #5022 is merged and replaces the span-read shape from #4759. The two separate selections (in-place loads under the condition, fallback under its negation) hang NVIDIA 595.97 and newer (#4975; here also 610.57.04 on Linux, Xid 109, and a 3D title loses the device at level start), while the single selection from before #4759 hangs 591.86/590.48. On main the in-place loads now sit in load_bda_span, a DontInline function with no calls, and read_bda_span is one selection between calling it and the byte fallback.

MarcZX100:codex/rebase-bda-compact-3655 (8f57bc736) keeps the separate selections and conflicts with main in SpirvBdaRead.cpp. Please rebase onto #5022 keeping its shape (the "BDA read functions" check in agc_shader_memory pins it), and run agc_driver_scalar_wide_loads, agc_driver_flat_apertures_0, agc_driver_bda_span_reads and agc_driver_pixel_interlock on an NVIDIA 595+ driver, with and without SPIRV-Tools.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141963436 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6141963436). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T08:55:10Z. --- Heads-up before this is switched or rebased again: #5022 is merged and replaces the span-read shape from #4759. The two separate selections (in-place loads under the condition, fallback under its negation) hang NVIDIA 595.97 and newer (#4975; here also 610.57.04 on Linux, Xid 109, and a 3D title loses the device at level start), while the single selection from before #4759 hangs 591.86/590.48. On main the in-place loads now sit in `load_bda_span`, a DontInline function with no calls, and `read_bda_span` is one selection between calling it and the byte fallback. `MarcZX100:codex/rebase-bda-compact-3655` (8f57bc736) keeps the separate selections and conflicts with main in `SpirvBdaRead.cpp`. Please rebase onto #5022 keeping its shape (the "BDA read functions" check in `agc_shader_memory` pins it), and run `agc_driver_scalar_wide_loads`, `agc_driver_flat_apertures_0`, `agc_driver_bda_span_reads` and `agc_driver_pixel_interlock` on an NVIDIA 595+ driver, with and without SPIRV-Tools.
Dextroid17 commented 2026-10-13 21:34:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T21:34:28Z.


I merged blawesom:rebase/3656's #3655 commit (805be46cf) onto main 0aa4cb1c2, which includes #5022. The merge is clean, and it leaves load_bda_span and the read_bda_span selection as #5022 has them.

I tested it together with #3656 on lavapipe 26.2.4 with SPIRV-Tools OFF. agc_shader_memory (the "BDA read functions" check) passes, and so do the four tests you named.

The NVIDIA 595+ runs, with and without SPIRV-Tools, are not done. Details: https://github.com/boykopovar/AnyPS5/pull/3656#issuecomment-6155680022

AI-assisted: yes (Claude).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155681417 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6155681417). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-13T21:34:28Z. --- I merged `blawesom:rebase/3656`'s #3655 commit (`805be46cf`) onto main `0aa4cb1c2`, which includes #5022. The merge is clean, and it leaves `load_bda_span` and the `read_bda_span` selection as #5022 has them. I tested it together with #3656 on lavapipe 26.2.4 with SPIRV-Tools OFF. `agc_shader_memory` (the "BDA read functions" check) passes, and so do the four tests you named. The NVIDIA 595+ runs, with and without SPIRV-Tools, are **not** done. Details: https://github.com/boykopovar/AnyPS5/pull/3656#issuecomment-6155680022 AI-assisted: yes (Claude).
oneandonlydean commented 2026-10-14 04:20:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T04:20:30Z.


The NVIDIA runs are done: on 2d3a970da merged onto main 30f961266, agc_shader_memory ("BDA read functions"), agc_driver_bda_span_reads, agc_driver_pixel_interlock, agc_driver_scalar_wide_loads and agc_driver_flat_apertures_0 pass twice each with SPIRV-Tools ON and OFF, with no hang or Xid. RTX 4090, NVIDIA 610.57.04, Linux, Release.

After #5022 the current head merges cleanly, to the same tree as 805be46cf, and keeps load_bda_span and the read_bda_span selection as they are on main. So no rebase is needed; keep this head and leave out codex/rebase-bda-compact-3655, which keeps the two selections.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6160810387 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6160810387). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T04:20:30Z. --- The NVIDIA runs are done: on 2d3a970da merged onto main 30f961266, `agc_shader_memory` ("BDA read functions"), `agc_driver_bda_span_reads`, `agc_driver_pixel_interlock`, `agc_driver_scalar_wide_loads` and `agc_driver_flat_apertures_0` pass twice each with SPIRV-Tools ON and OFF, with no hang or Xid. RTX 4090, NVIDIA 610.57.04, Linux, Release. After #5022 the current head merges cleanly, to the same tree as 805be46cf, and keeps `load_bda_span` and the `read_bda_span` selection as they are on main. So no rebase is needed; keep this head and leave out `codex/rebase-bda-compact-3655`, which keeps the two selections.
github-actions[bot] commented 2026-10-14 09:06:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T09:06:57Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4976 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L3095-3096, L3120, L3129
core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp L207-223, L225-226
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164857453 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3655#issuecomment-6164857453). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T09:06:57Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4976 | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` [L3095-3096](https://github.com/boykopovar/AnyPS5/blob/bf8e69d581f6e10b725718b0941ad55b7fcc4fdb/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L3095-L3096), [L3120](https://github.com/boykopovar/AnyPS5/blob/bf8e69d581f6e10b725718b0941ad55b7fcc4fdb/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L3120), [L3129](https://github.com/boykopovar/AnyPS5/blob/bf8e69d581f6e10b725718b0941ad55b7fcc4fdb/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L3129)<br>`core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp` [L207-223](https://github.com/boykopovar/AnyPS5/blob/bf8e69d581f6e10b725718b0941ad55b7fcc4fdb/core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp#L207-L223), [L225-226](https://github.com/boykopovar/AnyPS5/blob/bf8e69d581f6e10b725718b0941ad55b7fcc4fdb/core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp#L225-L226) | | |
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
boykopovar/AnyPS5!3655
No description provided.