Skip to content

perf(agc): handle uniform pattern-fill kernels as clears - #1335

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
TibixDev:pr/uniform-pattern-fill
Oct 9, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
TibixDev:pr/uniform-pattern-fill

Conversation

@TibixDev

@TibixDev TibixDev commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What

Recognize the exact typed pattern-fill kernel. Use the existing clear path when its pattern is uniform and the destination is aligned and does not alias its inputs. Keep shader execution for other cases.

Preserve dispatch bounds, descriptor bounds, queued labels, and partial workgroups. #1201/#1202 change fill scheduling but do not recognize this kernel.

Tested

Fedora 44, Release, RX 6600: graphics and PM4 tests; real dispatch tests with Vulkan validation, HLE on and off, wave32/wave64, indirect and partial dispatches, default import settings and forced copies, and GPU-to-label ordering.

Semantics: 16 native RX 6600 cases checked typed R32_UINT loads/stores, execution masks, and descriptor bounds. PS5 hardware was not tested. Isolated comparison: upstream e9846679 versus the same revision plus this PR. Complete fill-and-publish medians fell from 0.592 → 0.303 ms at 4 KiB, 1.175 → 0.431 ms at 1 MiB, and 92.070 → 7.370 ms at 64 MiB. Six pinned processes per variant in ABBA order; the pattern changes each fill and every output word is checked. These are component timings, not title frame time. Windows was not tested.

Checklist

  • Current main; no duplicate open PR.
  • One topic.
  • No new code comments.
  • Unsupported paths still throw; UI stubs are documented.
  • No notes, logs, or images in the repository.
  • No new third-party code.
  • General behavior.
  • Depends on: none.
  • AI-assisted: yes.

Recognize the exact typed pattern-fill kernel and route aligned, nonaliased uniform ranges through existing fill/coherence handling. Preserve control and descriptor bounds, partial dispatch counts, queued labels, and shader fallback for other cases.

Semantics checked on Radeon RX 6600: native RDNA wave32/wave64 typed R32_UINT loads/stores, execution masks, and descriptor bounds (16 cases). Real PM4 tests cover HLE and shader paths, imports and copies, indirect/partial dispatch and GPU-to-label ordering under Vulkan validation. Graphics and PM4 tests pass; Skyrim Helgen save visually checked. 64 MiB copied-buffer fill median reduced from 67.5 ms to 3.8 ms.

Written with AI assistance.
@TibixDev
TibixDev force-pushed the pr/uniform-pattern-fill branch from ede66dd to ce280a1 Compare October 8, 2026 06:10
@TibixDev

TibixDev commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on e9846679 with no production changes.

Measured upstream e9846679 against the same revision plus this PR (ce280a19). Fedora 44, GCC 16 Release, Ryzen 5 5600, CPU 3, RX 6600 with host RADV and its matching host library directory. Supporting libc and libkernel binaries are identical between variants.

The same fixture submits the real wave32 pattern-fill command stream to each driver. Each size has one warmup and nine measured fills. The uniform pattern alternates each time, so an unchanged result cannot satisfy the next fill. The timer includes submission, wait-idle, and publication to the host buffer; every output word is checked after the timer. Buffers are ordinary unregistered host allocations, with default import settings. Six processes per variant in ABBA × 3 order. Validation is off for timing, and no game or build ran alongside it.

Bytes filled Upstream median (ms) PR median (ms) Less time Upstream range PR range
4,096 0.592 0.303 48.9% 0.563–0.716 0.297–0.307
1,048,576 1.175 0.431 63.3% 1.003–1.212 0.369–0.451
67,108,864 92.070 7.370 92.0% 89.539–96.021 7.190–7.521

Both variants pass the command-stream correctness cases under RADV core and sync validation. The PR's full pattern-fill suite also passes with default imports, host imports disabled, and HLE disabled. It covers wave32/wave64, indirect and partial dispatches, bounds, nonuniform fallback, and GPU-to-label ordering. Graphics, PM4, and contribution checks pass.

This is not title frame time. PS5 hardware and Windows were not tested. AI-assisted.

@popcoder565

Copy link
Copy Markdown
Contributor

Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head ce280a19, merged onto main 8b393b6 in one build with 31 other PRs that had no Windows run.

No title was run.

🤖 Addressed by Claude Code

MichalSy added a commit to MichalSy/AnyPS5 that referenced this pull request Oct 9, 2026
Adapt the typed pattern-fill kernel from upstream PR boykopovar#1335 and the depth metadata clear path from PR boykopovar#374. Require padded Navi1x metadata coverage and invalidate pending clears on reassociation, retirement, or later tracked stores.

Validate typed fills and depth readback on NVIDIA, with focused decoder and kernel regression tests.
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

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
#2081 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cpp L91-98, L100-104

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the exact-kernel match (code words, descriptor strides/formats, thread shape), the uniform/alignment/alias conditions and the dispatch/descriptor clamps against the diff; agc_driver_pattern_buffer_fill passes on Linux (Vulkan) and CI is green on the current head, plus @popcoder565's Windows run. Merging.

Note for whoever lands second between this and #2081: both touch fillBuffer in BufferFill.cpp and will need a small rebase.

@adriadam10
adriadam10 merged commit d992f76 into boykopovar:main Oct 9, 2026
4 of 5 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
perf(agc): handle uniform pattern-fill kernels as clears
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants