Skip to content

Add MSL support for mixed-precision cooperative matrix multiply-add#9629

Open
seddonm1 wants to merge 4 commits into
gfx-rs:trunkfrom
seddonm1:simdgroup_multiply_accumulate
Open

Add MSL support for mixed-precision cooperative matrix multiply-add#9629
seddonm1 wants to merge 4 commits into
gfx-rs:trunkfrom
seddonm1:simdgroup_multiply_accumulate

Conversation

@seddonm1

@seddonm1 seddonm1 commented Jun 2, 2026

Copy link
Copy Markdown

Description
Adds MSL support for simdgroup_multiply_accumulate wrappers where cooperative matrix A/B operands use a different scalar type from the C accumulator/result.

coopMultiplyAdd(a, b, c) resolves to the type of c, but the MSL wrapper previously used one scalar type for A, B, C, the temporary accumulator, and the return value. The wrapper now tracks the A/B scalar separately from the C/result scalar and emits a signature that matches mixed accumulator use cases.

Testing
Added a new cooperative-matrix-mixed-accumulator snapshot instead of extending the existing cooperative-matrix snapshot so the mixed-scalar accumulator case is isolated.

The new input uses f16 A/B cooperative matrices and an f32 C accumulator, with targets for SPIRV | METAL | WGSL. This produces snapshots for all supported cooperative matrix backends:

  • naga/tests/out/msl/wgsl-cooperative-matrix-mixed-accumulator.metal
  • naga/tests/out/spv/wgsl-cooperative-matrix-mixed-accumulator.spvasm
  • naga/tests/out/wgsl/wgsl-cooperative-matrix-mixed-accumulator.wgsl

Checklist

  • I self-reviewed and fully understand this PR.
  • WebGPU implementations built with wgpu may be affected behaviorally.
  • Validation and feature gates are in place to confine behavioral changes.
  • Tests demonstrate the validation and altered logic works.
  • CHANGELOG.md entries for the user-facing effects of this change are present.
  • The PR is minimal, and doesn't make sense to land as multiple PRs.
  • Commits are logically scoped and individually reviewable.
  • The PR description has enough context to understand the motivation and solution implemented.

@cwfitzgerald cwfitzgerald self-assigned this Jun 3, 2026

@inner-daemons inner-daemons left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would nominate this for an award if I could. Very simple, self explanatory, with testing to back it up, and a good changelog entry. LGTM!

@inner-daemons inner-daemons self-assigned this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants