Skip to content

Fix conv2d scratch buffer allocation to match CMSIS-NN wrapper dispatch#17766

Draft
rascani wants to merge 1 commit intopytorch:mainfrom
rascani:cortex-m-conv-buffer-size
Draft

Fix conv2d scratch buffer allocation to match CMSIS-NN wrapper dispatch#17766
rascani wants to merge 1 commit intopytorch:mainfrom
rascani:cortex-m-conv-buffer-size

Conversation

@rascani
Copy link
Contributor

@rascani rascani commented Feb 28, 2026

Summary

Use arm_convolve_wrapper_s8_get_buffer_size instead of arm_convolve_s8_get_buffer_size so the buffer size matches whichever specialized kernel arm_convolve_wrapper_s8 will actually dispatch to at runtime (1x1 fast, 1xN, or general).

Also remove the Error::NotFound carve-out that silently proceeded with a null scratch buffer — CMSIS-NN returns ARM_CMSIS_NN_ARG_ERROR when ctx->buf is NULL and a buffer is required, so fail immediately on any allocation error, consistent with the other cortex_m conv ops.

Use arm_convolve_wrapper_s8_get_buffer_size instead of
arm_convolve_s8_get_buffer_size so the buffer size matches whichever
specialized kernel arm_convolve_wrapper_s8 will actually dispatch to
at runtime (1x1 fast, 1xN, or general).

Also remove the Error::NotFound carve-out that silently proceeded with
a null scratch buffer — CMSIS-NN returns ARM_CMSIS_NN_ARG_ERROR when
ctx->buf is NULL and a buffer is required, so fail immediately on any
allocation error, consistent with the other cortex_m conv ops.

Co-authored-by: Claude <noreply@anthropic.com>
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 28, 2026

🔗 Helpful Links

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

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

❌ 1 Awaiting Approval, 2 New Failures

As of commit 71db0c9 with merge base 1f4ad07 (image):

AWAITING APPROVAL - The following workflow needs approval before CI can run:

NEW FAILURES - The following jobs have failed:

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 28, 2026
@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.

@rascani
Copy link
Contributor Author

rascani commented Feb 28, 2026

Merge will be blocked until ARM-software/CMSIS-NN#200 has merged and we can update the CMSIS version.

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.

1 participant