test(agc): skip the MSAA storage-promotion remap on sample-order devices #9455
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9455"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-21T22:34:12Z.
What
agc_driver_multisample_retirementfails deterministically on some devices withMSAA storage promotion did not retain its source image(MultisampleRetirement.cpp, inStorageRemap). This happens on a device with programmable sample locations but only a 1x1 location grid (for example lavapipe):MayReorderSamplesis true there, so the driver creates the multisampled color target with storage usage from the start to write the guest's sample order back.MultisampleTargetStorageViewthen returns that already-storable image andmakeStorableis a no-op, so storage access does not allocate a new image and the owner's generation does not change.StorageRemapasserted the opposite (promoted.generation != old.generation), which only holds when the target is not born storable.The fix skips
StorageRemapon exactly those devices, mirroringOrderRemap, which uses the sameMayReorderSamples && SampleOrderStorageFormat != VK_FORMAT_UNDEFINEDcondition and already runs only there. No coverage is lost: the born-storable target's retirement lifetime is covered byOrderRemapon those devices, andStorageRemapstill exercises the promotion path (a storable image allocated on first storage access, retiring the color-only owner) on every device whose MSAA targets are not born storable — for example NVIDIA, whose 4x sample-location grid is 2x2, soMayReorderSamplesis false and the target is created color-only.StorageTwin(added tomainin4375cf06a,fix(agc): resolve and render a multisampled target through its sRGB twin format) makes the same assumption: it requires the storage view to be a new image (MSAA storage promotion kept the rendered image). On the same born-storable devices it now fails there onceStorageRemapis skipped. The second commit makes that check expect the same image when the target is born storable (same condition), and a new image everywhere else; the twin-view checks of that case still run on every device.Tested
This branch rebased onto
maina8bc4474c(2026-10-27); themainand first-commit-only arms were run onmain4297464b1, which has the sameMultisampleRetirement.cppandMultisampleTarget.cpp. Ubuntu 26.04, GCC 15.2, Release, same command and the three variables, layer 1.4.341, RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), 3 runs each:agc_driver_multisample_retirementmain(4297464b1)MSAA storage promotion did not retain its source image(StorageRemap)eb6f3f94e)MSAA storage promotion kept the rendered image(StorageTwin)StorageRemapskipped,StorageTwinruns0
VUID-in every run, no missing-layer message. Both devices runStorageTwin(both haveshaderStorageImageMultisample).The runs below are from before
StorageTwinexisted:Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Run asctest --test-dir build -R ^agc_driver_multisample_retirement -V -j1 --timeout 30withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(layer 1.4.341, Ubuntuvulkan-validationlayers1.4.341.0-1), onorigin/maind6eafa54dand with this change applied on the same checkout. Two devices on the same host, selected withVK_ICD_FILENAMES: NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8).agc_driver_multisample_retirementmainVUID-MSAA storage promotion did not retain its source image), 0VUID-VUID-StorageRemapskipped: "...born storable with no promotion to retire..."), 0VUID-No log reports
was not found but was requested by env var VK_INSTANCE_LAYERS;VK_LOADER_DEBUG=layerconfirms the validation layer is inserted at instance and device level on both devices. NoVUID-message onmainor with this change, so no newVUID-. Full logs are in the review thread.The earlier runs on
a6dcea927withANYPS5_NO_SHADER_CACHE=1gave the same pass/fail table (RTX 3070 2/2 pass both ways; lavapipe 3/3 fail onmain, 3/3 pass with this change).The driver log confirms the mechanism: NVIDIA reports a 2x2 largest sample-location grid at 4 samples (so
StorageRemapruns and the promotion allocates a new image), lavapipe reports 1x1 at 4 samples (so the target is born storable andStorageRemapis skipped).Apple M2 Max (macOS 27.2, x86-64 under Rosetta, on #8658
564e005acbbecausemaindoes not link on macOS), same command and the three variables, layer 1.4.363 from the LunarG SDK, MoltenVK 1.4.2 and MoltenVKmain+ SPIRV-Cross #2704: fails identically on the base and with this change (the device cannot write the multisampled color target's format as a storage image at its sample count), only the pre-existingVUID-VkDeviceCreateInfo-pProperties-04451(portability subset) on both, no newVUID-. MoltenVK has a 1x1 grid but noshaderStorageImageMultisample, so this change's condition is false andStorageRemapthrows; that is the case #8604 skips. Logs in the review thread.Not run: Windows, the full agc suite rebuild.
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
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T23:14:07Z.
Review: DISMISSED
The focused before/after reproduction is useful, but this test is under
libSceAgcDriver, and the repository rule requires the same focused test onmainand this change withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1, andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. Please attach both logs, confirm neither reports the requested layer missing, and compare for newVUID-messages. The current report mentions onlyANYPS5_NO_SHADER_CACHE=1, so I am holding approval until that required validation evidence is recorded. Hosted full Linux/Windows jobs were skipped; I did not run the Vulkan test locally.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T06:50:38Z.
Ran the required validation-layer comparison for
agc_driver_multisample_retirement.BUILD_TESTING=ONmain:d6eafa54d(currentmain). Change: PR headeb6f3f94ediff applied on the samed6eafa54dcheckout (the diff is test-only and applies cleanly; no rebase needed)VK_ICD_FILENAMES: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8)VK_LAYER_KHRONOS_validation1.4.341 (Ubuntuvulkan-validationlayers1.4.341.0-1, unpacked and added withVK_ADD_LAYER_PATH)mainVUID-MSAA storage promotion did not retain its source image), 0VUID-VUID-StorageRemapskipped), 0VUID-was not found but was requested by env var VK_INSTANCE_LAYERS.VK_LOADER_DEBUG=layershowsInsert instance layer "VK_LAYER_KHRONOS_validation"andInserted device layer "VK_LAYER_KHRONOS_validation". The codebase registers no debug messenger, so the layer reports to stdout with its default callback.VUID-messages: none onmain, none with this change, on either device, so no newVUID-. On lavapipemainstops at the failingStorageRemapcheck, so the subtests after it run only with this change, and they also log noVUID-.Log: main, RTX 3070
Log: this change, RTX 3070
Log: main, lavapipe
Log: this change, lavapipe
Layer insertion (
VK_LOADER_DEBUG=layer, same command)Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by GiannisG1 on 2026-10-22T11:42:23Z.
Ran
agc_driver_multisample_retirementwith this PR (eb6f3f94e) and #8604 (0089f4f63) merged together (clean), Linux Mint 22.3, GCC 13.3, Release, 3 runs each:shaderStorageImageMultisampleOrderRemapskips its own case)StorageRemaprunsStorageRemaprunsThe HD 630 is the case listed here as not run: a 1x1 grid without the feature, so the target is color-only and this PR's condition is false;
StorageRemapwould still reach the storage view and throw, and #8604 skips it. None of these devices has the born-storable target, so this PR's skip branch itself is not exercised here.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-22T11:58:00Z.
Linux, llvmpipe (LLVM 23.1.1, 256 bits) via lavapipe, Mesa 26.2.4,
GALLIUM_OVERRIDE_CPU_CAPS=avx, i9-11900K, CachyOS, GCC 16.2.1, Release,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,-j1;main7e2ba73e4witheb6f3f94eapplied (local merge, clean, the 4-line test change only). Driver log:4 samples 1x1, 8 samples 1x1; maxSampleLocationGridSize for every count 1x1.Head.
agc_driver_multisample_retirementpasses 6 of 6 (3 plain, 3 underVK_LAYER_KHRONOS_validation1.4.363 withInsert instance layerconfirmed per run), every run printing the new "born storable with no promotion to retire" line, 0VUID-.Negative control.
MultisampleRetirement.cppfrom7e2ba73e4, the only change in the build tree, rebuilt: fails 6 of 6, alwaysMSAA storage promotion did not retain its source image, 0VUID-. A second lavapipe build after @jotitadev's 26.0.3 with the same 1x1 grid and the same failure, so it is not specific to one lavapipe build.Why 25.2.8 and 26.x disagree. @GiannisG1's llvmpipe on Mesa 25.2.8 (https://github.com/boykopovar/AnyPS5/pull/9455#issuecomment-6339881787) logs no grid and passes with
StorageRemaprunning; @jotitadev's 26.0.3 and this 26.2.4 log 1x1 and fail on main's test file. By reading, the line between them is Mesa 25.3.0: its release notes list "lavapipe: implement VK_EXT_sample_locations",lvp_device.catmesa-25.3.0sets.EXT_sample_locations = trueand reportsmaxSampleLocationGridSize1x1 withsampleLocationSubPixelBits4, andmesa-25.2.8has no mention of the extension. The Linux job's self-hosted runner hasmesa-vulkan-drivers 25.2.8-0ubuntu0.24.04.4(dpkg-querystep of run 39746931544, the push build ofmain7e2ba73e4, where test 731 passes), which fits: on that Mesa the driver logs no grid, soStorageRemapruns and passes, as in @GiannisG1's row. A lavapipe at 25.3.0 or later on that runner should, by this reading, log the 1x1 grid and fail main'sStorageRemapthe way both 26.x builds do; not run. This also answers the "I have not isolated which" in https://github.com/boykopovar/AnyPS5/pull/8998#issuecomment-6339202410:main7e2ba73e4alone fails here 6 of 6, and the remaining difference to CI fits the Mesa line above.AI-assisted: yes (Claude Code); runs on this machine.