Skip to content

Commit 96ba8ab

Browse files
committed
Update base for Update on "[executorch][runtime] Add NamedDataMap to method load"
Add NamedDataMap as an arg to: - Method - load_method - parseTensor Use NamedDataMap to resolve external tensors in parseTensor. Test that the PTE + PTD file run well inside method_test. Differential Revision: [D67127327](https://our.internmc.facebook.com/intern/diff/D67127327/) [ghstack-poisoned]
2 parents 13c7795 + 8d96d74 commit 96ba8ab

Some content is hidden

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

62 files changed

+1006
-166
lines changed

.ci/docker/common/install_base.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ install_ubuntu() {
2626
libssl-dev \
2727
zip
2828

29+
# These libraries are needed by TorchVision
30+
apt-get install -y --no-install-recommends \
31+
libjpeg-dev \
32+
libpng-dev
33+
2934
# Cleanup package manager
3035
apt-get autoclean && apt-get clean
3136
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

.ci/docker/common/install_conda.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,16 @@ install_miniconda() {
3131

3232
install_python() {
3333
pushd /opt/conda
34-
# Install the correct Python version
34+
# Install the selected Python version for CI jobs
3535
as_ci_user conda create -n "py_${PYTHON_VERSION}" -y --file /opt/conda/conda-env-ci.txt python="${PYTHON_VERSION}"
36+
37+
# From https://github.com/pytorch/pytorch/blob/main/.ci/docker/common/install_conda.sh
38+
if [[ $(uname -m) == "aarch64" ]]; then
39+
conda_install "openblas==0.3.28=*openmp*"
40+
else
41+
conda_install mkl=2022.1.0 mkl-include=2022.1.0
42+
fi
43+
3644
popd
3745
}
3846

@@ -53,7 +61,7 @@ fix_conda_ubuntu_libstdcxx() {
5361
# PyTorch sev: https://github.com/pytorch/pytorch/issues/105248
5462
# Ref: https://github.com/pytorch/pytorch/blob/main/.ci/docker/common/install_conda.sh
5563
if grep -e "2[02].04." /etc/issue >/dev/null; then
56-
rm "/opt/conda/envs/py_${PYTHON_VERSION}/lib/libstdc++.so.6"
64+
rm /opt/conda/envs/py_${PYTHON_VERSION}/lib/libstdc++.so*
5765
fi
5866
}
5967

.github/workflows/lint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
# The generic Linux job chooses to use base env, not the one setup by the image
3232
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
3333
conda activate "${CONDA_ENV}"
34-
34+
3535
# For mypy linting, we need to first install executorch first so that
3636
# it builds the python package information.
3737
BUILD_TOOL="cmake"
@@ -74,6 +74,7 @@ jobs:
7474
docker-image: executorch-ubuntu-22.04-linter
7575
fetch-depth: 0
7676
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
77+
timeout: 90
7778
script: |
7879
FILES_NEEDS_FORMAT=$(/opt/google-java-format -n extension/android/src/main/java/org/pytorch/executorch/*.java \
7980
examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/*.java \

.github/workflows/pull.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ jobs:
212212
docker-image: executorch-ubuntu-22.04-clang12
213213
submodules: 'true'
214214
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
215-
timeout: 180
215+
timeout: 90
216216
script: |
217217
# The generic Linux job chooses to use base env, not the one setup by the image
218218
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
@@ -526,7 +526,7 @@ jobs:
526526
docker-image: executorch-ubuntu-22.04-clang12
527527
submodules: 'true'
528528
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
529-
timeout: 180
529+
timeout: 90
530530
script: |
531531
# The generic Linux job chooses to use base env, not the one setup by the image
532532
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "Build the Data Loader extension"
182182
OFF
183183
)
184184

185+
option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR "Build the Flat Tensor extension"
186+
OFF
187+
)
188+
185189
option(EXECUTORCH_BUILD_EXTENSION_MODULE "Build the Module extension" OFF)
186190

187191
option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL "Build the Runner Util extension"
@@ -240,6 +244,9 @@ cmake_dependent_option(
240244
"NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF
241245
)
242246

247+
if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
248+
set(EXECUTORCH_BUILF_EXTENSION_DATA_LOADER ON)
249+
endif()
243250

244251
if(EXECUTORCH_BUILD_EXTENSION_TRAINING)
245252
set(EXECUTORCH_BUILD_EXTENSION_TENSOR ON)
@@ -694,6 +701,11 @@ if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
694701
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/data_loader)
695702
endif()
696703

704+
if(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR)
705+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/flat_tensor)
706+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/flat_tensor/serialize)
707+
endif()
708+
697709
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
698710
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/module)
699711
endif()

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ must work with threading**
215215

216216
## Testing
217217

218+
### Running Tests Locally
219+
220+
CI is run automatically on all pull requests. However, if you want to run tests locally, here are some example commands (not exhaustive):
221+
222+
- The `sh test/build_size_test.sh` script will compile the C++runtime along with portable kernels.
223+
- The `test/run_oss_cpp_tests.sh` script will build and run C++ tests locally
224+
- Running `pytest` from the root directory will run Python tests locally.
225+
218226
### Writing Tests
219227
To help keep code quality high, ExecuTorch uses a combination of unit tests and
220228
end-to-end (e2e) tests. If you add a new feature or fix a bug, please add tests
@@ -229,8 +237,6 @@ If it's not clear how to add a test for your PR, take a look at the blame for
229237
the code you're modifying and find an author who has more context. Ask them
230238
for their help in the PR comments.
231239

232-
The `test/run_oss_cpp_tests.sh` script will build and run C++ tests locally.
233-
234240
### Continuous Integration
235241
See https://hud.pytorch.org/hud/pytorch/executorch/main for the current state of
236242
the CI (continuous integration) jobs. If `main` is broken, consider rebasing

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div align="center">
88
<a href="https://github.com/pytorch/executorch/graphs/contributors"><img src="https://img.shields.io/github/contributors/pytorch/executorch?style=for-the-badge&color=blue" alt="Contributors"></a>
99
<a href="https://github.com/pytorch/executorch/stargazers"><img src="https://img.shields.io/github/stars/pytorch/executorch?style=for-the-badge&color=blue" alt="Stargazers"></a>
10-
<a href="https://discord.gg/MeacgB7A"><img src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge" alt="Join our Discord community"></a>
10+
<a href="https://discord.gg/Dh43CKSAdc"><img src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge" alt="Join our Discord community"></a>
1111
<a href="https://pytorch.org/executorch/stable/index.html"><img src="https://img.shields.io/badge/Documentation-000?logo=googledocs&logoColor=FFE165&style=for-the-badge" alt="Check out the documentation"></a>
1212
<hr>
1313
</div>
@@ -55,11 +55,11 @@ To get started you can:
5555
## Feedback and Engagement
5656

5757
We welcome any feedback, suggestions, and bug reports from the community to help
58-
us improve our technology. Check out the [Discussion Board](https://github.com/pytorch/executorch/discussions) or chat real time with us on [Discord](https://discord.gg/MeacgB7A)
58+
us improve our technology. Check out the [Discussion Board](https://github.com/pytorch/executorch/discussions) or chat real time with us on [Discord](https://discord.gg/Dh43CKSAdc)
5959

6060
## Contributing
6161

62-
We welcome contributions. To get started review the [guidelines](CONTRIBUTING.md) and chat with us on [Discord](https://discord.gg/MeacgB7A)
62+
We welcome contributions. To get started review the [guidelines](CONTRIBUTING.md) and chat with us on [Discord](https://discord.gg/Dh43CKSAdc)
6363

6464

6565
## Directory Structure

backends/arm/_passes/decompose_select.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@ def call(self, graph_module: torch.fx.GraphModule):
3737
rank = len(input_node.meta["val"].size())
3838
dim = dim % rank if dim < 0 else dim
3939
index = index % rank if index < 0 else index
40-
dim_list = list(range(rank))
4140

4241
with graph_module.graph.inserting_before(node):
4342
slice_node = create_node(
4443
graph_module.graph, slice_op, (input_node, dim, index, index + 1)
4544
)
4645
squeeze_node = create_node(
47-
graph_module.graph, squeeze_op, (slice_node, dim_list)
46+
graph_module.graph, squeeze_op, (slice_node, [dim])
4847
)
4948

5049
node.replace_all_uses_with(squeeze_node)

backends/arm/test/ops/test_bmm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def test_bmm_tosa_MI(self, test_data_generator: Callable[[], Tuple]):
124124
self._test_bmm_tosa_MI_pipeline(self.BMM(), test_data)
125125

126126
@parameterized.expand(BMMSingleInput.test_data_generators)
127+
@pytest.mark.flaky # TODO: Investigate flakyness (MLETORCH-534)
127128
def test_bmm_single_input_tosa_MI(self, test_data_generator: Callable[[], Tuple]):
128129
test_data = test_data_generator()
129130
self._test_bmm_tosa_MI_pipeline(self.BMMSingleInput(), test_data)
@@ -144,6 +145,7 @@ def test_bmm_tosa_BI(self, test_data_generator: Callable[[], Tuple]):
144145
self._test_bmm_tosa_BI_pipeline(self.BMM(), test_data)
145146

146147
@parameterized.expand(BMMSingleInput.test_data_generators)
148+
@pytest.mark.flaky # TODO: Investigate flakyness (MLETORCH-534)
147149
def test_bmm_single_input_tosa_BI(self, test_data_generator: Callable[[], Tuple]):
148150
test_data = test_data_generator()
149151
self._test_bmm_tosa_BI_pipeline(self.BMMSingleInput(), test_data)

backends/arm/test/ops/test_mm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def test_mm_tosa_MI(self, test_data_generator: Callable[[], Tuple]):
115115
self._test_mm_tosa_MI_pipeline(self.MM(), test_data)
116116

117117
@parameterized.expand(MMSingleInput.test_data_generators)
118+
@pytest.mark.flaky # TODO: Investigate flakyness (MLETORCH-534)
118119
def test_mm_single_input_tosa_MI(self, test_data_generator: Callable[[], Tuple]):
119120
test_data = test_data_generator()
120121
self._test_mm_tosa_MI_pipeline(self.MMSingleInput(), test_data)
@@ -126,6 +127,7 @@ def test_mm_tosa_BI(self, test_data_generator: Callable[[], Tuple]):
126127
self._test_mm_tosa_BI_pipeline(self.MM(), test_data)
127128

128129
@parameterized.expand(MMSingleInput.test_data_generators)
130+
@pytest.mark.flaky # TODO: Investigate flakyness (MLETORCH-534)
129131
def test_mm_single_input_tosa_BI(self, test_data_generator: Callable[[], Tuple]):
130132
test_data = test_data_generator()
131133
self._test_mm_tosa_BI_pipeline(self.MMSingleInput(), test_data)

0 commit comments

Comments
 (0)