Skip to content

fix(shader): group compute derivatives by four consecutive lanes - #5829

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:fix/compute-derivatives-linear-groups
Oct 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:fix/compute-derivatives-linear-groups

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

What

Fixes agc_driver_waterfall_images on main (Linux CI run 38562879025). The LOD-query cases from #5089 recompile a compute shader with an N x 1 workgroup, and the emitter declared DerivativeGroupQuadsKHR, which needs both workgroup dimensions even:

[VUID-StandaloneSpirv-DerivativeGroupQuadsKHR-10151] Local Size execution mode dimensions is (X = 8, Y = 1) but Entry Point id 39 also has an DerivativeGroupQuadsKHR execution mode

GFX10 forms a compute quad from four consecutive lanes, which is DerivativeGroupLinearKHR, so the capability and execution mode switch to the linear form. The wave64 path no longer reshapes its workgroup to 2 x N; that reshape was only there to make 2D quads cover consecutive lanes.

Tested

Linux, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON.

  • agc_driver_waterfall_images: fails on main with the VUID above on lavapipe (LLVM 20.1.2, GALLIUM_OVERRIDE_CPU_CAPS=avx, subgroup 8, as CI) and on an RTX 4090 (X = 32); passes on both with this change.
  • ctest -R "agc_|shader": 539/539 pass on lavapipe and on the RTX 4090.

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 under Silent stubs in their library's technical debt file
  • 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
  • Unblocks: none (fixes main CI after feat(recompiler): plan waterfall loops over per-lane T#s as non-uniform tables #5089)
  • GPUs tested: NVIDIA GeForce RTX 4090, driver 610.57.04, CachyOS Linux; lavapipe (Mesa, LLVM 20.1.2)
  • AI-assisted: yes

A compute shader with an LOD query was emitted with DerivativeGroupQuadsKHR,
which needs both workgroup dimensions even. A guest workgroup of N x 1 lanes
failed SPIR-V validation (VUID-StandaloneSpirv-DerivativeGroupQuadsKHR-10151),
which agc_driver_waterfall_images hits on every device.

GFX10 forms a compute quad from four consecutive lanes, which is
DerivativeGroupLinearKHR. The wave64 path no longer reshapes its workgroup
to 2 x N, which only made the 2D quads match consecutive lanes.
@github-actions github-actions Bot added the shader core/shader label Oct 14, 2026
@oneandonlydean
oneandonlydean merged commit 0c4e430 into boykopovar:main Oct 14, 2026
8 checks passed
fdfawef324 added a commit to fdfawef324/AnyPS5 that referenced this pull request Oct 19, 2026
… tables

A waterfall loop over a T# that each lane loaded with IDXEN buffer loads
(s_ff1/v_readfirstlane, v_readlane of the eight dwords, v_cmpx_eq against
the lane's VGPRs, the image instruction) stopped planning with
"GetImageResource dword 0 is not a valid runtime value". Bring back the
fold of boykopovar#5089 (reverted by boykopovar#5824 for a derivative-group validation error
that boykopovar#5829 fixed) on the image table model of boykopovar#757: the T# dwords are the
lane's own VGPRs under the loop's EXEC, and the access reads an image table
column keyed by the lane's buffer index, with the V#'s stride and
NUM_RECORDS addressing of the recompiler's buffer loads, a record count in
the table header, NonUniform slots, and whole-table faults for V# layouts
and for mixed image modes under implicit derivatives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant