Skip to content

force neon vectorization for ios (#21479) - #21479

Open
JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:export-D113940046
Open

force neon vectorization for ios (#21479)#21479
JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:export-D113940046

Conversation

@JakeStevens

@JakeStevens JakeStevens commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary:

The default implementation auto-vectorized well for Android builds, but the specific LLVM Clang 21 toolchain + compiler flags did not auto-vectorize, resulting in only scalar operations.

This commit selectively forces neon vectorization for iOS

Reviewed By: YIWENX14, JacobSzwejbka

Differential Revision: D113940046

@pytorch-bot

pytorch-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 32 New Failures, 1 Cancelled Job, 10 Unrelated Failures

As of commit 63d8cc0 with merge base 6bbb75a (image):

NEW FAILURES - The following jobs have failed:

  • pull / test-eval_llama-wikitext-linux / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 8968:25B5B5:6F503A:173D0C8:6A721444 and timestamp 2026-08-04 16:33:08 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-llama-runner-linux (fp32, xnnpack+custom+qe, linux.arm64.2xlarge, executorch-ubuntu-22.04-gc... / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID A5DE:BAC6B:8AEB6F:1CF4744:6A72174A and timestamp 2026-08-04 16:46:02 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-llama-runner-linux (fp32, xnnpack+custom+quantize_kv, linux.arm64.2xlarge, executorch-ubuntu... / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 9DE8:336BF9:8C1BAB:1D1FBB6:6A72173D and timestamp 2026-08-04 16:45:49 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-llama-runner-linux (fp32, xnnpack+quantize_kv, linux.arm64.2xlarge, executorch-ubuntu-22.04-... / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 95E8:49D81:85907F:1BD4DC6:6A72173F and timestamp 2026-08-04 16:45:51 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-lora-linux / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID B47A:3006EA:6CCAD8:16C1EB1:6A721412 and timestamp 2026-08-04 16:32:18 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-lora-multimethod-linux / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID B78C:1EE96F:26BAA9:81E177:6A72144D and timestamp 2026-08-04 16:33:17 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-mediatek-models-linux / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 918C:246175:73039B:17EF256:6A72144D and timestamp 2026-08-04 16:33:17 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux (emformer_join, portable, linux.4xlarge.memory) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID D1E4:11E38B:59F8A6:1330A6D:6A72184E and timestamp 2026-08-04 16:50:22 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux (emformer_join, xnnpack-quantization-delegation, linux.4xlarge.memory) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID A34A:1D8A14:3B0F43:C5B0FB:6A72184E and timestamp 2026-08-04 16:50:22 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux (ic4, portable, linux.4xlarge.memory) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 95E0:3289FA:3ECFEE:D2A674:6A721852 and timestamp 2026-08-04 16:50:26 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux (ic4, xnnpack-quantization-delegation, linux.4xlarge.memory) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 9556:F751D:54CB09:11C3742:6A721856 and timestamp 2026-08-04 16:50:30 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux (phi_4_mini, portable, linux.4xlarge.memory) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 9292:15F681:3DBAD3:CF6A17:6A72184E and timestamp 2026-08-04 16:50:22 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux (w2l, portable, linux.4xlarge.memory) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID BCB0:1CD12C:563724:120B947:6A721857 and timestamp 2026-08-04 16:50:31 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux-basic (mv3, portable, cmake, linux.arm64.2xlarge, executorch-ubuntu-22.04-gcc11... / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID CFAE:2EC4ED:4EF24A:108FCBE:6A721741 and timestamp 2026-08-04 16:45:53 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-models-linux-basic (mv3, xnnpack-quantization-delegation, cmake, linux.arm64.2xlarge, execut... / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID A412:29F94E:8AE982:1CDB37A:6A721740 and timestamp 2026-08-04 16:45:52 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-phi-3-mini-runner-linux / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 953E:28E8DB:36CC94:B846B8:6A721412 and timestamp 2026-08-04 16:32:18 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / test-voxtral-realtime-xnnpack-linux / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID B398:1DA6F1:98559D:1FC0DE9:6A721850 and timestamp 2026-08-04 16:50:25 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / unittest / windows / windows-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID C2D0:BAC6B:6C4071:168EAC3:6A7213C5 and timestamp 2026-08-04 16:31:02 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • pull / unittest-editable / windows / windows-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID C2CB:2A4FD8:36BBB5:B7881E:6A7213CF and timestamp 2026-08-04 16:31:11 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test ARM Backend / test-arm / test-backend-linux (arm_tosa_fp, models) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 983E:1BB5CD:938896:1EB084A:6A72184F and timestamp 2026-08-04 16:50:24 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test ARM Backend / test-arm / test-backend-linux (arm_tosa_fp, operators) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID AD0E:1E7BB3:92650B:1E911C1:6A72184A and timestamp 2026-08-04 16:50:18 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test ARM Backend / test-arm / test-backend-linux (arm_vgf_fp, models) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID 94D4:2547D9:517BBD:1110065:6A721852 and timestamp 2026-08-04 16:50:26 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test ARM Backend / test-arm / test-backend-linux (arm_vgf_fp, operators) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID B44C:1E65E6:8DFC54:1DA247D:6A72184F and timestamp 2026-08-04 16:50:23 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test QNN Backend / test-qnn / test-backend-linux (qnn, models) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID D62C:107B33:3F58E2:D435E3:6A721508 and timestamp 2026-08-04 16:36:25 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test QNN Backend / test-qnn / test-backend-linux (qnn, operators) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID E03A:F751D:3ECA01:D2A389:6A72150A and timestamp 2026-08-04 16:36:26 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test QNN Windows MSVC build / build-qnn-windows-msvc / windows-job (gh)
  • Test Vulkan Backend / test-vulkan / test-backend-linux (vulkan, models) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID A3A6:3289FA:3EA2BB:D20FC4:6A72184B and timestamp 2026-08-04 16:50:19 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test Vulkan Backend / test-vulkan / test-backend-linux (vulkan, operators) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID B4A4:300C04:3C45A2:C9F0F0:6A72184E and timestamp 2026-08-04 16:50:22 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test WebGPU Backend / test-webgpu / test-backend-linux (webgpu, models) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID AFFC:2EB148:55D88D:11EF14B:6A72184E and timestamp 2026-08-04 16:50:22 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test WebGPU Backend / test-webgpu / test-backend-linux (webgpu, operators) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID E0B4:2EB148:561397:11FB644:6A721856 and timestamp 2026-08-04 16:50:31 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test XNNPACK Backend / test-xnnpack / test-backend-linux (xnnpack, models) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID A544:2EC4ED:55D8E2:1201D17:6A72184B and timestamp 2026-08-04 16:50:19 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting
  • Test XNNPACK Backend / test-xnnpack / test-backend-linux (xnnpack, operators) / linux-job (gh)
    ##[error]API rate limit exceeded for installation. If you reach out to GitHub Support for help, please include the request ID B7F2:2879C1:913F0F:1E2ED4A:6A721856 and timestamp 2026-08-04 16:50:30 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting

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

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs 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 Jul 29, 2026
@meta-codesync

meta-codesync Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown

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.

@meta-codesync meta-codesync Bot changed the title force neon vectorization for ios force neon vectorization for ios (#21479) Jul 30, 2026
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Jul 30, 2026
Summary:

The default implementation auto-vectorized well for Android builds, but the specific LLVM Clang 21 toolchain + compiler flags did not auto-vectorize, resulting in only scalar operations.

This commit selectively forces neon vectorization for iOS

Differential Revision: D113940046
JakeStevens added a commit to JakeStevens/executorch that referenced this pull request Jul 30, 2026
Summary:

The default implementation auto-vectorized well for Android builds, but the specific LLVM Clang 21 toolchain + compiler flags did not auto-vectorize, resulting in only scalar operations.

This commit selectively forces neon vectorization for iOS

Reviewed By: YIWENX14

Differential Revision: D113940046

ET_INLINE void vec_scale(float* data, float scale, int64_t size) {
int64_t idx = 0;
#if defined(__APPLE__) && defined(__ARM_NEON)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont super love the #ifdefs throughout the kernel code I would rather have a singular layer in the kernel process that does dispatching similar to the torchao arm neon kernels we have. We can take that as a BE followup though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

have an internal task tracking, will fix when I also rename some stuff in a diff that supports scalar gated too

state_row[v_idx] = updated;
output_t[v_idx] += updated * query_value;
int64_t idx = 0;
#if defined(__APPLE__) && defined(__ARM_NEON)

@JacobSzwejbka JacobSzwejbka Aug 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why only apple? Is the auto vectorization on android just better then the handwritten intrinsics here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, at least with our internal setup. This is why we were seeing such a gap initially, Android autovectorization worked really well, Apple did not at all. This attempt at forcing it improved for Apple (going scalar -> vectored) but actually regressed for Android.

Summary:

The default implementation auto-vectorized well for Android builds, but the specific LLVM Clang 21 toolchain + compiler flags did not auto-vectorize, resulting in only scalar operations.

This commit selectively forces neon vectorization for iOS

Reviewed By: YIWENX14, JacobSzwejbka

Differential Revision: D113940046
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. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants