Translator: under the identity domains a command buffer's field is plain data

An argument buffer's command_buffer member holds, under the identity domains, its word: the
gpuResourceID the program or the host wrote there, the device address of the records
(lower::access::icb). The byte rule of memory::provenance::objects treated it as an opaque
object, so any access other than the exact handle load that might reach its 8 bytes was
Unsupported{ArgumentBufferObjects}: an index past the structure by a signed run-time index, whose
offsets run back to 0, and, once such a buffer's address escaped, every run-time dereference.

Metal lays a Tier 2 argument buffer out as the equivalent C structure (macOS 13 and later), into
whose member the host writes gpuResourceID ("Handle of the GPU resource suitable for storing in an
Argument Buffer", MTLIndirectCommandBuffer.h), and whose contents the GPU and the CPU may both
modify. A plain access of those bytes reads or writes that word, which is all Metal defines of
them. So under the identity domains a command buffer's field is not opaque for either rule
(ObjectLayouts::of takes `words`, from the profile's pointer domain); a pipeline state's field
stays opaque, and under the resident-table domains, the validation executor's, nothing changes.

Tests: the objects rule's unit test (a command buffer's field is opaque only without its word),
and engine_identity_icb's an_access_past_an_encoder_is_a_plain_access_of_its_command_buffers_word
over the owned fixture icb_encoder_tail: both entries compile and validate under the identity
domains on lavapipe and moltenvk-m3, and the resident tables still refuse them.
This commit is contained in:
Anees Iqbal committed 2026-11-23 01:17:56 -08:00
1 parent 692c09abeb
commit 4c438ca2c6
7 files changed
+135 -27

No files matched your search

+5 -1
View File
@@ -267,7 +267,11 @@ and so do the command line, the compile worker and every validation tool. It hol
first lowers an argument buffer's sampler masks its index the same way.
A function writes an indirect command buffer's render commands, under the identity domains
alone, through the `gpuResourceID` an argument buffer's `command_buffer` member holds: the
device address of the buffer's records, laid out as `pipeline::IndirectDrawLayout` states. A
device address of the buffer's records, laid out as `pipeline::IndirectDrawLayout` states. Any
other access that may reach the member's 8 bytes, such as an index past the structure that
runs back into it, is a plain access of the argument buffer's memory there, reading or writing
that word, as Metal's Tier 2 argument buffer is laid out as the equivalent C structure; under
the resident-table domains it is `Unsupported{ArgumentBufferObjects}`. A
command's `set_vertex_buffer` and `set_fragment_buffer`, its `draw_indexed_primitives` of
triangles and its `reset` write them, each only where the command's index is below the
buffer's capacity; any other indirect-command operation is