Skip to content

fix(agc): materialise cold DCC colour before tracking - #20534

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
VicRaster:fix/resident-dcc-known-zero
Nov 28, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
VicRaster:fix/resident-dcc-known-zero

Conversation

@VicRaster

@VicRaster VicRaster commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

An overlapping ImportWatched window can first-touch demand-zero colour pages after a resident multisample DCC owner has captured its write generation. On Windows those page faults appear in write-watch reports, so the later reuse refuses the unchanged colour range as a guest write.

Materialise known-zero DCC planes before collecting their initial generations. The regression creates a native owner over untouched colour pages, checks its samples across an overlapping import and an adjacent store, and verifies that real zero and nonzero stores still refuse, at 2, 4 and 8 samples.

Tested

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 (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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA RTX 3080 Ti, driver 610.88, Windows 11
  • AI-assisted: yes

@github-actions github-actions Bot added build agc libSceAgc* labels Nov 15, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

The changed code addresses the stated cold DCC initialization case, but I did not run the tests, so a formal approval is not justified.

What I ran

Reviewed head 62e9dbca4635c448781f605a5646259149180c53. I read the diff, manifest, description, and changed code around the implementation and regression test. No commands or tests were run.

Results

Check Result Note
Diff and changed code review passed Three changed files inspected
Test execution not run Windows results are author-reported
Negative control not run Could not run the regression without the fix

Findings

Blocking

None.

Non-blocking

None.

Not verified

The reported Windows test runs and Vulkan validation results were not independently verified. I did not read every line of the two large C++ files; I read the changed hunks and relevant implementation context. files.json was not available through the reader; the manifest lists three changed files, all included, and the file listing reports no excluded changed files.

To get this to a good state

Nothing is required. Optional: independently run the focused CTest cases on the stated Windows setup.

@blawesom

Copy link
Copy Markdown
Contributor

Validation: PR #20534 (Linux/AMD, RADV) — PASS

Independent end-to-end run of head 62e9dbca4635c448781f605a5646259149180c53 (fix/resident-dcc-known-zero), 2026-11-15. Diagnostic/validation only — no code changes, no push.

Environment: CachyOS, kernel 7.3.4-1-cachyos x86-64 · GCC 16.2.1 · CMake 4.4.5 / Ninja 1.13.2 · AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.6, Vulkan 1.4.354) · Khronos validation layer 1.4.363 (via VK_LAYER_PATH=/home/benj/.local/opt/vulkan-validation-layers/...; ≥ required 1.4.335) · Release, BUILD_TESTING=ON, builds capped at --parallel 12 (CMAKE_BUILD_PARALLEL_LEVEL=12 GOMAXPROCS=12).

Merge baseline: git merge-tree --write-tree origin/main HEAD → clean, no conflicts (single commit on branch, +51/−2: MultisampleTarget.cpp, agc_driver_sample_multisample_target_tests.cmake, SampleMultisampleTarget.cpp).

Gate 1 — build: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON + cmake --build build --parallel 12 → exit 0, 10434 targets, 6m14s wall.

Gate 2 — focused GPU tests, head vs base, same host/GPU (ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, sequential ctest):

  • head, prescribed regex sample_multisample|multisample_target: 1/1 passed; head, effective regex covering all 13 tests of agc_driver_sample_multisample_target_tests (incl. the 3 new agc_driver_cold_texture_dcc_{2,4,8}): 13/13 passed
  • base (merge-base worktree, identical build): 1/1 and 10/10 passed (base lacks the 3 new tests)
  • validation layer: Insert instance layer "VK_LAYER_KHRONOS_validation" present in every run, was not found but was requested by env var VK_INSTANCE_LAYERS = 0 everywhere, VUID- lines: 0 on head, 0 on base → no new validation errors
  • no failures observed, so no flake reruns were needed

Gate 3 — repo checks: tools/check_conventions.py --base origin/main → pass. tools/pr_overlap.py --branch → exit 2 (failed closed): 26 open PRs share these files but conflict with base, so auto-comparison was skipped — manual comparison advised per the tool's own message. Informational only.

Gate 4 — reproducer: build/tests/agc_driver_sample_multisample_target_tests --cold-texture-dcc {2,4,8} directly → all three exit 0 with the new assertion line ("Cold DCC color: N samples preserve clears across overlapping imports and adjacent stores, and refuse real zero and nonzero stores"), layer inserted 3/3, VUIDs 0.

Verdict: PASS. Logs/worktrees preserved locally under /tmp/opencode/wt-20534{,-base}/logs/. Caveat: GFX1201/GFX12 host — results are environment-specific to RADV GFX12, not a NAVI31 claim. AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6808 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 9915 core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 22692 core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 23252 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
PR 24049 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp

@hamdanpor-ctrl

Copy link
Copy Markdown
Contributor

Test report, NVIDIA on Windows: no regressions from this PR; the new agc_driver_cold_texture_dcc_2, _4 and _8 pass.

  • GPU: NVIDIA GeForce RTX 3050 Laptop GPU, driver 617.42, Windows 11 Pro (10.0.26300)
  • Build: WinLibs GCC 15.2.0 r7 UCRT, Release, all AGC execution tests built
  • Compared: main at e4caa07 with fix(tests): set the upload cache test's environment with _putenv_s on Windows #19899 merged (current main does not build on MinGW: UploadCacheReadOnlyFlush.cpp:177: 'setenv' was not declared), and the same tree with 62e9dbc merged (git merge --no-ff, clean)
  • Environment: ANYPS5_GPU=NVIDIA, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0)
  • Command: ctest --test-dir build -V --parallel 4 -R "^agc_|^request_serializer|shader"
main main + this PR
Passed 1911 1914
Failed 2 2, the same two
Skipped 18 18
VUID- lines 0 0
Validation messages 64 64, same IDs
  • agc_driver_cold_texture_dcc_2 (1.2 s), _4 (1.4 s) and _8 (1.6 s) are new and pass.
  • Every other test has the same result on both sides. The layer loads in both logs and neither reports it missing.

Unrelated to this PR: two tests fail on main itself on this machine, every time (also 3 of 3 when run alone):

  • agc_driver_store_over_untracked: AGC graphics: a pending storage result was stored over bytes the CPU wrote to untracked memory
  • agc_driver_stencil_plane_memory: AGC graphics: a consumed stencil clear was lost on a read-only rebind

Both passed here on main e04bd77 (with #19899, same machine and command), so they broke somewhere in the 279 commits up to e4caa07. I did not bisect; the write-watch change #19071 (db6f26e) is in that range.

Single run each. AI-assisted (Claude Code).

VicRaster added a commit to VicRaster/AnyPS5 that referenced this pull request Nov 16, 2026
@domx4q

domx4q commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Validation-layer run of this PR on an NVIDIA GPU under Linux, since CI covers only lavapipe.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, -DBUILD_TESTING=ON; NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684), proprietary driver 620.70.06, Vulkan 1.4.357 (loader 1.4.363), Khronos validation layer 1.4.363.1. Head 62e9dbca46 merged onto main e4caa07950 (clean merge); main is the same commit built separately. Every test log reports Selected GPU name=NVIDIA GeForce RTX 4090.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
  ctest --test-dir build -R 'fmask|msaa_dcc|cold_texture_dcc|native_color_initial' -V
main e4caa07950 this PR
Result 20/20 pass (3 skipped) 23/23 pass (3 skipped)
Insert instance layer "VK_LAYER_KHRONOS_validation" 19 22
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- 0 0

The pattern is the one from the Tested section. agc_driver_cold_texture_dcc_2, _4 and _8 are added by this PR and do not exist on main, which explains 20 against 23 tests; all three pass here. agc_driver_msaa_dcc_compared_import_2, _4 and _8 skip on both builds ("the device reports host imports that keep write protection, so the write-watch probe compares none of them"), the same three skips the Tested section reports on the RTX 3080 Ti under Windows; everything else passes on both. The branch is based on cb54da2875, older than e4caa07950.

No new VUID- errors; the 3 new cold-colour tests and all other focused tests pass on Ada, with the same 3 compared-import skips as main.

AI-assisted: yes (Claude Code)

# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
#	core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_sample_multisample_target_tests.cmake
#	core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the inspected code and regression coverage support merging.

What I ran

Reviewed head d7bac96865dd849ecb6fb516544822d1cdedf306 using repo_read.py to inspect the prepared description, commits, manifest, diff, changed files and targeted repository context. No tests were run in this review; the Windows test results below are author-reported.

Read all four changed files listed as reviewed in manifest.json, along with targeted GuestMemory.cpp context. No files were excluded by the manifest.

Results

Check Result Note
Diff and changed files passed Four reviewed files
Targeted code context passed DCC materialization and write tracking
Tests in this review not run Author reports 20 passed, 3 skipped

Findings

Blocking

None.

Non-blocking

None.

Not verified

Did not run the tests or independently verify the author-reported Windows runs, GPU behavior, or other operating systems. Did not inspect unrelated repository files beyond targeted context.

To get this to a good state

Nothing is required.

@oneandonlydean
oneandonlydean merged commit 760b968 into boykopovar:main Nov 28, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants