Skip to content

fix(shader): order flat accesses into the LDS aperture like DS accesses - #2

Closed
Stan2032 wants to merge 310 commits into
mainfrom
topic/shader-flat-lds-wave-order
Closed

Stan2032 wants to merge 310 commits into
mainfrom
topic/shader-flat-lds-wave-order

Conversation

@Stan2032

@Stan2032 Stan2032 commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Staging copy on the fork; the fork's copied open-PR-limit workflow closed it automatically. The branch topic/shader-flat-lds-wave-order is what Stan opens upstream after boykopovar#28235 merges. Everything below ### What is the upstream description.

What

Lanes of a guest wave run in lockstep, so a lane can read LDS another lane of its wave just wrote. When the wave spans several host invocations, the SPIR-V emitter puts a wave LDS barrier between an LDS write and the next LDS access (WaveLdsScope, and the per-block ordering in SpirvFlowEmitter.cpp). Both only counted DS opcodes (SharedAccessOf). A flat load or store whose address falls in the shared aperture reaches the same LDS (RouteFlatAccess → LoadApertureElement), but it was neither ordered nor counted as an LDS write.

On lavapipe (8-lane subgroups) a wave32 runs as four subgroups, which llvmpipe runs one after another between barriers. In agc_driver_flat_aperture_lds_bounds the init loop writes LDS dwords 1022-1023 only from lanes 30-31, the last subgroup. The flat loads of the earlier subgroups ran before that subgroup had, so loads at 0xff8-0xfff returned 0, while the ds_read_u8 of the same bytes, which had a barrier, was correct. The SPIR-V showed an OpControlBarrier before each DS access and none before the aperture-routed flat loads.

WaveLdsAccess (next to RoutesApertures) counts an address access that routes through the apertures (ResourceKind::Flat, compute stage) by its read, write or atomic kind. Both WaveLdsScope and the per-block ordering use it. DS classification is unchanged.

Tested

Ubuntu 24.04.5, GCC 13.3, Release, lavapipe (Mesa 25.2.8, LLVM 20.1.2, 8-lane subgroups), main 1341e22.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: lavapipe (llvmpipe, Mesa 25.2.8, LLVM 20.1.2), Ubuntu 24.04.5
  • AI-assisted: yes

🤖 Generated with Claude Code

https://claude.ai/code/session_0125gxvaRgLMwjs53eqvUzya

oneandonlydean and others added 26 commits November 29, 2026 18:44
…or-publish-maine1

feat(agc): publish completed native color snapshots
…its chain (boykopovar#22572)

* fix(agc): reject a chained INDIRECT_BUFFER that revisits a buffer of its chain
* fix(agc): name the revisited chain buffer in the jump loop error
…serve-partial-overlap

fix(libkernel): replace the mapped parts of a partly free fixed reservation
…or-cpu-read-main9bf

feat(agc): publish native color before guest memory reads
…ovable-window

fix(relinker): let short SHA and CLZERO instructions move a neighbour into their stub
…hread-attr-guest-copy

fix(libkernel): copy PthreadAttr arguments and schedparam through guest helpers
…les-than-coverage

feat(agc): draw a depth target with fewer samples than the rasterizer at its own samples
…-windows-settle-floor

test(agc): keep the private gate's direct import under the Windows settle floor
…ard-png-parser

fix(libScePngParser): guard metadata scratch writes with GuestArena::HostWrite
…ard-shell-ui-util

fix(libSceShellUIUtil): guard guest write check with GuestArena::HostWrite
…ard-move-tracker

fix(libSceMoveTracker): guard guest write check with GuestArena::HostWrite
…ard-jpeg-parser

fix(libSceJpegParser): guard thumbnail guest writes with GuestArena::HostWrite
…ard-move

fix(libSceMove): guard guest write checks with GuestArena::HostWrite
…ard-custom-music-audio-out

fix(libSceCustomMusicAudioOut): guard guest write check with GuestArena::HostWrite
…ard-icu-bidi

fix(libSceIcu): guard guest write checks in Bidi with GuestArena::HostWrite
…de-host-region

fix(libc): place macOS hints inside host regions at the top of the arena
…al-query-committed-direct-only

fix(libkernel): report is_committed from sceKernelVirtualQuery only for direct memory, as a PS5 does
…rewind

fix(libSceGnmDriver): refuse a REWIND in a submitted draw command buffer
…oat-cb-conversion

fix(agc): match the measured CB conversion of 11_11_10 float color targets
…page-range

fix(libkernel): round sceKernelMunmap ranges to guest pages
…er-page

fix(agc): forget only the rewatched pages that leave the write watch
…edmemory-token-namespaces

fix(libkernel): give Windows shared memory per-token namespaces
…pr-window-direct-access

feat(shader): keep direct VGPR accesses direct outside indexed-write slots
Lanes of a guest wave run in lockstep, so the SPIR-V emitter puts a
wave LDS barrier between an LDS write and the next LDS access when the
wave spans several host invocations. It counted only DS opcodes. A flat
load or store whose address falls in the shared aperture reaches the
same LDS, but it was neither ordered nor counted as an LDS write.

On lavapipe (8-lane subgroups) a wave32 runs as four subgroups, which
llvmpipe runs one after another between barriers. The flat loads in
agc_driver_flat_aperture_lds_bounds therefore read the last LDS dwords
before the subgroup that writes them had run: 10 of 10 runs failed on
main (41 mismatches) and 0 of 10 with this change.

WaveLdsAccess counts an address access that routes through the
apertures (flat, compute stage) by its read, write or atomic kind, and
both WaveLdsScope and the per-block ordering use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0125gxvaRgLMwjs53eqvUzya
@github-actions github-actions Bot added the open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20 label Nov 29, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

@github-actions github-actions Bot closed this Nov 29, 2026
@github-actions

Copy link
Copy Markdown

Progress report (e2f8c66 → caa8fbe)

📈 System libraries: 47.83% (+0.0025%, +1 implemented function)

✅ 1 implemented
Library Name
libSceLibreSsl BIO_free_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl 276/402 (68.66%) 277/402 (68.91%) +0.25%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20

Projects

None yet

Development

Successfully merging this pull request may close these issues.