Skip to content

fix(agc): take the dword pattern-fill kernel only through a 32-bit output format - #4605

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
AlxcBTW:fix/agc-dword-pattern-fill-format
Oct 12, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
AlxcBTW:fix/agc-dword-pattern-fill-format

Conversation

@AlxcBTW

@AlxcBTW AlxcBTW commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

What

The dword pattern-fill kernel that #2081 runs as a buffer fill stores each pattern dword with buffer_store_format_x through the V# in user[0..3] (e0102000 in its code). The bytes that land in memory therefore depend on that descriptor's FORMAT field (user[3] bits 12-18). Only 32_UINT, 32_SINT and 32_FLOAT (20, 21, 22) store the dword unchanged. Any other format converts the value first. An 8- or 16-bit format also writes only 1 or 2 bytes of each 4-byte element (the kernel requires stride 4), so the buffer fill would overwrite the bytes in between. MatchDwordPatternFill checked stride, swizzle, add_tid and type, but not FORMAT.

It now also requires FORMAT 20-22. Every other format leaves the dispatch to the recompiler. The 16-byte fill kernel (matchesFillKernel, FORMAT 0x4b) and the pattern-fill kernel (MatchesPatternFillKernel, exact user[3]) already check the format.

Format numbers: IrBufferFormat in BufferFormat.hpp (Format32UInt = 20 .. Format32Float = 22), the GFX10 buffer format table. Store semantics: RDNA 2 ISA, MUBUF BUFFER_STORE_FORMAT_X ("untyped buffer store 1 dword with format conversion").

Tested

Head 4309bffdb on main d592d54e1.

  • agc_driver_dword_pattern_fill match checks: formats 21 and 22 match, as format 20 already did. 5 (8_UINT), 11 (16_UINT), 13 (16_FLOAT), 27 (16_16_UINT), 39 (10_11_11_USCALED) and 75 (32_32_32_32_UINT) don't. The execution cases are unchanged; they all use format 20.
  • Fork CI, run 38276470046: Linux passes 967 of 967 (lavapipe; 43 skipped for features lavapipe lacks), agc_driver_dword_pattern_fill included. Windows passes 973 of 973, with the GPU tests skipped for lack of a device.
  • Windows 11, RTX 5070 Laptop (NVIDIA; the AMD iGPU is hidden from the Vulkan loader): agc_driver_dword_pattern_fill and agc_driver_oversized_dispatch pass, with test binaries built on a second Windows 11 machine (MinGW GCC 15.2.0, Release). On that machine the non-GPU tests pass 618 of 619. log_macros fails there on every branch and passes in CI.
  • tools/check_conventions.py --base origin/main passes.
  • No title tested: none we know of runs this kernel with a format other than 20.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

…tput format

The kernel boykopovar#2081 matches stores each pattern dword with
buffer_store_format_x, so what lands in memory depends on the output
descriptor's FORMAT (bits 12-18 of user[3]). Only 32_UINT, 32_SINT and
32_FLOAT (20-22) store the dword unchanged. Other formats convert it,
and an 8- or 16-bit one writes 1 or 2 bytes of every 4-byte element, so
a buffer fill would also overwrite the bytes in between. Such a dispatch
now goes to the recompiler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the agc libSceAgc* label Oct 12, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 12, 2026
@oneandonlydean
oneandonlydean merged commit 1b92f7f into boykopovar:main Oct 12, 2026
9 checks passed
@AlxcBTW
AlxcBTW deleted the fix/agc-dword-pattern-fill-format branch October 12, 2026 18:56
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.

2 participants