Files
metal2vulkan/scripts
Anees Iqbal d03a45f6ed regen-air-fixtures: air-by-value-buffer, and the read-through-constant kernel fixture
A Core Image kernel of macOS 13.7's frameworks declares its parameter block, read through a
constant pointer, as a read-only device buffer of one char (521f778bf6, abi::check's
read_through_constant). MSL cannot spell that node, so no authored case could be Metal-qualified
over it. The directive `// air-by-value-buffer: <arg>` rewrites the one air.buffer node naming the
argument, a read-only constant buffer, to that node (air.read, air.address_space 1, one char) in
the typed text; the module is metal-as of the rewritten text, as for air-rename. It fails when no
node or several name the argument, or the node is not a read-only constant buffer's.

engine/kernel_read_through_constant is the kernel of 521f778bf6's tests in MSL (out[i] = p->rect +
p->m[i & 3] * p->a + float4(p->n[i % 3], p->e) over a 160-byte Params), compiled with the
directive (Metal 32023.922, SDK 27.2): its .ll and .air.ll carry the by-value node and keep the
constant pointer.

Verified: the script's unit tests (22, two new: the rewrite reaching both companions and --check,
and the four refusals) pass locally with fake tools; the fixture regenerated with the host's Metal
toolchain and LLVM 21 (llvm-as accepts the .ll).
2026-11-11 15:00:04 -08:00
..