Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T12:00:49Z.
Since #3279, two of Stray's pixel shaders (PPSA02101 v01.002, UE4) take 2.5 and 7 minutes to prepare. The render thread waits for them, and the title stops on Unreal's watchdog before its first frame:
On
main8ec0e131this happens at about 158 s with a warm shader cache, every run. With the same shaders preparing in about 10 s, the title gets past it.Bisection
The same recompile request of shader
0x200f780000was replayed offline withagc_shader_replayon each commit of the series. Release, GCC 16.2.1, one run per row:961b25fe(before the series)c2a48416exec phis and long kill chainscd4eaacfwalk limit scaled with the program98f99d38across loops83f8c193image readsfda4aa90image writes, explicit-LOD gathers, size queriesmain8ec0e131The second shader,
0x200f7a0000, takes 406 s onmain. Both produce SPIR-V. Nearly all of the time is inMaskedSelectEliminator::Eliminate, in the masked-lane walk.What changes at
fda4aa90Counted in
MaskedSelectEliminator::Eliminatefor0x200f780000, with the counters not in any commit:83f8c193fda4aa90The commit does what it says: three times as many selects are proven dead. The cost comes from two things:
ImageWriteasksImpliesabout its exec.Implications::Resetclears the results for every walk, and almost every select has its own mask (about 51,000 distinct masks in 112,000 walks), so nothing is shared.I tried three caches on top of
main, all with byte-identical SPIR-V on the 43 Stray shaders I have requests for, and none helped:Keeping
Implicationsresults across walks does nothing either, as the masks are almost all distinct. So I don't have a fix. A per-program budget, or proving implications between conditions once rather than per mask, seems to be what is needed. @AlxcBTW, you know this code; I can rerun timings or counters on any branch.Before the series
On
f1ae427bthe same two shaders took 28 and 78 s. With a change that stamps visits by dense value id and stops a walk at a select whose walk already failed under the same mask, they took 3.5 and 11.5 s, with identical SPIR-V on 33 Stray shaders. Stray then went on rendering (#2749).mainnow stamps visits the same way, so only the failed-select part would be new, and onmainit does not help (above).Setup
Fedora 44, GCC 16.2.1, Release, Intel Arc (Meteor Lake, Mesa 26.2.3 ANV). The requests come from
APS5_DUMP_SHADERS=1and replay without the game.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T13:02:22Z.
I opened PR #3550 with a per-shader budget for masked-lane proof work. Failed and successful walks both debit the shared budget; when it runs out, remaining selects stay unchanged unless the existing proof already completed.
The PR has a synthetic regression for exhausting the budget while preserving unproven selects. I could not replay Stray's dumped shaders locally, so title-specific timing and budget tuning remain unverified. If you can rerun the requests, could you share results for both
0x200f780000and0x200f7a0000with the budget at 1x, 8x and 32x the per-walk limit? For each run, elapsed time, values visited, implications computed, selects removed and whether the shader produced valid SPIR-V would show the performance/optimization tradeoff the review asks about. The current PR setting is 32x.I also added a test to the PR for a later masked proof removing its select after an earlier proof has spent part of the budget and conservatively failed.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T14:12:19Z.
@ThatsLeo thanks for the bisection and the counters. That makes it clear: the walks
fda4aa90lets past gathers and size queries mostly fail late, and everyImageWriterestartsImpliesfrom scratch. That regression is mine, and I'm on it.I'm looking at two things that don't trade selects for time:
Implies(condition ⇒ mask)per pair of condition and mask across walks, instead of resetting it per walk;@MarcZX100's budget in #3550 is a good safety net either way. I'll put candidate branches up for your timings on
0x200f780000and0x200f7a0000and post the selects removed next to the times, so we can see whether a budget still bites after that.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T17:03:08Z.
Status on the two ideas from my last comment, so nobody waits on a branch from me:
main. But it doesn't buy time. On a synthetic where most of the cost is failing walks it cuts values visited and implications by 40%, and its bookkeeping eats that; on two SotS programs it is slower (0.9 → 1.4 s, 3.5 → 4.0 s). I'm not putting it up.Impliesacross walks doesn't work as is: many late failures come fromImplieshitting its depth limit of 64 on long exec chains, and whether it does depends on the order of the questions, so a cached answer isn't the same answer.The synthetic reproduces the
fda4aa90jump (0.07 s → 9 s) when most of the cost is in walks that end up removing a select. Those can't be skipped without changing the output, so the real fix is a per-mask proof that doesn't depend on order, which lets walks with the same mask share results. That changes which selects are removed (mostly more), so it needs its own PR and review. Until then @MarcZX100's budget in #3550 is the right stopgap.@ThatsLeo if you rerun
0x200f780000and0x200f7a0000, the split that would tell which case Stray is: time with the cache off (ANYPS5_NO_SHADER_CACHE=1 time ./agc_shader_replay --spv shader_200f780000.req) onmain, on fda4aa90~1 and with #3550 at 1x, 8x and 32x, plus the selects removed in each. That also answers what #3550's review asks.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T18:42:55Z.
@MarcZX100 measurements of #3550 (
b58c0428) on both shaders, per budget multiple. Offline replay withagc_shader_replay, Release, GCC 16.2.1, Intel Arc (Meteor Lake) host CPU. The counters are summed over everyMaskedSelectEliminator::Eliminatecall of the shader (2 for0x200f780000, 6 for0x200f7a0000, 4 to 6 for0x2013010000). They were added locally and are not in any commit; the multiple came from an environment override ofWalkBudgetMultiple. "Unbounded" is a multiple of 10^9, and its SPIR-V is byte-identical tomain8ec0e131. Every SPIR-V module passesspirv-val --target-env vulkan1.3.0x200f7800000x200f7a0000What the budget costs. Even at 1x the two shaders are fine for time. But there is a correctness cost that the timings do not show. Stray's pixel shader
0x2013010000relies on a removed select for the packed ancillary lowering (the #2881 case that #3279 fixed). Under the budget, that select survives, and the shader fails again:0x2013010000packed pixel ancillary input has an unsupported live use (used by SelectU32 ? ?)In the title,
main+ #3550 at 32x (plus the bring-up set in #2749) stops on that error at 35 s. At 128x it renders the calibration screen at about 2.3 FPS. The ancillary lowering needs the select gone, so a budget that leaves it there turns a slow shader into a failing one.Of the 41 Stray shaders I have requests for, the other 40 compile at 32x, and 34 of them produce the same SPIR-V as
main.@AlxcBTW glad to time your candidates on the same requests as soon as they're up.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T18:44:43Z.
@ThatsLeo thanks, that table settles the time side: at 128x both shaders are at 2.3 s and 5.8 s, against 141 s and 385 s unbounded. It also shows the real problem: under any budget that bites, a select that
0x2013010000's ancillary lowering needs gone can survive, and a slow shader becomes a failing one.AlxcBTW/AnyPS5#39 takes that coupling away. With it, a select the walk keeps no longer stops the recompile: every read it keeps gets the whole packed word (prim type, sample index, layer), so the lowering doesn't depend on the walk finishing. If you have time:
0x2013010000with #39 under #3550 at 1x and 32x. If it compiles there, the budget can stay low without breaking titles. The branch iscarry/pixel-ancillary-word-v2(9870a3ff7), on an oldermain; the #3279 commits in it are the merged ones, so it should merge onto8ec0e131with #3550.I have no faster walk to offer yet: the early exit I tried kept the output but saved no time (my comment above). Your
s_wqmfold on #2548 is the better fix for0x2012f90000's shape, because it removes the selects instead of computing the word.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T18:58:57Z.
@AlxcBTW with AlxcBTW/AnyPS5#39 (
9870a3ff7) and #3550 (b58c0428) onmain8ec0e131,0x2013010000compiles at every budget. Offline replay, same counters as above:At 32x all 43 Stray requests I have compile, and every module passes
spirv-val --target-env vulkan1.3. The two slow shaders take 1.1 and 2.3 s.Taking only
9870a3ff7onto8ec0e131conflicts with #3228'salphaToCoverage. Both claim request serialization version 16, and both touch the same lines inDrawDecode,DrawLookup,DrawRegisterKey, the disk cache format version andShaderMemory. For this run I kept both fields and readrasterPrimitivefrom version 17. That is fine for the replay, but the rebase will need a real choice there.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T19:00:03Z.
@ThatsLeo thanks, that's the result I hoped for. With #39 a low budget is both fast and correct: all 43 Stray requests compile at 32x, and the two slow shaders take 1.1 and 2.3 s. So #3550 and #39 belong together, and #3550 doesn't need to go to 128x just to keep
0x2013010000working.On the conflict: #3228 is on
mainnow, so it keeps version 16. #39 takes the next request serialization version forrasterPrimitive, and the disk cache format moves one step. I'll rebase #39 onto8ec0e131that way, rerun its tests, and post the branch here. I can open it upstream once #3546 is merged; the intake rules allow me one open PR until then. If #3550's review wants the pair sooner, anyone is welcome to carry the rebased branch.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T20:31:52Z.
@ThatsLeo the rebased branch is up:
carry/pixel-ancillary-word-v3(db92ece3c). It's a single commit onmaina11c8f7f.alphaToCoveragestays at request serialization version 16, andrasterPrimitivereads from 17. The disk cache format is 28. The round-trip and legacy checks inShaderMemory.cppcover both fields.agc_driver_pixel_ancillary_wordandagc_driver_alpha_to_coveragepass, and the fullagc_driverset is 296/297 on an RTX 5070. The one failure,agc_driver_emulated_color_compare(the sRGB sampling refusal), fails the same way on plainmain. Non-GPU tests are 527/530, the same three failures asmainon that machine.check_conventions.pypasses.It should merge onto
8ec0e131with #3550 without the version juggling you had to do.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T21:33:53Z.
@AlxcBTW
carry/pixel-ancillary-word-v3(db92ece3c) merges cleanly ontomaina11c8f7f7together with #3550 (b58c0428). The results match what I posted for #39:0x2013010000At 32x all 43 Stray requests compile, and every module passes
spirv-val --target-env vulkan1.3. The two slow shaders take 1.0 and 2.2 s.Full suite with both merged, on Intel Arc (Mesa 26.2.3 ANV) and lavapipe:
agc_driver_pixel_ancillary_wordandagc_driver_alpha_to_coveragepass on both. The only failure isagc_driver_vop1_float_unaryon Arc, which fails onmaintoo.One thing you may want to know: on both devices,
agc_driver_emulated_color_comparepasses with v3 alone. Onmainit fails with the sRGB sampling refusal, also with an empty shader cache. On lavapipe the same goes foragc_driver_image_plane_address_on_line_implicit_lod. I haven't looked into why.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T21:35:10Z.
@ThatsLeo thanks for running it on two more devices. So v3 and #3550 merge cleanly and keep all 43 Stray requests compiling at 32x. I'll open #39 from v3 as soon as my intake slot frees up (#3546 pending). On the
emulated_color_comparedifference: on our RTX 5070 it fails with v3 too, so it doesn't look like v3 is what changes it. Possibly device-dependent; I'll note it rather than claim anything.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T21:36:46Z.
Opened as #4031 from
carry/pixel-ancillary-word-v3, with @ThatsLeo's Arc/lavapipe results for v3 + #3550 in the description. It pairs with @MarcZX100's #3550.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T02:47:45Z.
A fix is being tested: the masked-select pass does one walk per select, and since #3279 most of those walks run to the end of the program, so its cost grew to selects times program size. The replacement is a single backward pass with the same result. I will open it once it has been through the title checks, and ask you to try it on
0x200f780000and0x200f7a0000then.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:06:58Z.
Closing: fixed by #4331. On its head
0x200f780000and0x200f7a0000prepare in 0.9 s and 1.8 s and all 43 requests compile (ThatsLeo's replay on the PR). Reopen if Stray still trips the render-thread watchdog on current main.