Files
metal2vulkan/docs
Anees Iqbal 027bb2e682 A compute state's static threadgroup length is the kernel's own, as Metal reports it
ComputePipelineMetalInfo::static_threadgroup_memory_length answered, on
a device that emulates simdgroups, the declared arena plus the scratch
of the most threads (32768 on lavapipe for compute-threadgroup-simd-
scratch, whose kernel declares 24 KiB), and elsewhere the kernel's
static part plus a predicated walk's vote word. Both additions are
ours: Metal's staticThreadgroupMemoryLength is the static part of the
kernel's own layout (KernelFacts::static_threadgroup_bytes), and the
getter now answers exactly that.

The planner keeps counting the scratch and the vote word in each
dispatch's total (bind::plan::compute: the arena from
RuntimeFact::SimdgroupEmulation, the vote beside it, the scratch rule
per region), so a dispatch whose threadgroup lengths fit beside the
reported length but not beside the scratch is refused
ThreadgroupMemorySize, the device's gap, where before the inflated
getter kept a well-behaved client from asking. The emulated tests
check both: region_k reports 0, a Metal client's remainder beside it is
refused at the most threads, and a region that fits beside the arena
and the scratch runs; barrier_k reports its own 31 KiB.

The compute-threadgroup-simd-scratch llvmpipe row goes. The runtime
getter's doc names the refusal. SEMANTICS_VERSION 1980 -> 1982 (1981 is
rows2's).

Verified: runs next (targeted translator tests, lavapipe replay).
(cherry picked from commit dd3d0a893bf900fbf11cb885f5fb9a7b7cfd9055)
2026-11-07 06:57:11 -08:00
..