Skip to content

Commit 16e5901

Browse files
authored
Turn on XNNPACK by default for wheels (#9773)
### Summary We pretty much always include xnnpack when building wheels, so why not just turn it on by default? If users want it off, they can opt-out. ![image](https://github.com/user-attachments/assets/f7c7003d-1768-4858-a777-b47064f65e77) ### Test plan CI
1 parent ea2029d commit 16e5901

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

.ci/scripts/utils.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ install_executorch() {
3232
which pip
3333
# Install executorch, this assumes that Executorch is checked out in the
3434
# current directory.
35-
./install_executorch.sh --pybind xnnpack "$@"
35+
./install_executorch.sh "$@"
3636
# Just print out the list of packages for debugging
3737
pip list
3838
}

install_executorch.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,10 @@ def main(args):
207207
use_pytorch_nightly = True
208208

209209
wants_pybindings_off, pybind_defines = _list_pybind_defines(args)
210-
if not wants_pybindings_off:
211-
if len(pybind_defines) > 0:
212-
# If the user explicitly provides a list of bindings, just use them
213-
cmake_args += pybind_defines
214-
else:
215-
# If the user has not set pybindings off but also has not provided
216-
# a list, then turn on xnnpack by default
217-
cmake_args.append("-DEXECUTORCH_BUILD_XNNPACK=ON")
210+
if wants_pybindings_off:
211+
cmake_args.append("-DEXECUTORCH_BUILD_PYBIND=OFF")
212+
else:
213+
cmake_args += pybind_defines
218214

219215
if args.clean:
220216
clean()

setup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def openvino(cls) -> bool:
142142

143143
@classmethod
144144
def xnnpack(cls) -> bool:
145-
return cls._is_cmake_arg_enabled("EXECUTORCH_BUILD_XNNPACK", default=False)
145+
return cls._is_cmake_arg_enabled("EXECUTORCH_BUILD_XNNPACK", default=True)
146146

147147
@classmethod
148148
def training(cls) -> bool:
@@ -730,6 +730,9 @@ def run(self):
730730
"-DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON",
731731
]
732732

733+
if ShouldBuild.xnnpack():
734+
cmake_args += ["-DEXECUTORCH_BUILD_XNNPACK=ON"]
735+
733736
if ShouldBuild.training():
734737
build_args += ["--target", "_training_lib"]
735738

0 commit comments

Comments
 (0)