35 Commits

Author SHA1 Message Date
b8ef60b6bc Enable XNNPACK aarch64 builds (#159762)
Summary:
This fixes the build of TorchScript's XNNPACK dependency for our aarch64 device.

Thanks to andrewjcg for proposing this fix.

Rollback Plan:

Reviewed By: andrewjcg

Differential Revision: D79497613

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159762
Approved by: https://github.com/frankseide, https://github.com/malfet

Co-authored-by: Frank Seide <seide@meta.com>
2025-08-06 20:20:32 +00:00
86df3ff1f1 fix xnnpack build on mac (#158881)
Summary: Fix a bug for not getting the correct sources

Test Plan:
CI

on my mac:
```
buck2 build @//fbobjc/mode/profile --show-full-output //xplat/executorch/examples/portable/executor_runner:executor_runner_opt
File changed: fbsource//xplat/caffe2/third_party/xnnpack.buck.bzl
Buck UI: https://www.internalfb.com/buck2/67b59179-4de8-462a-9202-0b9c34a35aef
Network: Up: 2.4MiB  Down: 1.3KiB  (reSessionID-f687a7cd-5961-4851-bc67-b07043baa52a)
Loading targets.   Remaining     0/1                                                                                                          504 targets declared
Analyzing targets. Remaining     0/42                                                                                                         1960 actions, 2424 artifacts declared
Executing actions. Remaining     0/975                                                                                                        37.2s exec time total
Command: build.    Finished 40 local
Time elapsed: 7.7s
BUILD SUCCEEDED
fbsource//xplat/executorch/examples/portable/executor_runner:executor_runner_opt /Users/maxren/fbsource/buck-out/v2/gen/fbsource/267ffdee31edf15e/xplat/executorch/examples/portable/executor_runner/__executor_runner_opt__/executor_runner_opt
```

Rollback Plan:

Reviewed By: swolchok

Differential Revision: D78771697

Pull Request resolved: https://github.com/pytorch/pytorch/pull/158881
Approved by: https://github.com/digantdesai
2025-07-23 22:06:27 +00:00
0142d5f4e2 Revert "Remove is_arvr_mode() from xnnpack.buck.bzl (#158682)"
This reverts commit f09a484b8164aaadd57a79354f0ccf47733f365e.

Reverted https://github.com/pytorch/pytorch/pull/158682 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](https://github.com/pytorch/pytorch/pull/158682#issuecomment-3101648365))
2025-07-22 08:33:08 +00:00
f09a484b81 Remove is_arvr_mode() from xnnpack.buck.bzl (#158682)
Summary:
**Changes**
*   Deleted function import from build definition utilities
    *   Removed `load("//tools/build_defs:fbsource_utils.bzl", "is_arvr_mode")`
*   Replaced is_arvr_mode() function calls with direct references to configuration flags
    *  Changed from `is_arvr_mode()` to `"ovr_config//build_mode:arvr_mode"`
*   Changed conditional expressions to Buck `select()` statements

Test Plan:
Check if CI passes

Rollback Plan:

Differential Revision: D78520947

Pull Request resolved: https://github.com/pytorch/pytorch/pull/158682
Approved by: https://github.com/malfet
2025-07-21 22:49:26 +00:00
2e23768d25 Expose symbols on macos in the xplat pytorch stack (#150487)
Summary:
X-link: https://github.com/pytorch/executorch/pull/9819

Had to revert D71321310 because it affected way too many targets and build sizes.

These changes should expose just enough symbols to be buildable in arvr mode on macOS. Could potentially make narrow it down even more by avoiding eg `get_pt_compiler_flags`

Differential Revision: D72255474

Pull Request resolved: https://github.com/pytorch/pytorch/pull/150487
Approved by: https://github.com/drisspg
2025-04-04 23:03:16 +00:00
6bcf9c6ce3 [xnnpack] Expose subgraph symbols (#149397)
Summary: Main XNNPack target code uses symbols from subgraph so they need to be exported - this gets uncovered on macos where symbols were not visible after linking

Test Plan: CI / used for a macOS build on top of the stack.

Differential Revision: D71315023

Pull Request resolved: https://github.com/pytorch/pytorch/pull/149397
Approved by: https://github.com/digantdesai
2025-03-19 01:14:46 +00:00
20718cdebb [Fast Packing] Add packing ukernels to gemm config (#142191)
Add file to buck build

Differential Revision: [D66692673](https://our.internmc.facebook.com/intern/diff/D66692673/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D66692673/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/142191
Approved by: https://github.com/kirklandsign, https://github.com/digantdesai
2024-12-10 01:06:17 +00:00
16676fd17b Disable unused ARM SME to reduce android app binary size (#141942)
Summary: ARM SME kernels aren't currently used right now, so disabling their build so

Reviewed By: digantdesai

Differential Revision: D66336599

Pull Request resolved: https://github.com/pytorch/pytorch/pull/141942
Approved by: https://github.com/digantdesai
2024-12-04 07:24:50 +00:00
cca34be584 Update XNNPACK Version (#139913)
Updating XNNPACK Version to 4ea82e595b36106653175dcb04b2aa532660d0d8

submodule update
Pull Request resolved: https://github.com/pytorch/pytorch/pull/139913
Approved by: https://github.com/digantdesai, https://github.com/huydhn
2024-11-18 18:16:31 +00:00
b4feec9782 [xplat][XNNPACK] don't prefer static linkage in xplat for main target (#135529)
Building XNNPACK as a static library has some issues because of multiple global params floating around.

Let's try to get rid of it in xplat and see how it fares.

Differential Revision: [D60776152](https://our.internmc.facebook.com/intern/diff/D60776152/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D60776152/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/135529
Approved by: https://github.com/kimishpatel, https://github.com/mcr229, https://github.com/kirklandsign
2024-09-09 22:47:01 +00:00
679b8fe426 Update generate-xnnpack-wrappers.py parsing to handle build identifier (#134724)
Fixes an issue after updating XNNPACK where parsing the XNNPACK CMakeLists breaks. I'm just ignored the generated build identifier for now, since it's not used and we would need to update the buck build to generate it at build time.

Remove unused ukernels_xop XNNPACK target as it has no sources (after the recent update) and causes buck1 to complain.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/134724
Approved by: https://github.com/mcr229
2024-09-04 08:45:46 +00:00
3b40b07efb Update PyTorch for XNNPACK 87ee0b4 (#134518)
Summary: Update XNNPACK library version.

Test Plan: Combined diff CI is clean: D61586079 (all changes, has to be split out for export).

Differential Revision: D61822610

Pull Request resolved: https://github.com/pytorch/pytorch/pull/134518
Approved by: https://github.com/mcr229
2024-08-28 19:24:04 +00:00
962c1b4c69 Update XNNPACK revision to fcbf55a (#120583)
Update XNNPACK dependency to revision fcbf55a. This is part of a larger, synchronized update of the dependency version for PyTorch, ExecuTorch, and FB internal targets.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/120583
Approved by: https://github.com/mcr229
2024-03-08 01:19:22 +00:00
4d771c56de [xnnpack] Move x86 flags to platform_compiler_flags (#117923)
Summary:
AVX extension flags are x86 specific, and clang-18 has started to error on it when building targets that's not x86. I couldn't find the resulting upstream change that made these flags an error, but it's fairly trivial that these flags do not apply to all architectures.

For most of the flags, they are already defined in `platform_compiler_flags`. The changes done
* Gate the flags under `compiler_flags` with `selects`
* If flags weren't defined in `platform_compiler_flags`, define them there as well
* Remove the `^` and `$` in the platform regex. Not all flavors start with the platform (e.g. `android-x86_64`.
* Some minor formatting changes were also included here.

Test Plan:
Atop D52741786,
```
buck2 build --flagfile 'arvr/mode/android/apk/linux/opt'  '//arvr/projects/mixedreality/android/ocean_passthrough_service:ocean_passthrough_mrservice_dev'
```

Differential Revision: D52856224

Pull Request resolved: https://github.com/pytorch/pytorch/pull/117923
Approved by: https://github.com/mcr229
2024-01-26 23:41:06 +00:00
d92d4133e7 [8/n] Update XNNPACK Submodule Version Part 8 Everything Remaining to get it to work (#115714)
> **__Note:__** XNNPACK Upgrade is too large in the range of **40k** files and **10m** Lines of code, Thus we break the update of the library into multiple parts. All Parts [1 - n] Must be landed together for it to work. ***This also means If there is a revert. Please revert the Entire Stack.***

This change is everything remaining requiring XNNPACK version to work.

@allow-large-files

Differential Revision: [D52099769](https://our.internmc.facebook.com/intern/diff/D52099769/)

---
submodule
(unblock merge to make ShipIt happy)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/115714
Approved by: https://github.com/digantdesai
2023-12-15 23:08:08 +00:00
c3ed9f65a0 Revert "[8/n] Update XNNPACK Version Part 8 Everything Remaining to get it to work (#115587)"
This reverts commit a8dc9d8e353ddcf7db0247349a3acd0dd37fcc6f.

Reverted https://github.com/pytorch/pytorch/pull/115587 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](https://github.com/pytorch/pytorch/pull/115587#issuecomment-1852835898))
2023-12-12 21:28:09 +00:00
a8dc9d8e35 [8/n] Update XNNPACK Version Part 8 Everything Remaining to get it to work (#115587)
> **__Note:__** XNNPACK Upgrade is too large in the range of **40k** files and **10m** Lines of code, Thus we break the update of the library into multiple parts. All Parts [1 - 6/n] Must be landed together for it to work. ***This also means If there is a revert. Please revert the Entire Stack.***

This change is everything remaining requiring XNNPACK version to work.

Differential Revision: [D52044420](https://our.internmc.facebook.com/intern/diff/D52044420/)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/115587
Approved by: https://github.com/digantdesai
2023-12-12 17:17:19 +00:00
b9cb4103d7 Fix iphoneos compilation (#111502)
Summary: As title

Test Plan: buck build @//arvr/mode/iphoneos/mac/opt //xplat/third-party/XNNPACK:ukernels_asm_aarch64

Reviewed By: mcr229

Differential Revision: D50423968

Pull Request resolved: https://github.com/pytorch/pytorch/pull/111502
Approved by: https://github.com/mcr229
2023-10-27 20:00:41 +00:00
64ad16a5e1 [XNNPACK] Enable XX kernels (#108440)
Summary: Enables copy, pad, fill etc. kernels in XNNPACK library. This shouldn't be too bad size implication.

Test Plan: CI

Differential Revision: D48915384

Pull Request resolved: https://github.com/pytorch/pytorch/pull/108440
Approved by: https://github.com/Skylion007
2023-09-05 21:37:24 +00:00
eed287ec19 [android] Only pass -mfpu to armv7 (#103929)
Summary:
The argument is unsupported on other architectures, and Clang 17 will
error out when you pass an argument that's unsupported for the arch
you're building for. Note that we need to use platform_compiler_flags
instead of selects because the latter can't distinguish between
architectures when doing a multi-arch app build in Buck1.

Differential Revision: D46825070

Pull Request resolved: https://github.com/pytorch/pytorch/pull/103929
Approved by: https://github.com/ezyang
2023-06-21 23:23:35 +00:00
81b0f72e16 Fix xnnpack link errors (#101630)
Summary: Setting srcs for all arvr platforms in xnnpack.buck.bzl allows build with arvr/platform010 to pass.

Test Plan: CI

Reviewed By: blchxfm

Differential Revision: D45738660

Pull Request resolved: https://github.com/pytorch/pytorch/pull/101630
Approved by: https://github.com/digantdesai
2023-05-22 22:36:15 +00:00
ae5b044ccb [XNNPACK] Enable S8 Operators (#97386)
Enabling S8 Operators for quantized Clamp.

This is only for clamp nodes by themselves. I believe once they are fused with the previous node they are no longer needed

Differential Revision: [D43901200](https://our.internmc.facebook.com/intern/diff/D43901200/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D43901200/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97386
Approved by: https://github.com/salilsdesai
2023-03-31 04:32:29 +00:00
4befb84d49 [XNNPACK] Allow VCVT Operators (#97385)
Allow VCVT operators to allow operators that change datatype.

We want xnn_define_convert, to convert from one data type to another. Explanation for usage provided in follow up diff

Differential Revision: [D43844094](https://our.internmc.facebook.com/intern/diff/D43844094/)

**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D43844094/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97385
Approved by: https://github.com/salilsdesai
2023-03-31 03:56:53 +00:00
0698af67c7 Revert "Fix XNNPACK OSS Buck build (#94935)"
This reverts commit 9d2fddf820f8cf4273b12a8be5a556ba230c21cf.

Reverted https://github.com/pytorch/pytorch/pull/94935 on behalf of https://github.com/kit1980 due to The issue already mitigated by https://github.com/pytorch/pytorch/pull/94785
2023-02-15 23:14:44 +00:00
9d2fddf820 Fix XNNPACK OSS Buck build (#94935)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94935
Approved by: https://github.com/huydhn, https://github.com/seemethere, https://github.com/malfet
2023-02-15 23:06:32 +00:00
6da88bc966 try to fix OSS CI error (#94785)
Differential Revision: D43259005

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94785
Approved by: https://github.com/weiwangmeta, https://github.com/digantdesai
2023-02-15 21:00:55 +00:00
33f13fc959 Fix XNNPACK missing symbol from post-operation.c (#94768)
Summary: Fix RL team XNNPACK xnn_mutex.h issue.

Test Plan: buck2 test

Reviewed By: kirklandsign

Differential Revision: D43243129

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94768
Approved by: https://github.com/kirklandsign, https://github.com/digantdesai
2023-02-14 17:17:39 +00:00
9dd7e83676 update xnnpack to newer version and update API usage in pytorch (#94330)
Summary:
Update XNNPACK to 51a987591a6fc9f0fc0707077f53d763ac132cbf (51a987591a)

Update the corresponding CMake and BUCK rules, as well as the generate_wrapper.py for the new version.

Due to XNNPACK having already changed a lot. We need to update XNNPACK in this time for many reasons. Firstly, XNNAPCK has updated a lot, and developers' community has re-factored codes' such as API changes. We can see from their cmakefile.txt to see there are many changes! Thus, in order to follow up upstream. We need to update xnnpack at this time. It is very crucial for our future development. Also, many projects are relying on newer versions of XNNPACK, so we probably need to update XNNPACK third-party libs at this time. we have some api changes of XNNPACK, so we also need to update them in this time. We also update target building files and generate-wrapper.py file to make this process more automatically. The original target files have some files which are missing, so we add them into buck2 building files so that it can build and test XNNPACK successfully.

Test Plan:
buck2 build //xplat/third-party/XNNPACK:operators
buck2 build //xplat/third-party/XNNPACK:XNNPACK
buck2 test fbcode//caffe2/test:xnnpack_integration

Reviewed By: digantdesai

Differential Revision: D43092938

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94330
Approved by: https://github.com/digantdesai, https://github.com/albanD
2023-02-11 08:59:35 +00:00
6e1e212c39 [platform010] remove more ovr_config//runtime:platform009 usage (#93008)
Summary: WTTS

Test Plan: ci

Reviewed By: akrieger

Differential Revision: D42729966

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93008
Approved by: https://github.com/kit1980
2023-02-03 16:32:04 +00:00
c499e760f5 [XNNPACK] Enable Memopt for OSS (#93097)
Summary:
D38543798

Enabled Memopt previously to fix a bug with memory planner

Mirroring the changes we made Internally to OSS

Test Plan: OSS CI

Reviewed By: digantdesai

Differential Revision: D42782958

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93097
Approved by: https://github.com/digantdesai
2023-01-30 23:36:41 +00:00
bd4c4537dc aten cpu and xnnpack to be compatible with arvr mode build (#87125)
Summary:
When building 3d photo sdk generator package in arvr/mode/mac and arvr/mode/mac-arm modes, we got several issues with aten cpu and xnnpack libraries.

The reason is that those packages are using platform-* properties (platform-deps, platform-srcs...) which are not compatible with arvr modes.

This diff fixes those issues by using `select` for non-platform properties when is_arvr_mode() is true, while keeping those platform ones for non-arvr modes.

Test Plan:
```
buck build //arvr/projects/compphoto/photo3d_sdk/unity/plugin:generator_plugin_shared arvr/mode/mac-arm/dev
buck build //arvr/projects/compphoto/photo3d_sdk/unity/plugin:generator_plugin_shared arvr/mode/mac-arm/opt

buck build //arvr/projects/compphoto/photo3d_sdk/unity/plugin:generator_plugin_shared arvr/mode/mac/dev
buck build //arvr/projects/compphoto/photo3d_sdk/unity/plugin:generator_plugin_shared arvr/mode/mac/opt
```

and sandcastle builds

Differential Revision: D40028669

Pull Request resolved: https://github.com/pytorch/pytorch/pull/87125
Approved by: https://github.com/kimishpatel
2022-10-25 22:52:52 +00:00
8a45ef23f5 [5] move XNNPACK to shared BUCK build (#80209)
Summary: Reland D36529332 (b8b46f932b) with shared buck build structure.

Test Plan:
buck build //xplat/third-party/XNNPACK:XNNPACK
Sandcastle

Differential Revision: D37407609

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80209
Approved by: https://github.com/kimishpatel
2022-06-28 02:25:07 +00:00
1f8049566f Re-land BUCK build for pytorch mobile (#77612)
see https://github.com/pytorch/pytorch/pull/76480
fixed most lint errors
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77612
Approved by: https://github.com/kit1980
2022-05-17 00:30:13 +00:00
530481ed69 Revert "[mobile] add buck build for mobile targets (#76480)"
This reverts commit 168dc70faf9764417a7e41a14bf2f4e15a7f3e4a.

Reverted https://github.com/pytorch/pytorch/pull/76480 on behalf of https://github.com/atalman
2022-05-16 16:14:17 +00:00
168dc70faf [mobile] add buck build for mobile targets (#76480)
Create buck targets to replicate internal BUCK build, including
- XNNPACK
- QNNPACK
- C10
- aten_cpu
- torch_mobile_core
- torch_mobile_all_ops
- ptmobile_benchmark

And able to run mobilenet v2 using ptmobile_benchmark (with all ops).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76480
Approved by: https://github.com/seemethere, https://github.com/dreiss
2022-05-15 18:42:41 +00:00