translator: the direct form adds the sign-extended offset in 64-bit integers, with no pointer bitcast

A bounded slot's access was a byte array's element at its 32-bit offset, the
element pointer bitcast to a pointer to the unit's one-member Block. The
UHD 630's Windows driver (Vulkan 1.3.215) ends the process in that shape
(exit 139, every kind), and passes the integer address with OpConvertUToPtr
to the same Block. Each access is now the slot's address plus its offset
sign-extended (OpSConvert), then one OpConvertUToPtr: the integer form of the
access chain's signed index, which RADV lowers alike (iadd of an i2i64), with
no zero-extended offset for GFX11 to split into a scalar base and a vector
offset. The window is at most 2 GiB (direct_window, tested at 2^31 and one
byte past), so the sign extension is exact.

The byte array and its element place (device_byte_place, device_element)
have no other user and are deleted, and the identity domains no longer need
storageBuffer8BitAccess.
This commit is contained in:
Anees Iqbal committed 2026-11-17 15:30:39 -08:00
1 parent 8ce4fb2b52
commit 0f854aef98
8 files changed
+68 -137

No files matched your search

+9 -9
View File
@@ -109,18 +109,18 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
`HandleDomain::Table`, the default). The identity domains (`PointerDomain::Identity` with
`HandleDomain::Identity`, taken together) are the new runtime's form: pointers are device
addresses used directly and a texture's or sampler's handle is its `gpuResourceID`
([RESOURCE-ID.md](RESOURCE-ID.md)). They need `bufferDeviceAddress`, `shaderInt64` and
`storageBuffer8BitAccess`. Under 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`) is reached from that
address as it is: each access is a 32-bit byte offset through a byte array there, whose element
pointer is bitcast to the accessed unit's, and an access of 8 or 16 bytes at an offset proven a
([RESOURCE-ID.md](RESOURCE-ID.md)). They need `bufferDeviceAddress` and `shaderInt64`. Under
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
`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) is reached from the word below each
access. Fields past a kernel's push window (128 bytes; 256 on
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
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