Repository navigation
feat(agc): expand a CMASK fast clear that matches the DCC clear of its target - #13147
Prophet069 wants to merge 1 commit into
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
|
@Prophet069 thanks for these. One problem common to all five PRs (#13145, #13146, #13147, #13148, #13149): each commit sits on main For this PR, |
…s target A DCC color target whose CMASK marks tiles fast-cleared is expanded without storing texels when its DCC keys are one clear of the same texel as CB_COLOR_CLEAR_WORD, since both readings give that texel. Any other CMASK fast clear of a DCC target still throws, now naming the target, its tiles, its DCC keys and the clear words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5440a1e to
a29ca03
Compare
|
Thanks, you were right: I squashed onto a moving |
|
@Prophet069 a heads-up: this branch sets the files #12916 changed back to their contents before #12916 merged ( AI-assisted: yes (Claude Code) |
|
@Prophet069 thanks. The matching-clear case is a sensible narrow acceptance, and the detailed refusal message will help. One part needs a word in the description and a test:
|
✅ NVIDIA GPU test: passedPR head
Failing on main too (3, not counted against this PR)Validation IDs already present on main (3 IDs in 387 tests)Skipped (48)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Windows GPU run of head Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT with AMD proprietary driver 26.10.1 (Vulkan 1.4.315), WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
AI-assisted: yes (Claude Code). |
|
Death Stranding 2 (PPSA02015) needs this too. Same machine and stack as on #13146, plus #13146 and this PR
AI-assisted; the runs are from my machine(s). |
|
Independent Linux / AMD RDNA 4 (RADV) validation of head Default-path focused checks: Separate identical-source negative control: a narrowed fixture runs just a single-sample RGBA8 render target with all-zero DCC keys, zero CB clear words and a fully fast-cleared CMASK. It calls the real
The isolated fixture SHA-256 was identical on both implementations: Both paired lanes use Host: CachyOS Linux Scope: the default focused tests and the isolated import-disabled control are distinct lanes. This does not claim the whole suite passes with host imports disabled, nor a console measurement, a title run, or a performance change. All temporary test changes were removed; clean pinned main was rebuilt and its original three focused tests passed again. Commands and isolated-case constructioncmake --build build-main --target agc_driver_cmask_fast_clear_tests \
agc_driver_graphics_tests agc_driver_sample_multisample_target_tests --parallel 4
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build-main \
-R '^(agc_driver_cmask_fast_clear|agc_driver_graphics|agc_driver_sample_multisample_target)$' \
-V --parallel 1 --repeat until-fail:3 --timeout 120The local void matchingDccClear(AgcDriver::VulkanDevice& device) {
auto color = target(ColorTileMode::RenderTarget);
color.dccAddress = reinterpret_cast<std::uintptr_t>(Keys.data());
color.clearWords = {0, 0};
Keys.fill(0x00u);
prepare(color, [](std::uint32_t, std::uint32_t) { return true; });
eliminate(device, color);
expect(device, color, [](std::uint32_t, std::uint32_t) { return 0u; }, "matching DCC and CMASK zero clears");
}Build the CMASK target against each implementation with that identical fixture, add AI-assisted independent hardware test run (Codex). |
XairRrR
left a comment
There was a problem hiding this comment.
Reviewed — approved
The PR accepts a CMASK fast clear of a DCC target only when the DCC keys are one clear of the same texel as CB_COLOR_CLEAR_WORD, and it throws a detailed message in every other case. The build is clean, the focused tests pass, the new test fails with main's Draw.cpp, and the validation comparison shows no new VUIDs.
What I ran
Head a29ca0375bd4d50d1cfab0a03e2229d17cc07814, main 9090972b7e91fd266819cbd77a8b058e177b5682, merged tree 69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f (Debian 13 VM, GCC 14.2.0, lavapipe Mesa 26.1.6).
git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...a29ca0375bd4d50d1cfab0a03e2229d17cc07814
python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^(agc_driver_cmask_fast_clear|agc_recorder_cmask)$"
# negative control
git show 9090972b7e91fd266819cbd77a8b058e177b5682:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$"
git show 69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests libs
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$"
git status --porcelain
Results
| Check | Result |
|---|---|
git diff --check |
clean |
check_conventions.py |
0 errors; 1 debt-length warning on the CMASK fast clears entry (1962 characters). The entry was already over the limit on main, as the description says. |
Configure, build, libs (script) |
passed |
| Selected tests (script, 2031 run) | 0 new failures, 0 timeouts. The 7 known failures (agc_driver_division, the denormal tests, unwrap_self, vector_constant_factor_tininess) also fail on main. |
| Validation layer (script, 757 tests, layer loaded in 756, missing in none) | 0 tests with new VUID- |
agc_driver_cmask_fast_clear, agc_recorder_cmask |
passed (0.16 s, 0.12 s) |
| Negative control | failed as expected |
| Worktree after restore | git status --porcelain empty |
Negative control
I restored core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp from main and rebuilt. agc_driver_cmask_fast_clear then failed on the first new case:
output with main's Draw.cpp
[gpu] storage image 0x55da74470000 destroyed with GPU results pending
a DCC target with a fast-cleared CMASK tile: was not refused
0% tests passed, 1 tests failed out of 1
After I restored the merged file and rebuilt, the test passed again.
This failure also answers the first point in oneandonlydean's comment (that excluding DCC targets from the GPU path could make titles stop that get through today). On main, the test's eliminate took the resident/recorder GPU path for the DCC target, and nothing was thrown in that call. That path never accepted a cleared tile of a DCC target, though. It called DispatchCmaskClear with write = color.dccAddress == 0 (Draw.cpp:590). With write false, CmaskClear.comp:33-37 sets errors.codes |= 1 for each cleared tile, and the next materializeCmaskClear throws through requireCmaskCodes (Draw.cpp:510). The message is "a CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys, was recorded", which is the stop mrfelek reported for PPSA02015 on main.
So on main, the GPU branch only delayed the throw. Moving DCC targets to the CPU path (Draw.cpp:607) loses no case that worked before. The one difference is cost: a DCC target whose CMASK is already expanded now goes through readCmask, which may wait for a pending write to the CMASK. That happens once per target, because cmaskProved skips later calls.
Findings
Blocking
None.
Non-blocking
- Dead GPU error path.
DispatchCmaskClearis now always called withwrite == true, because its only caller needscolor.dccAddress == 0(Draw.cpp:590,Draw.cpp:607). As a result, theerrorsbranch ofCmaskClear.comp:37,TextureDetiler::CmaskErrorsandrequireCmaskCodes(Draw.cpp:510, with its DCC message) can no longer be reached. Suggestion: remove thewriteparameter, the error buffer andrequireCmaskCodesin a follow-up. Otherwise a reader may think a DCC target can still take the GPU path. - The DCC key range covers only one key per 256 bytes (
Draw.cpp:623), the second point in oneandonlydean's comment. I confirm thatCurrentDccKeys(addr, bytes)readsDccKeyBytes(bytes), whilecolorKeyCountreturns the larger console extent for pipe-aligned 4-byte R64KBX targets. However, the same metadata pass then picks the target's texels from the same short read (Draw.cpp:3976, alsomaterializeRegisterClearatDraw.cpp:457). The new acceptance therefore agrees with what the pass already does, and the gap is not new. ReadingCurrentDccKeys(color.dccAddress, color.bytes, colorKeyCount(color, color.bytes))here would still be cheap and stricter, and it would be needed before the rest of the pass is extended to the full extent. - The debt entry now partly contradicts itself.
docs/dev/debt/libSceAgcDriver.md:239still says "a cleared tile of a DCC target … throw", while the new sentence at the end of the same entry says a matching one is expanded. Suggestion: cut the earlier clause to "a cleared tile of a DCC target whose keys are not a matching clear". The CONTRIBUTING rules also ask entries to be cut rather than grown, and this entry is already flagged at 1962 characters. - The description does not mention the GPU-path exclusion. oneandonlydean asked for it to be explained. The evidence above can serve as that explanation: the GPU path for DCC targets only recorded an error that threw later.
Not verified
- Console behaviour (whether the CB reads CMASK under DCC). The debt entry already records this as unknown.
- Pipe-aligned targets with keys that match over the short range but differ beyond it. This PR adds no such case, and I did not write one (see non-blocking 2).
- The PPSA02015 run and runs on non-lavapipe GPUs. I am relying on the author, TechLevelZero (NVIDIA), JJenkx (RX 6700 XT) and RNK123 (RADV) for those.
- No title was launched.
|
Windows and NVIDIA Blackwell run, for head
Both failures fail on Not run: the Khronos validation layer is not installed on this machine, so this says nothing about VUIDs. No title was run. AI-assisted: yes. Claude Code ran the builds and tests and drafted this comment; the numbers are from the runs on this machine. |
|
Windows/RX 7800 XT paired CMASK/DCC check (AI-assisted test/report). I built agc_driver_cmask_fast_clear_tests from PR head a29ca03 merged cleanly onto pinned upstream main a992b80 (local merge b66eaf3ef3cc127c955a3920d66ec496f8301308). The focused agc_driver_cmask_fast_clear CTest passed 3/3 separate runs on the actual AMD Radeon RX 7800 XT (1002:747e, subgroup 64); no run skipped. Each log ended with 'CMASK fast clear draw and eliminate tests passed'. For a paired negative control, I applied only this PR's 26-line CmaskFastClear.cpp test additions to the pinned main source in test-only commit 7093a7033b, preserving all main production code. The same target built, selected the same RX 7800 XT, and the focused CTest failed at 'a DCC target with a fast-cleared CMASK tile: was not refused'. The matching PR run passed. This directly checks the added refusal case against the production change, rather than inferring its effect from a passing PR-side test alone. The DCC part of the fixture first requires refusal of a one-of-16 CMASK fast-clear tile while DCC keys are uncompressed, including a diagnostic naming the tile count. It requires refusal when a fully cleared CMASK encodes 0x11223344 but DCC keys encode zero. When the clear words are changed to zero, elimination must leave all visible texels zero; a partially fast-cleared CMASK under matching DCC register-clear keys must also eliminate and yield the expected clear color. The fixture reads every visible 61×13 texel and requires its CMASK buffer to be expanded afterward. The Khronos validation layer reported VUID-VkDeviceCreateInfo-pNext-pNext at device creation in all three PR runs and in the main control; the logs say its installed Vulkan header version 284 does not recognize two pNext structure types. I therefore do not call these validation-clean runs or attribute that VUID to this PR. This adds a current-head, pinned-main RX 7800 XT Windows comparison alongside the already reported RX 6700 XT Windows and other GPU evidence. It is a synthetic CMASK/DCC fixture, not a console measurement, a game outcome, or a performance result. |
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
Plyxen
left a comment
There was a problem hiding this comment.
I read the diff at a29ca0375b. Windows 11, GCC 15.2, merged into main at cf556db18c3 together with other open PRs (so not an isolated build), with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and VK_LAYER_KHRONOS_validation on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).
agc_driver_cmask_fast_clear: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.- Control (same tree and tests, the changed files of those PRs put back to
main's): fails on both GPUs: "a DCC target with a fast-cleared CMASK tile: was not refused".
Not checked: a title.
AI-assisted: yes (Claude Code)
ligmaSec
left a comment
There was a problem hiding this comment.
The DCC clear comparison preserves the existing refusal for a different clear color. The fixture checks that refusal and also covers both a whole CMASK clear and a partial clear when the colors match. Could the refusal check also snapshot and compare both metadata regions across the failed eliminate? That would catch moving the CMASK write ahead of the DCC equality check. The trial merge is clean. Please put the debt update in a fragment in docs/dev/debt/changes/. I have no paired Vulkan result for this head yet.
AI-assisted: yes.
What
A CMASK fast clear of a color target that also has DCC keys threw
CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys. When the target's current DCC keys are one clear whose texel equals the texelCB_COLOR_CLEAR_WORDencodes, both readings give the same texels, so the CMASK is now stored as expanded (0xF) without writing texels. Every other CMASK fast clear of a DCC target still throws, and the message now names the target address, size, element bytes, tile mode, samples, the number of cleared tiles, the DCC keys and the clear words. Whether the console's CB reads CMASK under DCC remains unknown (Mesa uses single-sample CMASK only without DCC on GFX10); the debt entry says so.Tested
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(VVL vulkan-sdk-1.4.321.0; neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS),ctest --test-dir build -R <the 63 tests of agc_shader_memory_tests, agc_driver_cmask_fast_clear_tests, agc_driver_graphics_tests and agc_driver_sample_multisample_target_tests> -Von main8c8b998620and on this branch, same machine and GPU: main 63/63 passed, 0VUID-; this branch 63/63 passed, 0VUID-.CmaskFastClear.cppcovers the matching DCC clear (expanded, texels unchanged) and a mismatching one (throws with the details).0xc2de370000, 1920x1080, 4-byte elements, tile mode 27, 4 samples, 32400 of 32400 tiles cleared, DCC keys 0x00, clear words 0. With the change it reached 14800 dispatches (previously at most 1800) with no CMASK stop and 0VUID-, until an unrelated device loss after 1051 s.tools/check_conventions.pyreports onedebt-lengthwarning on the CMASK fast clear entry, which was already over 1000 characters on main.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)🤖 Generated with Claude Code