Skip to content

[Impeller] Compute dispatch takes 3D workgroup counts and honors the shader local_size #188478

Description

@bdero

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilitye: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter-gputeam-fluttergpuOwned by Flutter GPU team

    Type

    No type

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions