Files
reims-vgpu/docs
Anees Iqbal f264ac73b8 🐛 Drop kernel and blit-copy texture writes into read-only memory
A kernel's write() of a texture over memory the process maps read-only
(Metal's private option bit 24, a no-copy buffer or heap the runtime makes
over a copy of the pages on Linux), and a blit's copy into such a texture,
ended the process where they were encoded (kept_write), as what Metal does
there was read as unmeasured. metal2vulkan measured both on the M3 Max,
macOS 27.0.1, plain Metal (probes/readonly_gpu_writes.m; the runtime's
read_only_view.rs): a texture over such memory takes a kernel's write() and
a blit's copy into it, out of a buffer or a texture, nowhere; each completes
with no error and leaves the pages as they were. The runtime's copy drops
those writes too: a texture over a copy lies in the copy's memory, or is a
shadow of its bytes, and each batch's completion writes back over every byte
the GPU changed in a copy that drops writes (copied.rs), so a later command
buffer reads the pages' bytes.

What changes for the guest: such a dispatch and such a blit copy complete
with no error, their writes dropped, where they used to end the process.

predication.rs's kept_write_through asks texture_twinned instead of
texture_kept for a texture a kernel writes, bound or made resident for
writing, so only a surface's read-only memory the runtime twins still dies
there. encode_blit.rs sends a copy into a texture over memory the runtime
copies (copy_dropped: CopyBufferToTexture, CopyTextureRegion,
CopyTextureSlices and their options forms).

What stays a death, as nothing measured it: a draw's write of such a
texture, another blit's write of one (a fill, mipmaps, an invalidation),
and a CPU write of one.

Tests: texture_writes_into_read_only_memory_are_dropped runs a kernel's
write, a copy out of a buffer and a copy out of a texture into a texture over
a bit-24 buffer and one in a bit-24 heap over pages: each completes with no
error, the pages stay zeros, and a later command buffer reads zeros.
a_blit_into_a_read_only_buffer_is_dropped's copy into a texture over the
buffer now completes where it died. gpu/writes.rs's docs and the accuracy
ledger's read-only row say the same.

No boot: no walk has reached this path (no app in our walks writes a texture
over read-only memory).
2026-11-14 06:10:59 -08:00
..