test(agc): keep pipelined dispatch targets in one address window #9696

Merged
MarcZX10 merged 4 commits from upstream-pr/9696 into main 2026-10-31 15:24:00 +00:00
MarcZX10 commented 2026-10-22 08:54:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:54:19Z.


What

Fixes #9680 by reserving a contiguous three-block target region for the pipelined dispatch test and selecting two adjacent blocks whose upper 32 address bits match. This removes the Windows allocation-order dependency that made the test intermittently fail when separate VirtualAlloc calls straddled a 4 GiB boundary. Adds focused boundary-selection coverage.

Tested

  • Linux Release build of agc_driver_target_address_window_tests and agc_driver_pipelined_dispatch_tests: passed.
  • Focused CTest: passed (1/1).
  • The pipelined dispatch test executable cannot run on this host: it exits before tests because the Xeon E5-1620 v2 lacks required AVX2, FMA, BMI1/BMI2, and other CPU features.
  • Windows reproduction and GPU validation were not available locally.

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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: #9680
  • Unblocks: none
  • GPUs tested: none; GPU validation was unavailable
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4964728850 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9696). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T08:54:19Z. --- ### What Fixes #9680 by reserving a contiguous three-block target region for the pipelined dispatch test and selecting two adjacent blocks whose upper 32 address bits match. This removes the Windows allocation-order dependency that made the test intermittently fail when separate `VirtualAlloc` calls straddled a 4 GiB boundary. Adds focused boundary-selection coverage. ### Tested - Linux Release build of `agc_driver_target_address_window_tests` and `agc_driver_pipelined_dispatch_tests`: passed. - Focused CTest: passed (1/1). - The pipelined dispatch test executable cannot run on this host: it exits before tests because the Xeon E5-1620 v2 lacks required AVX2, FMA, BMI1/BMI2, and other CPU features. - Windows reproduction and GPU validation were not available locally. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - Depends on: none - Fixes: #9680 - Unblocks: none - GPUs tested: none; GPU validation was unavailable - AI-assisted: yes
clairtonmichel commented 2026-10-22 09:04:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by clairtonmichel on 2026-10-22T09:04:18Z.


Tested on AMD Ryzen 7 9800X3D and AMD Radeon RX 7900 XTX (Fedora Linux, Mesa 26.2.5):

  • Built cleanly with zero errors.
  • Ran the AGC driver test suite (640 tests): passed successfully, aligning perfectly with standard environment baselines (known pre-existing test quirks).
  • Pipelined dispatch targets address window changes are fully stable. Ready to merge!
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6336973260 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9696#issuecomment-6336973260). Originally posted by [clairtonmichel](https://github.com/clairtonmichel) on 2026-10-22T09:04:18Z. --- Tested on AMD Ryzen 7 9800X3D and AMD Radeon RX 7900 XTX (Fedora Linux, Mesa 26.2.5): - Built cleanly with zero errors. - Ran the AGC driver test suite (640 tests): passed successfully, aligning perfectly with standard environment baselines (known pre-existing test quirks). - Pipelined dispatch targets address window changes are fully stable. Ready to merge!
jotitadev commented 2026-10-22 09:53:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T09:53:43Z.

Review: COMMENTED


Ran this on an RTX 3070 and lavapipe, including a forced red→green: on Linux the split from #9680 doesn't happen on its own, so I placed the blocks across a 4 GiB boundary.

Ubuntu 26.04, i7-8700, GCC 15.2, Release, head 351ec4edf (base main 7e2ba73e4), ANYPS5_REQUIRE_VULKAN=1. GPUs: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), picked with ANYPS5_GPU and checked in the Selected GPU line.

aligned_alloc takes the blocks one after the other from the main heap here, so main passed 100 of 100 separate runs on each device, idle and with 10 busy loops on the CPU. To force the split, an LD_PRELOAD shim (not in the repo) maps the test's 64 KiB aligned_alloc blocks with mmap(MAP_FIXED_NOREPLACE) next to 0x500000000000:

RTX 3070 lavapipe
main, fifth block at 0x4fffffff0000, sixth at 0x500000000000 3/3 fail, the two targets do not share their high address dword same
this PR, three-block region at 0x4fffffff0000 (boundary at block 1, pair {1, 2}) 3/3 pass 3/3 pass
this PR, region at 0x4ffffffe0000 (boundary at block 2, pair {0, 1}) 3/3 pass 3/3 pass
this PR, 100 separate runs without the shim 0/100 failed 0/100 failed
agc_driver_pipelined* + agc_driver_target_address_window (9 tests), 3 times pass pass

The forced runs pass all four descriptor rounds. The check is needed, not just defensive: on main with the check removed and the targets forced apart, the test fails at descriptor round 1: lane 0 of the output is 1, expected 1802174467, because the table keeps TargetA's high dword and gets TargetB's low dword.

