Make device copies on a discrete GPU of Managed textures over host pages alone
On a discrete GPU, a texture over host pages that only samples or reads, over memory that carries a log of its writes, was a device copy (a shadow in VRAM whose copies in take the rows the log reports) whatever its storage mode: a speed choice, so the GPU read the surface from its own memory instead of across the bus. The owner's ruling of 11-07 (confirmed for discrete): Shared and IOSurface memory over guest pages is used in place over the import, never shadowed to VRAM for speed; Managed keeps Metal's two copies on a discrete Mac. So `Texels::device_copy` now also asks for `Managed` storage and a buffer's bytes (not an IOSurface plane's, whose memory is one copy whatever the descriptor's storage mode): a Shared texture and an IOSurface's are in place over the import where the device's check passed, as on every other device. Tests: the runtime's `a_logged_device_copy_sampled_in_an_inline_pass_is_copied_in_before_the_pass` and the device_copies lane make their buffers Managed (`over_logged_as`, `over_as`); the new lane test `a_shared_surface_over_logged_pages_is_no_device_copy` asserts a Shared surface over logged pages is no device copy on any device, in place exactly where the check passed for pointer pages, and that its reads hold the pages' texels before and after a logged CPU write. Docs: API.md, the runtime README, FAST-PATHS.md's in-place row, the WorkCounts field and the lanes' module docs. (cherry picked from commit fd9fc11dd372a0985fdbc921adb2bc971ff78a3d)
This commit is contained in:
1 parent
66ce9f558f
commit
24ceac6e88
9 files changed
+201
-65
No files matched your search
+9
-6
@@ -359,12 +359,15 @@ before a use and back (merged back: only the bytes the commands changed) after a
|
||||
is bound to the pages, and `Texture::vk_image` gives `None` for it. A texture in place renders and
|
||||
is written beyond its declared usage, as plain Metal allows, through its usage shadow and an
|
||||
attachment stand-in, whose copies touch its texels alone.
|
||||
On a discrete GPU, a texture that only samples or reads whose policy takes the image in place, over
|
||||
a no-copy buffer whose memory carries a log of its writes (`HostMemory::with_dirty_pages`),
|
||||
tracked, one slice laid out as one copy, is instead a device copy (`WorkCounts::device_copy_textures`,
|
||||
whatever the check answered): a shadow whose copies in take only the bands of rows the log reports changed
|
||||
(`dirty_copies_in_gated` and kin). Its notice is not announced: it holds the bytes wherever a
|
||||
command reads it.
|
||||
On a discrete GPU, a `Managed` texture over a no-copy buffer's bytes (not an IOSurface plane's)
|
||||
that only samples or reads, whose policy takes the image in place, over memory that carries a log
|
||||
of its writes (`HostMemory::with_dirty_pages`), tracked, one slice laid out as one copy, is instead
|
||||
a device copy (`WorkCounts::device_copy_textures`, whatever the check answered): the GPU's copy of
|
||||
the two a `Managed` resource is on a Mac with a discrete GPU, a shadow whose copies in take only
|
||||
the bands of rows the log reports changed (`dirty_copies_in_gated` and kin). Its notice is not
|
||||
announced: it holds the bytes wherever a command reads it. A `Shared` texture and an IOSurface's
|
||||
are the pages' alone there too, in place where the check passed, which the GPU reads across the
|
||||
bus as a discrete Mac's GPU reads them.
|
||||
A texture placed in a heap over dma-buf pages is an image over a dma-buf of its own pages, which its
|
||||
first submission acquires from `VK_QUEUE_FAMILY_FOREIGN_EXT`; a linear image over a buffer of the
|
||||
runtime's own memory starts `VK_IMAGE_LAYOUT_PREINITIALIZED`, and its move from there keeps its
|
||||
|
||||
Reference in new issue
Block a user