Part of #188474.
ComputePass::Compute(ISize) is 2D and means different things per backend. Vulkan forces every shader's local size to the device maximum with a specialization constant and treats the argument as a workgroup count, Metal treats it as a total invocation count and divides by maxTotalThreadsPerThreadgroup. Both ignore the shader's declared local_size, which makes shared memory and 3D dispatch impossible.
Changes
- Replace
Compute(ISize) with a 3D workgroup-count dispatch, for example Dispatch(ISize3 workgroup_count).
- Carry the reflected
local_size on the compute pipeline and pass it to Metal's dispatchThreadgroups as threadsPerThreadgroup. Remove the Metal halving heuristic.
- Capture
local_size in the reflection that feeds both the bundle and the generated .comp.h headers used by the HAL unit tests.
- Remove the Vulkan specialization-constant override and port the Vulkan path to the new signature so the tree compiles. Full Vulkan validation is tracked separately.
- Validate that
local_size.x*y*z is within the pipeline maximum at creation.
Testing
Update compute_unittests to dispatch known workgroup counts and assert exact output element counts on Metal.
Dependencies
Pairs with #188477 to thread local_size from the bundle.
Part of #188474.
ComputePass::Compute(ISize)is 2D and means different things per backend. Vulkan forces every shader's local size to the device maximum with a specialization constant and treats the argument as a workgroup count, Metal treats it as a total invocation count and divides bymaxTotalThreadsPerThreadgroup. Both ignore the shader's declaredlocal_size, which makes shared memory and 3D dispatch impossible.Changes
Compute(ISize)with a 3D workgroup-count dispatch, for exampleDispatch(ISize3 workgroup_count).local_sizeon the compute pipeline and pass it to Metal'sdispatchThreadgroupsasthreadsPerThreadgroup. Remove the Metal halving heuristic.local_sizein the reflection that feeds both the bundle and the generated.comp.hheaders used by the HAL unit tests.local_size.x*y*zis within the pipeline maximum at creation.Testing
Update
compute_unitteststo dispatch known workgroup counts and assert exact output element counts on Metal.Dependencies
Pairs with #188477 to thread
local_sizefrom the bundle.