Skip to content

Add quantized_batch_matmul to OPERATORS list#18200

Merged
meta-codesync[bot] merged 1 commit intopytorch:mainfrom
Ninja91:export-D96686225
Mar 16, 2026
Merged

Add quantized_batch_matmul to OPERATORS list#18200
meta-codesync[bot] merged 1 commit intopytorch:mainfrom
Ninja91:export-D96686225

Conversation

@Ninja91
Copy link
Contributor

@Ninja91 Ninja91 commented Mar 16, 2026

Summary:
op_quantized_batch_matmul.cpp has a complete CMSIS-NN implementation of cortex_m::native::quantized_batch_matmul_out (using arm_batch_matmul_s8), but "quantized_batch_matmul" was missing from the OPERATORS list in targets.bzl.

Without it, define_operator_target("quantized_batch_matmul") was never called, so no :op_quantized_batch_matmul Buck target was created. cortex_m_operators exports all_op_targets using [":op_{}".format(op) for op in OPERATORS], so the operator was never included as a dependency.

executorch_generated_lib reads operators.yaml (which correctly declares cortex_m::quantized_batch_matmul.out) and generates RegisterCodegenUnboxedKernelsEverything.cpp, which calls cortex_m::native::quantized_batch_matmul_out. Since the compiled implementation was not linked in, ARM builds failed:
undefined reference to cortex_m::native::quantized_batch_matmul_out

Fix: add "quantized_batch_matmul" to OPERATORS in both targets.bzl mirrors (xplat and fbcode). This creates the missing :op_quantized_batch_matmul Buck target, includes it in cortex_m_operators, and allows cortex_m_generated_lib and cortex_m_no_except_generated_lib to link successfully.

Differential Revision: D96686225

Summary:
op_quantized_batch_matmul.cpp has a complete CMSIS-NN implementation of cortex_m::native::quantized_batch_matmul_out (using arm_batch_matmul_s8), but "quantized_batch_matmul" was missing from the OPERATORS list in targets.bzl.

Without it, define_operator_target("quantized_batch_matmul") was never called, so no :op_quantized_batch_matmul Buck target was created. cortex_m_operators exports all_op_targets using [":op_{}".format(op) for op in OPERATORS], so the operator was never included as a dependency.

executorch_generated_lib reads operators.yaml (which correctly declares cortex_m::quantized_batch_matmul.out) and generates RegisterCodegenUnboxedKernelsEverything.cpp, which calls cortex_m::native::quantized_batch_matmul_out. Since the compiled implementation was not linked in, ARM builds failed:
  undefined reference to cortex_m::native::quantized_batch_matmul_out

Fix: add "quantized_batch_matmul" to OPERATORS in both targets.bzl mirrors (xplat and fbcode). This creates the missing :op_quantized_batch_matmul Buck target, includes it in cortex_m_operators, and allows cortex_m_generated_lib and cortex_m_no_except_generated_lib to link successfully.

Differential Revision: D96686225
@Ninja91 Ninja91 requested a review from rascani as a code owner March 16, 2026 16:00
Copilot AI review requested due to automatic review settings March 16, 2026 16:00
@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 Mar 16, 2026
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Mar 16, 2026

@Ninja91 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96686225.

@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 16, 2026

🔗 Helpful Links

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

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

❌ 1 Cancelled Job

As of commit 0f35f7d with merge base 76df414 (image):

CANCELLED JOB - The following job was cancelled. Please retry:

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds the missing Cortex-M build target for the quantized_batch_matmul operator so the CMSIS-NN implementation is compiled and linked, preventing undefined-reference link failures in ARM embedded builds.

Changes:

  • Add quantized_batch_matmul to the Cortex-M OPERATORS list so :op_quantized_batch_matmul is generated and included in :cortex_m_operators.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@meta-codesync meta-codesync bot merged commit 12fe317 into pytorch:main Mar 16, 2026
168 of 176 checks passed
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. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants