Repository navigation
perf(agc): fill-clear small-float denormal patterns on devices whose clears keep them - #2085
Conversation
|
Same as #2081: main against main plus this PR alone, please. The 85 ms is the cost on main, and the after run had other changes too. |
|
@oneandonlydean measured as an A/B with only this change between the two sides. Same setup as on #2081: PPSA01325 title screen, frames counted over 111-202 s of each run, three runs per side, A and B alternating. Current
About 46 ms per frame. The 85 ms in the description was the CPU path's cost measured on |
|
Conflicts with main in |
…clears keep them FillClearColor refused half and B10G11R11 patterns with a denormal code, since an implementation may flush them in a clear, so such fills over a resident image took the CPU path: PPSA01325 fast-clears its 3840x2160 R16G16_SFLOAT target 0x515390000 with a denormal half every frame, a 33 MiB guest write and re-upload (about 85 ms). ClearKeepsDenormals probes the device once per format: a 1x1 image cleared with denormal codes (half 0x0001, 0x83ff, 0x0200, 0x8001; 11/10-bit 0x001) and read back. When the bits survive, FillClear takes the refused pattern again with SmallFloat decoding denormals exactly. NaNs, float32 denormals and the SNORM minimum stay refused. agc_driver_recorder_tests clears an R16G16_SFLOAT resident image with a normal, a denormal and a NaN pattern: the denormal is cleared exactly when the probe says the device keeps it, and the NaN is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
|
Rebased onto current |
ee7db0f to
bafca2f
Compare
|
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.
|
What
FillClearColorrefuses half and B10G11R11 fill patterns that hold a denormal code, because an implementation may flush denormals in a clear. A fill like that over a resident image goes the CPU way instead: the pattern is written into guest memory and the image is uploaded again.Astro's Playroom (PPSA01325) fast-clears its 3840x2160
R16G16_SFLOATtarget0x515390000every frame with a denormal half. That is a 33 MiB guest write plus a re-upload every frame.This change:
ClearKeepsDenormals(context, format)(declared inTexture.hpp) probes the device once per format and caches the answer per device:0x0001,0x83ff,0x0200,0x8001, one per channel; 11/10-bit0x001);StorageTexture::FillCleartries a refused pattern again with denormals decoded exactly (SmallFloat,FillClearColor), but only when the probe says this device's clears keep them. The clear then stores the guest's bits.The probe runs in its own
CommandBatchwithSubmitAndWait, once per format per device, the same wayStorageTexturealready does its synchronous uploads.Tested
Windows 11, WinLibs GCC 15.2, RTX 3060 Laptop. The NVIDIA driver keeps denormal halves in clears; the test prints
denormal half clears are kept by this device.agc_driver_recorder_testshas a new case,denormalClearTests. It clears a 64x64R16G16_SFLOATresident image with three patterns:0x83ff0001: cleared exactly when the probe says the device keeps it, and checked bit for bit when cleared;It also checks that the probe is stable and that
R32G32B32A32_SFLOATprobes as not keeping.agc_driver_testspasses, andtools/check_conventions.py --base upstream/mainpasses.0x515390000runs as a GPU clear instead of the CPU write. Currentmaindoes not reach the title, so both sides ran on an integration branch; details and per-run numbers are in the comments.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code