Files
metal2vulkan/docs
Anees Iqbal ac5c562a08 Translator: a deep kernel's WorkgroupSize parts are plain specialization constants, written with every other key its threadgroup decides from one call
AMD's open driver AMDVLK (2025.Q2.1, its LLPC compiler) sizes a compute workgroup from the
WorkgroupSize composite's parts as declared, and reads an OpSpecConstantOp part as 1, while the
body sees the right value: every Spec-form kernel, whose deep-threadgroup form made each part an
OpSpecConstantOp Select over IMul products of LocalSize, ran one invocation per workgroup there.
The Vulkan spec allows such a part (VUID-WorkgroupSize-WorkgroupSize-04426: a specialization
constant or a constant), so this is the driver's bug; the form here is right on every device.

- Such a kernel's WorkgroupSize parts are the plain specialization constants
  SpecKey::WorkgroupSize(axis) (codec member appended).
- One public call, pipeline::threadgroup_constants(size), returns every key a kernel's
  threadgroup size decides: LocalSize on each axis, FlatLocalSize, DeepThreadgroup and the
  WorkgroupSize parts (the threadgroup, or one row of it deeper than DEEP_THREADGROUP). The
  runtime writes exactly those keys from it (Constant::Threadgroup, whose membership is the
  call's own key set), in place of four separate computations. docs/API.md section 3 names it.
- The builder refuses an OpSpecConstantOp WorkgroupSize part (ConstRule::WorkgroupSizeOp), so no
  form can declare one again; serialize test a_workgroup_size_part_is_never_a_spec_constant_op
  covers the old deep shape and two others, and the deep engine test asserts the parts are the
  new keys.
- rt test every_device_runs_every_thread_of_each_workgroup_deep_or_not: an owned kernel stores
  i + 1 at each linear thread index for a deep [1,1,96] threadgroup and two shallow ones.

Evidence so far: rt's probe with the composite's op parts folded to plain constants (job
m3-max-70461, the RX 7900 XTX; m3-max-70462, a Radeon 780M) cleared 66 of the 67 rt device
tests that failed on AMDVLK; the 67th, quad_control's helper test, fails the same with and
without, a fragment-stage defect of its own.
2026-11-23 01:45:17 -08:00
..