translator: every slot held to 4 is reached from its address as it is

Under the identity domains a device-address slot whose argument's alignment is at least 4 now
takes the direct form whatever its window: each access is the slot's address plus its 32-bit
byte offset from the bind address, sign-extended. The runtime makes no buffer longer than 2 GiB
(MAX_BUFFER_LENGTH), so every byte of a buffer lies within 2^31 bytes of each bind address in it
and the sign extension is exact. The window no longer picks the form, and the offset is taken
from the bind address rather than the window's start, so the start's 64-bit add and 32-bit
subtract go and the start need not be a multiple of 16 (the alignment proofs are from the bind
address). DIRECT_WINDOW and direct_window are deleted, and so is the test of accesses past
2 GiB, which the 2 GiB cap puts outside every buffer; the interpreter test of accesses up to
2 GiB stays. Slots held to less than 4 keep the word form.

The word-phase alignment test now expects one uvec4 in every slot held to 16, its Whole window
included. SEMANTICS_VERSION 2166: identity-domain modules change.
This commit is contained in:
Anees Iqbal committed 2026-11-17 16:50:10 -08:00
1 parent 817639a841
commit 4232d4ed9b
7 files changed
+41 -252

No files matched your search

+6 -6
View File
@@ -113,14 +113,14 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
them a buffer slot is reached at its own device address (`gpuAddress` plus the bind offset),
pushed as `PushField::SlotGuestBase`, with no root table, no descriptor and no containment, as
Metal contains no device-address access. A slot whose argument states an alignment of at least
4 (`air.arg_type_align_size`) and whose window the translator bounds to at most 2 GiB is reached
from that address as it is: each access is at the address plus its 32-bit byte offset,
sign-extended (exact below 2 GiB), and an access of 8 or 16 bytes at an offset proven a
multiple of its size is one `uvec2` or `uvec4`. The function states
4 (`air.arg_type_align_size`) is reached from that address as it is: each access is at the
address plus its 32-bit byte offset, sign-extended, which is exact as the new runtime makes no
buffer longer than 2 GiB (`MAX_BUFFER_LENGTH`), and an access of 8 or 16 bytes at an offset
proven a multiple of its size is one `uvec2` or `uvec4`. The function states
`RuntimeFact::AddressAlignment` with that alignment (at most 16), and a binder refuses a binding
whose address is not a multiple of it, as Metal's API validation refuses the bind offset. Any
other slot (an argument with no alignment or one below 4, or a window no access bounds) is
reached from the word below each access, its offset zero-extended (exact to 4 GiB). Fields past a kernel's push window (128 bytes; 256 on
other slot (an argument with no alignment or one below 4) is reached from the word below each
access, its offset zero-extended. Fields past a kernel's push window (128 bytes; 256 on
a device made by `Device::from_queries`, whose runtime's floor requires that much
`maxPushConstantsSize`: a dispatch region and 28 buffer addresses) go to a parameter block in
memory, read at the device address `PushField::ArgumentTableAddress`, which