Repository navigation
fix(agc): preserve all bytes in image-backed buffer copies - #6249
Conversation
|
I have integrated this in c0dcc05 and declared #5480 as a prerequisite. The coverage guard is now a AI-assisted: yes — Codex. |
bdf6533 to
5ba5489
Compare
5ba5489 to
2d9e3dc
Compare
2d9e3dc to
cf45924
Compare
|
A note on merge order. Our upcoming fix for Ghost of Tsushima Director's Cut (PPSA02225), fix/agc-3d-view-committed-slices-v2, registers its new tests next to this PR's in Ours will go second and adapt to this one when it merges, with this PR in its |
|
Test run (not a code review). I merged this PR onto current
So: no regression found, and no evidence of a fix either way. |
|
Linux run of this head
AI-assisted: yes (Claude Code) |
|
@babyhuey Thanks for the Linux run of this head on current |
What
I reproduced incorrect raw DMA copy results on main
d92a8dad390af1807cc91622b924252141816a5a. A completed GPU dispatch leaves a cached 128×120 RGBA16F surface occupying 131,072 guest bytes. The image-copy shortcut copies its texels but leaves 8,192 destination bytes unchanged. A subsequent DMA_DATA reader of offset0x15400receives0xa5a5a5a5instead of the source payload0x3b3a3938. The same packets withAPS5_NO_COPY_ALIAS=1copy every byte correctly. The packet's byte count follows the existing decoder and AMD PAL's BuildDmaData.I require proven image coverage of the entire guest byte range before selecting the image alias. The proof reuses
StorageTexture::uncoveredBytes, including its handling of tile edges, row pitch and mip gaps/tails. A range without complete proof uses the existing byte-transfer path.The coverage guard is a
plan.refusalin the sharedPlanAlias, immediately after the source lookup and before any destination lookup or creation.AliasCopyPossibleandAliasCopytherefore use the same coverage rule. The guard remains specific to raw buffer-copy alias selection; image-copy callers keep their existing semantics. Prerequisite #5480, including its no-device test-registration fix, is now merged into main. This rebase drops those carried commits and retains this PR's two commits, followed by a final main-update merge.The PM4 regression covers a fresh padded destination, a padded destination with older pending image results, and a fully covered 128×128 surface. It compares every source/destination byte after GPU completion and includes a subsequent 4-byte DMA payload consumer. All guest allocations remain alive throughout the cases. The no-alias control runs the same packets.
The additional preflight regression uses a cached source image without a source host import and an imported destination. A padded source must be refused before execution; registering it then enables the correct buffer transfer. A fully covered source must still support an image alias. The no-alias control verifies the buffer path for both layouts. Moving the guard back into
AliasCopyalone makes this regression fail.The original overlap review covered 62 exact shared PR implementations, including full diffs for 21 large branches. The #5480 diff (9 files, +163/-55) and the combined guard/test changes were reviewed during the original integration; #5480 is now part of main. #6197 changes import coverage, #5998 retained-image budgeting and #5761 untracked snapshots; these do not preserve the missing raw bytes.
Tested
Original before/after measurements, captured on 2026-10-15 on the same PC and GPU workload, compare main
d92a8dad390af1807cc91622b924252141816a5awith the original fix9886b3d96dc20bd068a9fe752d6275fb315cc85e(Windows 11, GCC 15.2.0, NVIDIA Windows driver 32.0.16.1714, shader disk cache disabled):0xa5a5a5a50x3b3a3938Validation refreshed on 2026-10-20. Tested head
cf459245b8b17b3e1bdcc7efc1440e7db03ad5aeincludes maind5c956a10087914b52922fd3ece6439ccbb3e741. The prerequisite #5480 and its no-device test-registration fix are already merged; the topic retains its two original fix/regression commits plus a final main-update merge. The byte-coverage regression source is unchanged from the previous published head.Windows (native host): Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0, Release; AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, Windows driver 32.0.16.1742 (NVIDIA 617.42).
relinker,libsand all executable targets needed by the focused tests built successfully. This includes the runtime and all patched libraries; unrelated test fixtures were not all built or run.329b9aa1a7a413b562263f47a6b6a5863bfc205fand the final change. Subsequent main updates were inspected: AGC, shader and libc sources stayed identical, and the only libkernel change was in the POSIX implementation excluded on Windows. The main-side results remain the comparison for these unchanged Windows paths; the final change was rebuilt and tested after the update. Both byte-copy variants additionally ran on the change. Runs usedANYPS5_REQUIRE_VULKAN=1,ANYPS5_GPU=NVIDIA,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, verbose logging and serial execution on the same machine and GPU.VK_LAYER_PATH; its DLL has a valid LunarG signature. The loader logs confirm actual layer insertion. Neither complete log contains a missing requested layer message or aVUID-validation error.VUID-errors in the complete logThe padded PM4 cases reported zero incorrect bytes and payload
0x3b3a3938; the fully covered positive control retained one image alias. Direct padded preflight refused the unimported source and used buffer path 1 after registration; direct dense preflight used image path 3. The no-alias control used the buffer path for both layouts.agc_driver_small_copy_syncand upstreamagc_driver_alias_copy_labelpassed. Patched-library validation loaded 352 libraries with zero failures.Conventions, whitespace, main-sync and test-registration audits passed. The earlier guard-location mutation check was not repeated; the regression source remains unchanged.
After configuring the full Release build with
BUILD_TESTING=ONand the supported MinGW toolchain, build the executable targets corresponding to the selected tests, plusrelinkerandlibs. Run this shared pattern on both checkouts:The full change-side pattern, including the two additional byte-copy cases, is:
Limits: no retail title, other GPU vendor or console timing run. Direct preflight and real PM4 packet tests establish byte-copy correctness for the exercised paths without a game compatibility or speed claim. Hosted full Windows jobs require collaborator dispatch under
CONTRIBUTING.md; skipped jobs are not passes.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)