Skip to content

Commit 3322c35

Browse files
committed
Update on "[ET-VK] Adding all tensor packing support to split op."
This diff updates Executorch Vulkan backend's `split` operation to support width, height and channel packed tensors. It also updates the op_registry.py file to indicate `split` operation supports all packing and adds new test cases to the cases.py file to test the operation. Differential Revision: [D71345589](https://our.internmc.facebook.com/intern/diff/D71345589/) [ghstack-poisoned]
2 parents 134ff60 + f5fcc4c commit 3322c35

File tree

188 files changed

+4458
-901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+4458
-901
lines changed

.ci/scripts/gather_benchmark_configs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ def is_valid_huggingface_model_id(model_name: str) -> bool:
263263
def get_benchmark_configs() -> Dict[str, Dict]: # noqa: C901
264264
"""
265265
Gather benchmark configurations for a given set of models on the target operating system and devices.
266-
266+
CHANGE IF this function's return changed:
267+
extract_model_info() in executorch/.github/scripts/extract_benchmark_results.py IF YOU CHANGE THE RESULT OF THIS FUNCTION.
267268
Args:
268269
None
269270

.ci/scripts/unittest-buck2.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ set -eux
88

99
# TODO: expand this to //...
1010
# TODO: can't query cadence & vulkan backends
11-
# TODO: can't query //kernels/prim_ops because of a cpp_unittest and
12-
# broken code in shim to read oss.folly_cxx_tests. Sending fix but it
13-
# needs to propagate and we need a submodule update.
11+
# TODO: can't query //kernels/prim_ops because of non-buckified stuff in OSS.
1412
buck2 query "//backends/apple/... + //backends/example/... + \
1513
//backends/mediatek/... + //backends/test/... + //backends/transforms/... + \
1614
//backends/xnnpack/... + //configurations/... + //kernels/aten/... + \
@@ -20,7 +18,9 @@ buck2 query "//backends/apple/... + //backends/example/... + \
2018
UNBUILDABLE_OPTIMIZED_OPS_REGEX="gelu|fft_r2c|log_softmax"
2119
BUILDABLE_OPTIMIZED_OPS=$(buck2 query //kernels/optimized/cpu/... | grep -E -v $UNBUILDABLE_OPTIMIZED_OPS_REGEX)
2220

23-
BUILDABLE_KERNELS_PRIM_OPS_TARGETS=$(buck2 query //kernels/prim_ops/... | grep -v prim_ops_test_py)
21+
# TODO: build prim_ops_test_cpp again once supported_features works in
22+
# OSS buck.
23+
BUILDABLE_KERNELS_PRIM_OPS_TARGETS=$(buck2 query //kernels/prim_ops/... | grep -v prim_ops_test)
2424
# TODO: expand the covered scope of Buck targets.
2525
# //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH.
2626
# //runtime/test/... requires Python torch, which we don't have in our OSS buck setup.

.ci/scripts/wheel/__init__.py

Whitespace-only changes.

.ci/scripts/wheel/envvar_linux.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# This file is sourced into the environment before building a pip wheel. It
8+
# should typically only contain shell variable assignments. Be sure to export
9+
# any variables so that subprocesses will see them.
10+
11+
source "${GITHUB_WORKSPACE}/${REPOSITORY}/.ci/scripts/wheel/envvar_base.sh"

build/packaging/env_var_script_macos.sh renamed to .ci/scripts/wheel/envvar_macos.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,7 @@
88
# should typically only contain shell variable assignments. Be sure to export
99
# any variables so that subprocesses will see them.
1010

11-
# Enable pybindings so that users can execute ExecuTorch programs from python.
12-
export EXECUTORCH_BUILD_PYBIND=1
13-
14-
# Ensure that CMAKE_ARGS is defined before referencing it. Defaults to empty
15-
# if not defined.
16-
export CMAKE_ARGS="${CMAKE_ARGS:-}"
17-
18-
# Link the XNNPACK backend into the pybindings runtime so that users can execute
19-
# ExecuTorch programs that delegate to it.
20-
CMAKE_ARGS="${CMAKE_ARGS} -DEXECUTORCH_BUILD_XNNPACK=ON"
11+
source "${GITHUB_WORKSPACE}/${REPOSITORY}/.ci/scripts/wheel/envvar_base.sh"
2112

2213
# When building for macOS, link additional backends into the pybindings runtime.
2314
CMAKE_ARGS="${CMAKE_ARGS} -DEXECUTORCH_BUILD_COREML=ON"

build/packaging/pre_build_script.sh renamed to .ci/scripts/wheel/pre_build_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ set -euxo pipefail
1414
# which does install them. Though we'd need to disable build isolation to be
1515
# able to see the installed torch package.
1616

17-
pip install --progress-bar off -r requirements-dev.txt
17+
"${GITHUB_WORKSPACE}/${REPOSITORY}/install_requirements.sh"

.ci/scripts/wheel/test_base.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
import os
8+
import subprocess
9+
import sys
10+
from dataclasses import dataclass
11+
from functools import cache
12+
from typing import List
13+
14+
15+
@cache
16+
def _unsafe_get_env(key: str) -> str:
17+
value = os.getenv(key)
18+
if value is None:
19+
raise RuntimeError(f"environment variable '{key}' is not set")
20+
return value
21+
22+
23+
@cache
24+
def _repository_root_dir() -> str:
25+
return os.path.join(
26+
_unsafe_get_env("GITHUB_WORKSPACE"),
27+
_unsafe_get_env("REPOSITORY"),
28+
)
29+
30+
31+
# For some reason, we are unable to see the entire repo in the python path.
32+
# So manually add it.
33+
sys.path.append(_repository_root_dir())
34+
from examples.models import Backend, Model
35+
36+
37+
@dataclass
38+
class ModelTest:
39+
model: Model
40+
backend: Backend
41+
42+
43+
def run_tests(model_tests: List[ModelTest]) -> None:
44+
# Why are we doing this envvar shenanigans? Since we build the testers, which
45+
# uses buck, we cannot run as root. This is a sneaky of getting around that
46+
# test.
47+
#
48+
# This can be reverted if either:
49+
# - We remove usage of buck in our builds
50+
# - We stop running the Docker image as root: https://github.com/pytorch/test-infra/issues/5091
51+
envvars = os.environ.copy()
52+
envvars.pop("HOME")
53+
54+
for model_test in model_tests:
55+
subprocess.run(
56+
[
57+
os.path.join(_repository_root_dir(), ".ci/scripts/test_model.sh"),
58+
str(model_test.model),
59+
# What to build `executor_runner` with for testing.
60+
"cmake",
61+
str(model_test.backend),
62+
],
63+
env=envvars,
64+
check=True,
65+
cwd=_repository_root_dir(),
66+
)

.ci/scripts/wheel/test_linux.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
import test_base
9+
from examples.models import Backend, Model
10+
11+
if __name__ == "__main__":
12+
test_base.run_tests(
13+
model_tests=[
14+
test_base.ModelTest(
15+
model=Model.Mv3,
16+
backend=Backend.XnnpackQuantizationDelegation,
17+
)
18+
]
19+
)

.ci/scripts/wheel/test_macos.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
import test_base
9+
from examples.models import Backend, Model
10+
11+
if __name__ == "__main__":
12+
test_base.run_tests(
13+
model_tests=[
14+
test_base.ModelTest(
15+
model=Model.Mv3,
16+
backend=Backend.XnnpackQuantizationDelegation,
17+
)
18+
]
19+
)

0 commit comments

Comments
 (0)