Skip to content

Conversation

@manuelcandales
Copy link
Contributor

@manuelcandales manuelcandales commented Feb 2, 2026

This pull request introduces a new Metal-specific graph transformation pass for the Apple Metal backend, aimed at decomposing aten.linear operations into simpler operations to improve compatibility and avoid reliance on addmm. It also adds the new pass to the backend's custom passes, exposes it in the package, and introduces a corresponding test module.

Metal Backend Linear Decomposition Pass:

  • Added a new DecomposeLinearPass in decompose_linear_pass.py, which rewrites aten.linear nodes in the computation graph into a sequence of matmul and add operations. For 2D inputs, it temporarily unsqueezes to 3D to avoid triggering addmm, then squeezes back to 2D, ensuring compatibility with Metal's capabilities.
  • Registered the new DecomposeLinearPass in the Metal backend's get_custom_passes method, so it is applied during compilation.
  • Exposed DecomposeLinearPass in the passes module's __init__.py for easier imports and future extensibility.

Testing and Module Registry:

  • Added a new LinearWithBias module to the module registry in the test suite, providing a model that exercises the new pass and ensuring coverage for linear layers with bias.

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 2, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17115

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 11 Cancelled Jobs, 2 Pending, 1 Unrelated Failure

As of commit ed4dcee with merge base ba6de95 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 2, 2026
@manuelcandales manuelcandales requested review from larryliu0820 and mergennachin and removed request for cccclai and shoumikhin February 2, 2026 21:29
[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants