RUNTIME 2438: Merge on the host only the lines beside a texture's texels
A shadow's merge in place into host pages, on a device whose stores write back the lines they end in (the Iris Xe under ANV) or whose check has not answered, went on the host whole: the host step compared and stored every byte of the merge's rows. On the Iris that cost 12.7 ms a merge for a 1920x1080 RGBA16Float draw (17.7 ms a command buffer against 3.7 ms by the GPU kernel), and the guest's scene has about 73 such shadows. The merge now splits as the splice of a copy back does: - Its kernel stores the changed words of each row's bytes in the lines that hold the texture's texels alone (ShadowMergeStores::Words, never whole blocks). - The host step merges only each row's bytes in the lines that also hold a byte of no row of the texture's: the bytes between the rows and around them (shadow_splice::beside_texels; at most a row's first and last line). - Before the kernel the GPU copies those pieces' kept bytes into a region of the command buffer's arena, then their changed bytes over them in the kept part, so the kernel finds them unchanged and stores none of them; the host step compares the region's bytes with the changed part's. - The host step compares 4-byte words and stores a changed word with one AtomicU32 store (the changed word where all four bytes differ, else the word as it holds it with those bytes changed, as the kernel's Words form does); bytes outside whole words go one by one. - A merge none of whose rows' lines holds such a byte (rows that start and end on lines, as the 1920x1080 plane's 15360-byte rows do) goes by its kernel alone, with its fetch view and kept image where it has them. A merge not cut to its texels' rows stays on the host whole. The measured contract is the padding: row_padding_writes found the M3 Max, the 5300M and the UHD 630 keeping CPU writes to the bytes between and around a texture's rows under clears, stores and draws, and over IOSurfaces under kernels. No probe measured a CPU write to a texel the commands left inside a line whose other bytes they changed, while the command buffer runs; the kernel now stores into such lines, so that write may be put back on the Iris. FAST-PATHS's known gaps record it, beside the measured contract. WorkCounts::shadow_merge_bytes_on_host counts the bytes the host steps compared. Buffer::own_pages_flags gives a buffer's memory type flags, which the cost test prints for a buffer made as the host scratch is, beside the host loop's time over plain heap memory and over that memory (1920x1080, half the texels' red and blue changed). Tests: - tests::shadow_splice (pure): the pieces equal the rows' bytes in lines beside the texels, found byte by byte, over 9 shapes and 6 page phases (wrapping among them); the host loop stores the differing bytes alone at every alignment. - tests::shadow_write_lines: each draw merge's host step compares 16 bytes a row (the row's last texels, in its padding's line); the cost test's 1920x1080 draw no longer merges on the host. - tests::shadow_runs: the rebind test of host merges puts its pages 16 bytes into a page, so every row's first and last lines hold bytes beside its texels, and asserts the bytes compared (a line a row). Degradation kinds added: none. Also (65db6f5b40): the old device-local query, left with no callers, is gone; the probe prints the scratch's memory flags by name. Verified (fplend): msi m3-max-35872 at a5289d8132 (same tree as 65db6f5b40): clippy 0, clippy --cfg m2v_gpu 0, api_signatures + api_surface 15/15, debug and release archives built; 35850: tests::shadow_splice 5/5 (host pieces against a byte-by-byte answer over 9 shapes x 6 page offsets; the CPU word loop at every alignment). PHOENIX, lavapipe, rustdoc and the Iris run follow.
This commit is contained in:
1 parent
86fd05fb88
commit
438fdd4eee
14 files changed
+825
-195
No files matched your search
+8
-4
@@ -2511,10 +2511,14 @@ bound.
|
||||
device whose check of those pages finds its copies or shader writes writing such a line back
|
||||
whole, or has not answered, is spliced: the GPU copies the texels that fill whole lines, and a
|
||||
host step after the copies writes the rest, so a CPU write beside them stays
|
||||
(`WorkCounts::shadow_copies_back_spliced`); and a merge in place there goes on the host: its
|
||||
keep and the copy of the texels the commands left go into a `Shared` scratch, and a host step
|
||||
after them stores each byte that differs (`WorkCounts::shadow_merges_on_host`; docs/FAST-PATHS.md,
|
||||
**Known gaps**, the Iris Xe's line write-back). Where the device is measured to run it
|
||||
(`WorkCounts::shadow_copies_back_spliced`); and a merge in place there splits the same way: its
|
||||
keep and the copy of the texels the commands left go into a `Shared` scratch, its kernel stores
|
||||
the changed words in the lines that hold the texture's texels alone, and a host step after them
|
||||
stores each byte that differs of each row's bytes in the lines that also hold bytes beside them
|
||||
(`WorkCounts::shadow_merges_on_host`, `shadow_merge_bytes_on_host`; a merge none of whose rows'
|
||||
lines holds such a byte goes by its kernel alone; docs/FAST-PATHS.md, **Known gaps**, the Iris
|
||||
Xe's line write-back, which may still put back a CPU write to a texel the commands left in a
|
||||
line whose other bytes they changed). Where the device is measured to run it
|
||||
faster so (`DriverFact::ShadowCopyBackDispatchFaster`), a copy back of a one-slice texture of 4-,
|
||||
8- or 16-byte texels is a compute dispatch that stores the same bytes
|
||||
(`WorkCounts::shadow_copies_back_dispatched`), and so is a merge's copy of such a texture's image
|
||||
|
||||
Reference in new issue
Block a user