Skip to content

Commit 9023d0f

Browse files
authored
Merge branch 'main' into feature/standalone-runner
2 parents b4e729e + f1062a7 commit 9023d0f

218 files changed

Lines changed: 9722 additions & 2010 deletions

File tree

Some content is hidden

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

.ci/scripts/setup-macos.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ setup_macos_env_variables
116116
# buck2 atm
117117
install_buck
118118
brew install libomp
119-
install_pip_dependencies
120119

121120
# TODO(huydhn): Unlike our self-hosted runner, GitHub runner doesn't have access
122121
# to our infra, so compiler caching needs to be setup differently using GitHub
@@ -125,10 +124,17 @@ if [[ -z "${GITHUB_RUNNER:-}" ]]; then
125124
install_sccache
126125
fi
127126

127+
# Install pinned torch before requirements-ci.txt so torchsr's transitive
128+
# torch dep is satisfied by the existing install and pip does not pull a
129+
# separate copy from PyPI. sccache is initialized above so source-build
130+
# cache misses still hit the cache.
128131
print_cmake_info
129132
install_pytorch_and_domains
130-
# We build PyTorch from source here instead of using nightly. This allows CI to test against
131-
# the pinned commit from PyTorch
133+
134+
install_pip_dependencies
135+
136+
# install_executorch's --use-pt-pinned-commit skips re-installing torch since
137+
# install_pytorch_and_domains already installed the pinned build above.
132138
if [[ "$EDITABLE" == "true" ]]; then
133139
install_executorch --use-pt-pinned-commit --editable
134140
else

.ci/scripts/test_lora.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ Okay, so I need to calculate 15% of 80."
159159
EXPECTED_QUANT_LORA_PREFIX="
160160
<|im_start|>user Calculate 15% of 80?<|im_end|><|im_start|>assistant
161161
To calculate 15% of 80, we can multiply 80 by 15/100.
162-
So, 15% of 80 is equal to (80 * 15) / 100 = 1200 / 100 = 12.
162+
80 * 15/100 = 12.
163+
So, 15% of 80 is 12.
163164
#### 12
164165
The answer is: 12<|im_end|>"
165166
EXPECTED_QUANT_LORA_ALTERNATE_PREFIX="

.ci/scripts/utils.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ install_pytorch_and_domains() {
127127
if [[ "${torch_wheel_not_found}" == "1" ]]; then
128128
echo "No cached wheel found, continue with building PyTorch at ${TORCH_VERSION}"
129129

130+
# Install PyTorch's own build-time deps so the source build does not
131+
# silently inherit them from whatever else happens to be in the env
132+
# (e.g. executorch's requirements-ci.txt).
133+
pip install -r requirements-build.txt
130134
git submodule update --init --recursive
131135
USE_DISTRIBUTED=1 python setup.py bdist_wheel
132136
pip install "$(echo dist/*.whl)"

.github/scripts/docathon-label-sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def main() -> None:
99
token = os.environ.get("GITHUB_TOKEN")
1010

1111
repo_owner = "pytorch"
12-
repo_name = "pytorch"
12+
repo_name = "executorch"
1313
pull_request_number = int(sys.argv[1])
1414

1515
g = Github(token)

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,25 @@ CI is run automatically on all pull requests. However, if you want to run tests
321321
- The `test/run_oss_cpp_tests.sh` script will build and run C++ tests locally
322322
- Running `pytest` from the root directory will run Python tests locally. Make sure to run this after finishing [Dev Install](#dev-install).
323323

324+
To build C++ tests manually with CMake, run the following from the repository root:
325+
326+
```bash
327+
cmake . -Bcmake-out -DCMAKE_INSTALL_PREFIX=cmake-out -DEXECUTORCH_BUILD_TESTS=ON
328+
cmake --build cmake-out -j9 --target install
329+
```
330+
331+
You can then use `ctest` to list or run individual C++ tests directly:
332+
333+
```bash
334+
ctest --test-dir cmake-out -N
335+
ctest --test-dir cmake-out -R <test_name_regex> --output-on-failure
336+
```
337+
338+
This workflow is useful when you want to rerun one test, attach a debugger to a
339+
test binary under `cmake-out`, or keep a build directory around for quick rebuild
340+
cycles. Add the same `-DEXECUTORCH_BUILD_*` options used by
341+
`test/run_oss_cpp_tests.sh` when the test needs optional kernels or extensions.
342+
324343
### Writing Tests
325344
To help keep code quality high, ExecuTorch uses a combination of unit tests and
326345
end-to-end (e2e) tests. If you add a new feature or fix a bug, please add tests

backends/aoti/slim/cuda/test/targets.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
1+
load("@fbcode_macros//build_defs:gpu_cpp_unittest.bzl", "gpu_cpp_unittest")
22
load("@fbcode_macros//build_defs/lib:re_test_utils.bzl", "re_test_utils")
33

44
def cuda_slim_cpp_unittest(name):
5-
cpp_unittest(
5+
gpu_cpp_unittest(
66
name = "test_" + name,
77
srcs = [
88
"test_" + name + ".cpp",
@@ -16,6 +16,7 @@ def cuda_slim_cpp_unittest(name):
1616
external_deps = [
1717
("cuda", None, "cuda-lazy"),
1818
],
19+
hip_compatible = False,
1920
keep_gpu_sections = True,
2021
remote_execution = re_test_utils.remote_execution(
2122
platform = "gpu-remote-execution",

backends/arm/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,15 @@ Some tests, with `u55`, `u85` and `vgf` in the name require external dependencie
249249
```
250250

251251
In addition, some model tests in the Arm backend require third-party libraries or packages.
252-
To run these tests, you need to install the required dependencies by running the script `examples/arm/setup.sh` with the flag `--setup-test-dependency`.
252+
To run these tests, install the required dependencies directly:
253253

254-
Please note that installing model test dependencies is a standalone process. When using the `--setup-test-dependency` flag,
255-
the script will install only the necessary dependencies for model tests, skipping all other setup procedures.
254+
```
255+
bash backends/arm/scripts/install_models_for_test.sh
256+
```
257+
258+
Installing model test dependencies is a standalone process. The script installs
259+
only the dependencies needed for model tests, skipping all other setup
260+
procedures.
256261

257262
## Using git hooks
258263

backends/arm/_passes/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@
140140
from .remove_getitem_pass import RemoveGetItemPass # noqa
141141
from .remove_graph_asserts_pass import RemoveGraphAssertsPass # noqa
142142
from .remove_noop_pass import RemoveNoopPass # noqa
143+
from .remove_permutes_around_elementwise_tosa_ops import ( # noqa
144+
RemovePermutesAroundElementwiseTosaOps,
145+
)
143146
from .replace_scalar_with_tensor_pass import ( # noqa
144147
ReplaceScalarWithTensorByProfilePass,
145148
)

backends/arm/_passes/arm_pass_manager.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
RemoveGetItemPass,
126126
RemoveGraphAssertsPass,
127127
RemoveNoopPass,
128+
RemovePermutesAroundElementwiseTosaOps,
128129
ReplaceInfAndLimitValuesPass,
129130
ReplaceScalarWithTensorByProfilePass,
130131
RewriteAvgPool2dPass,
@@ -164,9 +165,6 @@
164165
PostponePermuteOpBelowSqueezeOrUnsqueezeLikeView,
165166
)
166167

167-
from executorch.backends.transforms.remove_permutes_around_elementwise_ops import (
168-
RemovePermutesAroundElementwiseOps,
169-
)
170168
from executorch.exir import ExportedProgram
171169
from executorch.exir.pass_base import ExportPass
172170
from executorch.exir.pass_manager import PassManager
@@ -526,6 +524,7 @@ def _tosa_pipeline(
526524
DecomposeSumPass(),
527525
InsertTableOpsPass(exported_program),
528526
RemoveNoopPass(),
527+
InsertDataLayoutCastsPass(),
529528
]
530529
)
531530

@@ -538,7 +537,7 @@ def _tosa_pipeline(
538537
RewriteMatmulPass(),
539538
RewritePadPass(),
540539
FuseViewCopyTransformPass(),
541-
RemovePermutesAroundElementwiseOps(),
540+
RemovePermutesAroundElementwiseTosaOps(),
542541
PostponePermuteOpBelowSqueezeOrUnsqueezeLikeView(),
543542
FuseCascadedTransposeOrPermuteOps(),
544543
ConvertPermuteSingletonToViewPass(),
@@ -558,7 +557,6 @@ def _tosa_pipeline(
558557
EnsureUniqueOutputNodesPass(),
559558
RemoveNoopPass(),
560559
InsertRescalePass(),
561-
InsertDataLayoutCastsPass(),
562560
]
563561
)
564562

backends/arm/_passes/decompose_permute_for_u55_pass.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from executorch.backends.arm._passes.arm_pass import ArmPass
1515
from executorch.backends.arm._passes.rewrite_slice import RewriteSlicePass
1616
from executorch.backends.arm.arm_vela import vela_compile
17-
from executorch.backends.arm.ethosu.compile_spec import EthosUCompileSpec
1817
from executorch.backends.arm.tosa.mapping import map_dtype
1918
from executorch.backends.arm.tosa.specification import get_context_spec
2019
from executorch.exir.dialects._ops import ops as exir_ops
@@ -112,6 +111,9 @@ def _violates_exact_constraint(
112111
permutation and dtype to check wheter it is supported.
113112
"""
114113

114+
# Lazy import to avoid circular dependency
115+
from executorch.backends.arm.ethosu.compile_spec import EthosUCompileSpec
116+
115117
if dtype not in (torch.int8, torch.bool, torch.int16):
116118
return True
117119

0 commit comments

Comments
 (0)