test(shader): cover the bitwise and unsigned image atomics #667

Merged
adriadam10 merged 1 commit from upstream-pr/667 into main 2026-10-05 18:51:55 +00:00
adriadam10 commented 2026-10-05 13:05:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T13:05:34Z.


What

image_atomic_and, image_atomic_or, image_atomic_xor, image_atomic_umin and image_atomic_umax are decoded and translated, but no execution test runs them. This adds ImageAtomicsBitwise.cpp with the same shape as ImageAtomics.cpp: each lane swaps its own texel to a, runs the atomic with b and glc, then reads the texel back with image_atomic_add 0 glc. Pins the returned value (a) and the stored value.

The test is a new file, not part of ImageAtomics.cpp, so that it doesn't conflict with #659, which edits that file. Test only, no emulator change.

Rows: 64 lanes. 14 edge pairs (0 and all-ones, 0x7fffffff/0x80000000 to separate unsigned from signed min/max, alternating bit patterns, equal values) plus LCG values. It runs as wave32, as native wave64 and as wave64 split into two wave32 halves (ComputeTarget(32)).

Behaviour measured on HW

RDNA2 (gfx1035, wave32, 32_UINT 2D T#): all 64 rows match the model a & b, a | b, a ^ b, unsigned min/max, and the returned value is the previous texel. main already does this, so no bug was found.

Tested

  • Linux (CachyOS), GCC 16.2.1, Release build on main 53dc19cf: full ctest with ANYPS5_REQUIRE_VULKAN=1. The new test passes on RADV, on local lavapipe and on CI's lavapipe (Mesa 25.2.8, 0 s cold). agc_driver_pixel_helper_lanes, agc_driver_pixel_lds and agc_driver_pixel_lds_lane_slots also fail on main on this machine's RADV (wave32 lane 32 on a 64-wide subgroup), unrelated.
  • The test fails without each mapping. Swapping umin→smin, umax→smax, and→or, or→xor or xor→or in MemoryInstructionDispatch.cpp fails it on RADV and lavapipe.
  • Not tested: Windows, NVIDIA, a title.

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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4745340482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/667). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-05T13:05:34Z. --- ### What `image_atomic_and`, `image_atomic_or`, `image_atomic_xor`, `image_atomic_umin` and `image_atomic_umax` are decoded and translated, but no execution test runs them. This adds `ImageAtomicsBitwise.cpp` with the same shape as `ImageAtomics.cpp`: each lane swaps its own texel to `a`, runs the atomic with `b` and `glc`, then reads the texel back with `image_atomic_add 0 glc`. Pins the returned value (`a`) and the stored value. The test is a new file, not part of `ImageAtomics.cpp`, so that it doesn't conflict with #659, which edits that file. Test only, no emulator change. Rows: 64 lanes. 14 edge pairs (0 and all-ones, `0x7fffffff`/`0x80000000` to separate unsigned from signed min/max, alternating bit patterns, equal values) plus LCG values. It runs as wave32, as native wave64 and as wave64 split into two wave32 halves (`ComputeTarget(32)`). #### Behaviour measured on HW RDNA2 (gfx1035, wave32, 32_UINT 2D T#): all 64 rows match the model `a & b`, `a | b`, `a ^ b`, unsigned `min`/`max`, and the returned value is the previous texel. `main` already does this, so no bug was found. ### Tested - Linux (CachyOS), GCC 16.2.1, Release build on `main` 53dc19cf: full `ctest` with `ANYPS5_REQUIRE_VULKAN=1`. The new test passes on RADV, on local lavapipe and on CI's lavapipe (Mesa 25.2.8, 0 s cold). `agc_driver_pixel_helper_lanes`, `agc_driver_pixel_lds` and `agc_driver_pixel_lds_lane_slots` also fail on `main` on this machine's RADV (wave32 lane 32 on a 64-wide subgroup), unrelated. - The test fails without each mapping. Swapping umin→smin, umax→smax, and→or, or→xor or xor→or in `MemoryInstructionDispatch.cpp` fails it on RADV and lavapipe. - Not tested: Windows, NVIDIA, a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!667
No description provided.