Repository navigation
perf(agc): leave read-trapped small storage images to their traps at the flip - #16898
Conversation
|
This pull request is labeled |
|
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.
|
gabichuuuuu
left a comment
There was a problem hiding this comment.
Ran 0e85cea381 merged on main 302864d on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 610) and an Intel iGPU (driver 101.70xx), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos validation layer 1.4.368), ctest -R <pattern> -V.
Windows only checks that nothing changes here: as the description says, readTrapped is only set on macOS, and the new check in smallTiledShadowLabelTests sits inside #ifdef __APPLE__.
| Tests | main |
change |
|---|---|---|
^(agc_driver_recorder|agc_driver_graphics)$, NVIDIA |
1/1 | 2/2 |
| same, Intel | 0/1 | 1/2 |
agc_small_tiled_shadow_label, NVIDIA |
1/1 | 2/2 |
| same, Intel | skipped | skipped 2/2 |
- The Intel failures are the same on both:
agc_driver_recorderstops atvkQueueSubmit recorder: Vulkan result -4(device lost), intermittently, onmaintoo. It isn't this change. - On Intel
agc_small_tiled_shadow_labelskips on both ("host imports are unavailable: the test block is not imported and watched"). On NVIDIA it runs and passes, without the new check, which is macOS only. - The layer was inserted in every test that opens a Vulkan device;
agc_driver_graphicsruns againstMockVulkanand opens none. No log haswas not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has aVUID-. To be sure validation messages reach these logs, the same layer with best practices on printed 28BestPractices-warnings into theagc_driver_recorderlog on each GPU.
No finding in the code: the condition only adds readTrapped to the existing skip, under the same pending.mutex, and it reads the flag with the acquire order used elsewhere in Texture.cpp.
AI-assisted: yes.
|
Summary lines and data for the perf label, as the Performance report form asks. These runs used Stray (PPSA02100) does not run on God of War Sons of Sparta (PPSA28997), |
What
At every flip,
StorageTexture::StoreSmallPending("flip")writes back each small pending storage image that has a host import, and each write-back waits for the GPU. On macOS a pending image can carry a read trap (StoreReadbackBeforeLabelsets them, #13499): its pages are inaccessible until a CPU read faults, and the fault stores the image right then. Storing such an image at the flip writes back results that the trap would store on the first read anyway, and costs a GPU wait at every flip for images the title may never read.StoreSmallPendingnow leaves images withreadTrappedset to their trap. Images without a trap are stored as before, andreadTrappedis only ever set on macOS, so Linux and Windows do not change.In Stray (PPSA02100) on macOS, about 94 of these flip write-backs ran per second; with this change about 16 per second are stored instead, by trap faults when the title actually reads those pages, so about 85 % of the flip write-backs were never read.
Tested
macOS 27.2, Apple M4 Pro (24 GiB), MoltenVK from Vulkan SDK 1.4.363.0, x86_64 Release under Rosetta 2.
mainis 8f7c957 with the macOS build fixes of #16591 (commit 0a0b87e2cb), the change on top of it (9c8e6a9b55).agc_small_tiled_shadow_labelgains a check that a flip leaves a read-trapped small image trapped and unstored, followed by the existing check that a read of it sees its pending results. Without theTexture.cppchange that check fails ("a flip stored a small image whose reads are trapped": the flip stored it and gave back its pages). With it the check passes. On this Mac the test then stops at a later, existing check on bothmainand the change ("a label stored a small image inside a pending large tiled one instead of trapping its reads"); that failure is the same without this change. Run withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: neither log haswas not found but was requested by env var VK_INSTANCE_LAYERSor aVUID-.mainwithout feat(agc): run mesh-path draws through a compute pass on devices without mesh shaders #9356 and feat(agc): test the depth bounds in the pixel program when the device lacks the depthBounds feature #11551, so it ran on a support tree (mainof 11-03 with feat(agc): test the depth bounds in the pixel program when the device lacks the depthBounds feature #11551, feat(agc): run mesh-path draws through a compute pass on devices without mesh shaders #9356, perf(agc): bind the changed copy-back's buffers through push descriptors #15792, fix(libc): give a read-trapped page back to a GPU mutex holder instead of waiting for the resolver #15729 and other open PRs), with the same check behind an environment variable, same scene, 150 s, MoltenVK built without its residency set (A queue-wide residency set makes every command buffer wire every allocation; above about 13.7 GiB wired, each submit evicts and rewires (3.4x slower) KhronosGroup/MoltenVK#2890):p99 ms ..@:_________ 0-1639.8/gpu ms -=-%@@@@%%%%% 0-76.8p99 ms ...@_______ 0-1643.1/gpu ms ==*+@###*+* 0-58.4p99 ms ...@_........ 0-2255.1/gpu ms =+#+@%#####*# 0-54.6main(one run each, same machine and scene):p99 ms @.._........... 0-978.5/gpu ms -=++*******#@@@ 0-18.3; changep99 ms @.............. 0-1563.3/gpu ms -===*******#@@@ 0-18.2.mainwith an unrelated change also stayed in, at 54.28 fps against 54.25, p50 18 ms and GPU 16 ms per present on both.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)