NVIDIA: wave64 NGG culling vertex program reads lane 63 of a full-wave OR reduction (Taxi Chaos 2, PPSA30279) #2783
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 AlxcBTW on 2026-10-10T14:43:16Z.
Taxi Chaos 2 (PPSA30279 v01.007.000, Unreal Engine) on NVIDIA: a wave64 NGG culling vertex program reads lane 63 of a full-wave OR reduction. The half-wave proof correctly rejects it.
On Windows with an RTX 5070 Laptop (subgroup 32), the title runs at 35-49 FPS for about 900 shaders. Then a vertex program registered at
0x18802d0000fails, and the rethrow at its first use (AwaitRegisteredPreparation) terminates the title:The same request prepares fine at subgroup 64. On the AMD iGPU (Radeon 880M,
ANYPS5_GPU=AMD) the title gets past this shader and stops at #2548 instead.What the program does (an NGG culling/compaction program:
s_sendmsg GS_ALLOC_REQ, a primitive export, LDS):This is a full-wave OR of a "vertex used" mask. Lane 31 holds lanes 0-31, lane 63 holds lanes 32-63, and
s_or_b32joins them. The result decides vertex compaction, the vertex count and the position-export EXEC.Why no rewrite is sound with the current inputs. For Vertex programs the entry code sets
s3 = waveSize | waveSize << 8(InstructionTranslator.cpp:354). So the program is told its wave holds 64 vertices and 64 primitives, and lanes 32-63 carry real, data-dependent cull results. If lanes 0-31 are all culled and some lane in 32-63 is accepted, the read decides whether lane 0's vertex counts as used. Treating lane 63 as the identity (0) would change the result.MatchHalfWaveScan(SpirvAluEmitterMath.cpp:433) rejects the scan for three reasons:truefroms_mov_b64 exec, -1, whileAllLanesBitonly recognises the ballot-word form;row_shrsteps usebound_ctrl:1, whichRowShiftFlagsrefuses (for OR the zero fill equals the identity);Points 1 and 2 look harmless to extend. Point 3 is the real blocker, and the rejection is correct.
A design question, not a proposal. On a narrow host, the Vertex entry code could describe the wave the host actually runs,
s3 = 32 | 32 << 8. The console can launch a wave with that vertex and primitive count, and with it lane 63's key is provably 0 for this program. But that makes Vertex translation depend on the host subgroup width. Today only compute and mesh inputs carry that, so it affects how preparation results are shared. It would also change every wave64 vertex program on NVIDIA that readss3: in this program the "all accepted, skip compaction" path becomes reachable. Is that direction acceptable, or should these programs keep failing on 32-lane hosts?Reproduced offline on
main5edae353:agc_shader_replaywith a temporaryPrepareShaderpath added locally, at subgroup 32 (fails) and 64 (prepares). Windows 11 26200, NVIDIA GeForce RTX 5070 Laptop (616.92), WinLibs GCC 15.2.0 r7, Release. The title's own run usedmaincf8b129eplus unrelated pending fixes, with 0 absent imports. Dump from my own copy; no game files are shared, only the disassembly lines above.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T21:18:02Z.
A second title with this exact program: Dungeons (PPSA16064, UE4) on an RTX 4060 Laptop, reported by MisterbALLIN in #2811 once its
selectstop was out of the way. It stops with the same reason,v_readlane_b32 of lane 63 is outside the 32-lane host subgroup, hash0x105228153600(and a second one,0x110596354048).I disassembled the posted request with
agc_shader_replay --asm. It's wave64, 732 code words, and matches your listing at the same offsets:v_cmpxofv21againsts3at 0x618,exec = -1at 0x6f8,v_cndmaskat 0x77c, the DPP OR scan from 0x794,v_permlanex16at 0x7d4,v_readlaneof lanes 31 and 63 at 0x7ec/0x7f4 (and the same pair for the high dword at 0x7fc/0x804), joined bys_or_b32at 0x80c/0x810. So it looks like stock engine code that more UE titles will hit on NVIDIA and Intel, which might help weigh the design question above.The request is attached to this comment if anyone wants to replay it.
AI-assisted (Claude Code); I ran the disassembly on my machine.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T23:19:11Z.
I implemented option A on a fork branch. The second title in #2811 (Dungeons, PPSA16064) shows this is stock UE culling code, and compute and mesh translation already depend on the host subgroup width in the same way.
Branch:
AlxcBTW/AnyPS5:fix/vertex-narrow-wave-entry, fork PR AlxcBTW/AnyPS5#339c00ef9d5fix(recompiler): give wave64 vertex programs on 32-lane hosts a 32-lane s3559910e30test(agc): run a wave64 NGG full-wave OR on a 32-lane devicec9fd4cc4efix(recompiler): keep lane 31 a shuffle without subgroup arithmeticFull fork CI, merged into current
main(run 38091700624): the Windows, relinker, register-context and write-watch jobs pass. Linux fails onlyagc_driver_flat_apertures, a 120 s timeout on lavapipe. That test reachedmainafter this branch was cut, and the fork's plainmainrun of the same cycle (38091700844) times out on it the same way.Why A. The width already reaches compute and mesh translation:
HostSubgroupSize(request)goes throughBuildShaderStageInputInfointoShaderWorkgroupInputInfo::hostSubgroupSize. There it sets the partial-wave EXEC inemitEntryPrologueand the two-lane layout inSpirvEmitter. The source, prepared-shader and disk cache keys already include it for every stage, so a vertex program prepared for 32 lanes is not reused for 64. The vertex entry now reads the same input, stored inShaderVertexInputInfo. This adds no new dependency and no new key.What changes
A wave64 vertex program on exactly 32 host lanes gets
s3 = 32 | 32 << 8. That is the condition the compute and mesh two-lane layout uses. Programs that never reads3translate to the same IR.On a 32-lane host, after the existing half-wave rules fail, the scan proof also accepts:
s_mov_b64 exec, -1;bound_ctrl:1steps where 0 is the identity (OR, add, unsigned max), also a step written to another register, which then writes every lane;v_mbcntof -1 below at most 32, then throughv_cmp_ne_u32against 0, OR, DPP and permlane chains.Lane 63 is then the identity, and lane 31 the subgroup reduction. On a device without subgroup arithmetic, lane 31 stays a shuffle as before. A
v_readlane_b32outside the subgroup of any other value that is 0 in lanes 32-63 reads 0.Lane 31 had to become the reduction, not a shuffle of the emulated scan. On the RTX 5070, every vertex warp of a non-indexed triangle list ran with 30 of its 32 invocations, so a shuffle from lane 31 read an idle invocation. With it, the execution test below covered no pixel.
The two TechnicalDebt entries (vertex entry
s3, lanes outside the host subgroup) are updated. Idle host invocations count as the identity where the console would see the laness3claims. That sits next to the existing note that a partial last wave still reports a full wave.What does not change
waveSize | waveSize << 8.bound_ctrland permlane lane rules are the ones the emitter already implements.Tests (Windows 11, GCC 15.2, RTX 5070 Laptop; synthetic programs only, no game code)
agc_shader_memory,verifyNarrowVertexWave: a wave64 NGG program with your listing's shape prepares on 32 lanes throughPrepareShader, with lane 31 as a subgroup OR. The shape isv_mbcntlane,v_cmpx_lt_u32_sdwaagainsts3byte 1,s_mov_b64 exec, -1,v_cndmaskkey,bound_ctrl:1OR row scan,v_permlanex16_b32, and readlane 31/63. It keeps its DPP scan on 64 lanes. Onmainit fails with the error from this issue.bound_ctrl:1.s3is prepared for 32 and 64 lanes in both orders with oneShaderPreparationContext. The two get separate sources,MatchesPreparedShaderrejects the other width, and the second preparation equals a first one. The two programs differ; with thes3change reverted, only that check fails. A wave32 program gives the same SPIR-V on 32 and 64 lanes.agc_driver_ngg_vertex_wave_reduction(new, Vulkan): the same scan in a real draw. Each vertex compares its wave's OR with the ballot of its keys and collapses its triangle when they differ, so every pixel must be covered.mainthe program does not build.agc_driver*on NVIDIA: 254/254. Non-GPU suite: 456/456.check_conventions.pypasses.s3change got Taxi Chaos 2 past both of its culling programs to the intro.Other designs. #1825 and #2261 (both open) route NGG programs that use LDS or
s_barrierto the mesh path. There, wave64 runs at two lanes per invocation, which would also take this program, with shared LDS. Option A only touches the vertex path and does not conflict with them. If you prefer that route for these programs, or want the narrowing scoped differently (only programs that reads3, or also hosts narrower than 32 lanes), I'm happy to adjust or drop this.@MisterbALLIN if you get a chance, Dungeons on your RTX 4060 with this branch on top of the
selectfix would be the real-title check: it should get past0x105228153600and0x110596354048.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T23:28:21Z.
@AlxcBTW thanks for picking this up. One correction first: I don't have Dungeons myself, MisterbALLIN does (the RTX 4060 is theirs), so the real-title check has to come from them. @MisterbALLIN if you can,
fix/vertex-narrow-wave-entrytogether withfix/select-random-devicefrom my fork is the combination to try.What I could do is run your branch on two more 32-lane devices. I merged it onto
main4b9f0751and tested on Windows 11 with WinLibs GCC 15.2.0, Release, on an RTX 5060 Laptop and on the Arrow Lake iGPU in the same machine ("Intel(R) Graphics", 0x7d67). The Intel one is the interesting case: it reports a subgroup size of 32 but supports 8 to 32, so it's a different kind of 32-lane host from the NVIDIA cards.agc_shader_memory,agc_driver_ngg_vertex_wave_infoandagc_driver_ngg_vertex_wave_reductionpass on both GPUs. I ran the reduction test directly on each to make sure it didn't skip: both print "NGG vertex wave reduction tests passed", so the draw ran and every pixel was covered on Intel too.agc_*tests: 335/335 on the RTX 5060.main(181420f8) without your branch:agc_driver_lds_mixed_width_atomicsloses the device (vkWaitForFencesreturns -4), and the fouragc_driver_prepared_shadersruns stop at "viewport depth outside [0, 1] requires VK_EXT_depth_range_unrestricted", which this iGPU doesn't have. So nothing on either GPU changed because of the branch.AI-assisted (Claude Code); I ran all of the above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T23:30:54Z.
Thanks for running it on both GPUs, and sorry for mixing up who has Dungeons. I've corrected the name and the mention in my comment above.
The Intel run is the check I couldn't do. That GPU reports 32 lanes but can run anywhere from 8 to 32, and the reduction draw still covers every pixel on it. Good to know the five other Intel failures are on plain
maintoo.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-11T00:11:20Z.
Can someone guide me on how I combine them together ?
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T00:12:55Z.
@MisterbALLIN sure. In your AnyPS5 checkout (any clone works, these commands use full URLs), start a new branch from current upstream
mainand merge both branches into it:Then build and relink Dungeons the way you did for Silverash's branch. I checked that both merge into
main942a174ewithout conflicts. Ifgit checkoutcomplains about local changes, rungit stashfirst.If the game gets past the menu, it should no longer stop with
v_readlane_b32 of lane 63. Whatever it stops at next, please post that message here.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-11T01:04:26Z.
The game still crashes at the same area. Here's the log file which also has a RecompileRequest.
output.txt
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T01:05:41Z.
@MisterbALLIN thanks for the log. It's actually progress: the lane 63 error is gone. Your log shows a different stop, in a pixel shader:
That's #2548, the same stop as Returnal, Demon Slayer and Lies of P. AlxcBTW/AnyPS5#30 fixes it. On your
dungeons-testbranch, add one more merge:I checked that all three branches merge into current
mainwithout conflicts. If you start the game with the environment variableAPS5_TRACE_ANCILLARY=1, each of those shaders prints an[ancillary]line, which shows whether this fixed them. If it stops again, the log is just as useful as this one.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-11T01:06:43Z.
Where do I add this environment variable ?
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T01:06:49Z.
@MisterbALLIN thanks for testing. This is actually progress: it's a different stop. Your log has no
lane 63message anywhere, so the two culling programs from this issue went through. The game now stops on a pixel shader instead (line 458 of your log):That's a known one from other Unreal titles, #2548 (and #2881). AlxcBTW has a branch for exactly this
SelectU32 ? ?case,fix/ancillary-image-read(AlxcBTW/AnyPS5#30, see their last comment on #2548). On top of the branch you already have, it's one more merge:I checked that all three (
fix/vertex-narrow-wave-entry, myfix/select-random-deviceandfix/ancillary-image-read) merge intomain06da1176without conflicts.One note on the log: the
RecompileRequestin it is cut off. The game aborted while it was being printed, so the line ends inFATAL: abort() (SIGABRT)after about 600 bytes of a much larger request, and it can't be replayed. If it still stops after the merge, attaching the request as a separate file like you did in #2811 would let us replay it.AI-assisted (Claude Code); I read the log and ran the merge on my machine.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T01:09:02Z.
@MisterbALLIN set it in the terminal you start the game from, just before the start command:
$env:APS5_TRACE_ANCILLARY = "1"set APS5_TRACE_ANCILLARY=1It applies to anything started from that window until you close it. It's optional; the merge alone is the fix. The switch only adds
[ancillary]lines to the log.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-11T01:17:59Z.
Previous merge does not output the full RecompileRequest. I will trying it out with this new merge.
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-11T01:37:24Z.
Update, no RecompileRequest blocks have been found in this new merge. Still crashes but there are many ancillary lines.
log.txt
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T01:40:47Z.
@MisterbALLIN thanks, that's progress again. The ancillary stop is gone. Your log has no
unsupported live useline. The two shaders that used to fail,0x190095e900and0x190095fc00, now get the whole word ([ancillary] ... whole word for ... SelectU32), and the rest of the[ancillary]lines are just the trace. Without the switch you won't see them.The new stop is a different area, near the end of your log:
That's a 16-bit depth surface read as a cube texture, most likely a point-light shadow map. #425 implements exactly that: its description lists depth planes sampled as 2D arrays and as cubes. But #425 doesn't merge into current
mainat the moment (a conflict inDepthSurface.cpp/.hpp), so it isn't a one-line merge like the others. @MichonGoddijn231849, FYI: Dungeons (PPSA16064) is another title that stops on a cube read of a D16 plane.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-11T01:45:56Z.
Is there a way to locally solve that issue ?
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T01:47:48Z.
@MisterbALLIN not with a plain merge. The conflict needs resolving by hand. I'm putting together one combined branch on my fork: current
main, the three branches you already have, and #425 with the conflict resolved. I'll build and test it before I post it here, so you'll only need to fetch that one branch.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T03:31:27Z.
@MisterbALLIN as promised, everything is on one branch, so you don't have to do the merges yourself:
Then build as before. The branch is upstream
mainplusfix/vertex-narrow-wave-entry, Silverash-i8'sfix/select-random-device,fix/ancillary-image-readand #425 by @MichonGoddijn231849, which brings #374 with it. #425 adds the D16 cube read your log stopped on. It's a local integration for testing only. It doesn't replace #425 or the other PRs, which still go in on their own. On Windows CI it passes 764/764; on Linux only the two tests thatmainitself fails there fail. If Dungeons gets further or stops somewhere new, please post the new log.@MichonGoddijn231849 one thing for your rebase: since #1430,
mainhas aDepthSurface::Holdsshortcut that reuses a sampled depth texture without looking it up again. With #374/#425 that lookup applies a pending HTILE clear and takes storage-image writes back first, so I madeHoldsreturn false while the surface has a pending clear or an unread storage writer. Commitf21a822e9on that branch has the change and a test that fails without it.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-11T03:53:41Z.
The issue is clearer this time, as it is located at the end of the log file.
log.txt
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T03:55:20Z.
@MisterbALLIN thanks, that's another step: the D16 cube read from #425 went through. The new stop is
That's layered rendering, a draw into all slices of an array or 3D color target, tracked in #2102. #1077 by @alfalfa-star implements it. It conflicts with current
mainin seven files right now, so it can't simply be merged on top. It needs a rebase from its author.For context: Sword of the Sea hit the same stop. I got past it there with a local port of #1077, but that sits on an older base and isn't something I can hand out as a clean branch. I'll note Dungeons on #2102 as another title that needs this.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T10:09:58Z.
High on Life (PPSA15388 v01.120.000, Unreal Engine 4) is another title with this stop. Loading a save aborts right after the loading screen:
@AlxcBTW's
fix/vertex-narrow-wave-entry(AlxcBTW/AnyPS5#33) cherry-picks cleanly onto my tree and fixes it. The abort hasn't come back in any run since, and the run now stops later on unrelated problems (#2548).Details
Setup: CachyOS (Linux 7.2), RTX 4090 (NVIDIA 615.78), GCC, Release.
mainf5c0fe00plus my local integration patches and ports of #423/#1077, #425, #454, #2904 and #3202. The three commits apply without conflicts.ngg_vertex_wave_reductionand the lane tests pass, and the rest ofagc_*has only the failures my tree had before.The program is the UE culling vertex shader: wave64 NGG with
v_readlane_b32 … 31/… 63pairs ands_sendmsg GS_ALLOC_REQ. It contains no loops.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T10:21:36Z.
@Tamalero thanks for testing it. High on Life is the second title confirmed past this stop with #33, after Minecraft Dungeons II. Taxi Chaos 2 has the same culling program but hasn't been run with it yet.
The full Windows and Linux suites just passed on AlxcBTW/AnyPS5#33 (head c9fd4cc4e). Onto current
mainthe three commits merge with one conflict, indocs/dev/TechnicalDebt.md; the code merges cleanly.@oneandonlydean if you want to carry it, it's ready. If a rebased branch helps, I can push one.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T11:21:18Z.
@oneandonlydean intake is open again, so no need to carry this one. I'll open it myself as an upstream PR, rebased onto current
main, once the rebased branch has passed the tests again.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T12:57:46Z.
Opened as #3546, rebased onto current
main.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by queeeef on 2026-10-11T17:21:52Z.
Palworld (PPSA23126, 01.102.999, Unreal Engine) on an RTX 2080 Ti (subgroup 32) stops here when the character creation screen opens:
A second vertex program,
0x1843dfc000(hash0x104217952256), fails the same way on another run. It reproduced in every run that reached that screen.#3546 merges cleanly onto
maina11c8f7f7with the other Palworld fixes (#2648). With it the screen opens and neither program fails; the next stop is unrelated (#3832).Windows 11 Pro 26300, NVIDIA 610.74, MinGW-w64 GCC 15.2.0 (WinLibs r7), RelWithDebInfo. AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T17:24:20Z.
@queeeef thanks, that's the third title it confirms and the first on a 20-series card. I've added Palworld to #3546's description.
AI-assisted: yes (Claude Code)