GPUs tested: NVIDIA GeForce RTX 3070, driver 595.99.02, Ubuntu 26.04; lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5612364198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9696#pullrequestreview-5612364198). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T09:53:43Z. **Review:** COMMENTED --- Ran this on an RTX 3070 and lavapipe, including a forced red→green: on Linux the split from #9680 doesn't happen on its own, so I placed the blocks across a 4 GiB boundary. Ubuntu 26.04, i7-8700, GCC 15.2, Release, head `351ec4edf` (base `main` 7e2ba73e4), `ANYPS5_REQUIRE_VULKAN=1`. GPUs: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), picked with `ANYPS5_GPU` and checked in the `Selected GPU` line. `aligned_alloc` takes the blocks one after the other from the main heap here, so `main` passed 100 of 100 separate runs on each device, idle and with 10 busy loops on the CPU. To force the split, an `LD_PRELOAD` shim (not in the repo) maps the test's 64 KiB `aligned_alloc` blocks with `mmap(MAP_FIXED_NOREPLACE)` next to `0x500000000000`: | | RTX 3070 | lavapipe | |---|---|---| | `main`, fifth block at `0x4fffffff0000`, sixth at `0x500000000000` | 3/3 fail, `the two targets do not share their high address dword` | same | | this PR, three-block region at `0x4fffffff0000` (boundary at block 1, pair {1, 2}) | 3/3 pass | 3/3 pass | | this PR, region at `0x4ffffffe0000` (boundary at block 2, pair {0, 1}) | 3/3 pass | 3/3 pass | | this PR, 100 separate runs without the shim | 0/100 failed | 0/100 failed | | `agc_driver_pipelined*` + `agc_driver_target_address_window` (9 tests), 3 times | pass | pass | The forced runs pass all four descriptor rounds. The check is needed, not just defensive: on `main` with the check removed and the targets forced apart, the test fails at `descriptor round 1: lane 0 of the output is 1, expected 1802174467`, because the table keeps `TargetA`'s high dword and gets `TargetB`'s low dword. GPUs tested: NVIDIA GeForce RTX 3070, driver 595.99.02, Ubuntu 26.04; lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04 Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
hypermoist commented 2026-10-22 14:14:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-22T14:14:04Z.


Tested head 351ec4edf4 with fresh builds.

Linux (GCC, Release): agc_driver_pipelined_dispatch_item passed 10/10 and agc_driver_target_address_window passed.

Windows (MinGW GCC 16.2 in the DWARF mode from docs/dev/BUILD.md, run under Wine): agc_driver_pipelined_dispatch and agc_driver_pipelined_dispatch_item passed 5/5. agc_driver_target_address_window_tests does not link:

TargetAddressWindow.cpp:(.data+0x8): undefined reference to `__gxx_personality_v0'

With -fno-asynchronous-unwind-tables, the toolchain's libstdc++ has only __gxx_personality_seh0, and __gxx_personality_v0 comes from libc (exception/Personality.cpp). This target links nothing. Once I linked liblibc.dll.a by hand, it built, but the expected std::runtime_error escaped the catch and aborted the test, because the .eh_frame rename from configure_windows_unwind was missing. After applying that rename, it printed target address window test passed. The Windows job on this PR was skipped, so CI has not exercised it yet.

Changes that made it pass here, matching agc_driver_mesh_tests and the agc_spirv_* tests:

target_link_libraries(agc_driver_target_address_window_tests PRIVATE libc)
configure_windows_unwind(agc_driver_target_address_window_tests)
set_tests_properties(agc_driver_target_address_window PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6342924085 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9696#issuecomment-6342924085). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-22T14:14:04Z. --- Tested head 351ec4edf4 with fresh builds. Linux (GCC, Release): `agc_driver_pipelined_dispatch_item` passed 10/10 and `agc_driver_target_address_window` passed. Windows (MinGW GCC 16.2 in the DWARF mode from docs/dev/BUILD.md, run under Wine): `agc_driver_pipelined_dispatch` and `agc_driver_pipelined_dispatch_item` passed 5/5. `agc_driver_target_address_window_tests` does not link: ``` TargetAddressWindow.cpp:(.data+0x8): undefined reference to `__gxx_personality_v0' ``` With `-fno-asynchronous-unwind-tables`, the toolchain's libstdc++ has only `__gxx_personality_seh0`, and `__gxx_personality_v0` comes from `libc` (`exception/Personality.cpp`). This target links nothing. Once I linked `liblibc.dll.a` by hand, it built, but the expected `std::runtime_error` escaped the `catch` and aborted the test, because the `.eh_frame` rename from `configure_windows_unwind` was missing. After applying that rename, it printed `target address window test passed`. The Windows job on this PR was skipped, so CI has not exercised it yet. Changes that made it pass here, matching `agc_driver_mesh_tests` and the `agc_spirv_*` tests: ```cmake target_link_libraries(agc_driver_target_address_window_tests PRIVATE libc) configure_windows_unwind(agc_driver_target_address_window_tests) set_tests_properties(agc_driver_target_address_window PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>") ```
hypermoist commented 2026-10-22 14:51:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-22T14:51:55Z.


Follow-up: I reproduced the link failure with the exact toolchain the Windows job uses (WinLibs winlibs-x86_64-posix-seh-gcc-15.2.0-mingw-w64ucrt-14.0.0-r7, DWARF mode). I compiled TargetAddressWindow.cpp with the build's flags (-O3 -std=gnu++20 -fno-asynchronous-unwind-tables) and linked it without libc, which gives the same undefined reference to '__gxx_personality_v0'. The three CMake lines above are still needed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6343737780 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9696#issuecomment-6343737780). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-22T14:51:55Z. --- Follow-up: I reproduced the link failure with the exact toolchain the Windows job uses (WinLibs `winlibs-x86_64-posix-seh-gcc-15.2.0-mingw-w64ucrt-14.0.0-r7`, DWARF mode). I compiled `TargetAddressWindow.cpp` with the build's flags (`-O3 -std=gnu++20 -fno-asynchronous-unwind-tables`) and linked it without `libc`, which gives the same `undefined reference to '__gxx_personality_v0'`. The three CMake lines above are still needed.
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!9696
No description provided.