Skip to content

Commit 33b9fd5

Browse files
committed
Update on "[executorch][flat_tensor] implement load into and dont hold onto the segment"
1. Implement load_into in FlatTensorDataMap 2. Do not persist 'data_ro' in the FlatTensorDataMap. From `get_data`, return the FreeableBuffer given by the data loader. TODO: add test for load_into. Differential Revision: [D69148652](https://our.internmc.facebook.com/intern/diff/D69148652/) [ghstack-poisoned]
2 parents 0863b58 + b94dcd6 commit 33b9fd5

File tree

83 files changed

+2422
-675
lines changed

Some content is hidden

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

83 files changed

+2422
-675
lines changed

.ci/scripts/test_qnn_static_llama.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ $PYTHON_EXECUTABLE -m extension.llm.tokenizer.tokenizer -t tokenizer.model -o to
3434

3535
set +e
3636
# Compile only as weight sharing is not applicable on x86
37-
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleScript.test_stories_single_llama --model SM8650 --build_folder build-android/ --executorch_root . --artifact_dir . --compile_only
37+
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleLLMScript.test_llama_stories_110m --model SM8650 --build_folder build-android/ --executorch_root . --artifact_dir . --llama_artifacts . --compile_only
3838
exit_code1=$?
3939

4040
# Checks accuracy with weight sharing disabled since x86 does not support weight sharing.
41-
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleScript.test_stories_single_llama --model SM8650 --build_folder build-x86/ --executorch_root . --artifact_dir . --enable_x86_64
41+
$PYTHON_EXECUTABLE backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleLLMScript.test_llama_stories_110m --model SM8650 --build_folder build-x86/ --executorch_root . --artifact_dir . --llama_artifacts . --enable_x86_64
4242
exit_code2=$?
4343

4444
# Check the exit codes and print messages

.ci/scripts/unittest-buck2.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
# TODO: expand this to //...
10+
buck2 query //runtime/...
11+
12+
# TODO: expand the covered scope of Buck targets.
13+
buck2 build //runtime/core/portable_type/...
14+
buck2 test //runtime/core/portable_type/...
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
# Run pytest with coverage
10+
pytest -n auto --cov=./ --cov-report=xml
11+
# Run gtest
12+
LLVM_PROFDATA=llvm-profdata-12 LLVM_COV=llvm-cov-12 \
13+
test/run_oss_cpp_tests.sh

.ci/scripts/unittest-linux.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
BUILD_TOOL=$1
10+
if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then
11+
echo "Running unittests for ${BUILD_TOOL} ..."
12+
else
13+
echo "Missing build tool (require buck2 or cmake), exiting..."
14+
exit 1
15+
fi
16+
17+
# The generic Linux job chooses to use base env, not the one setup by the image
18+
eval "$(conda shell.bash hook)"
19+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
20+
conda activate "${CONDA_ENV}"
21+
22+
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
23+
source .ci/scripts/setup-vulkan-linux-deps.sh
24+
25+
PYTHON_EXECUTABLE=python \
26+
EXECUTORCH_BUILD_PYBIND=ON \
27+
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
28+
.ci/scripts/setup-linux.sh "$BUILD_TOOL"
29+
30+
# Install llama3_2_vision dependencies.
31+
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
32+
33+
if [[ "$BUILD_TOOL" == "cmake" ]]; then
34+
.ci/scripts/unittest-linux-cmake.sh
35+
elif [[ "$BUILD_TOOL" == "buck2" ]]; then
36+
.ci/scripts/unittest-buck2.sh
37+
else
38+
echo "Unknown build tool $BUILD_TOOL"
39+
exit 1
40+
fi
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
# Run pytest with coverage
10+
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml
11+
# Run gtest
12+
LLVM_PROFDATA="xcrun llvm-profdata" LLVM_COV="xcrun llvm-cov" \
13+
${CONDA_RUN} test/run_oss_cpp_tests.sh

.ci/scripts/unittest-macos.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
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+
set -eux
8+
9+
BUILD_TOOL=$1
10+
if [[ $BUILD_TOOL =~ ^(cmake|buck2)$ ]]; then
11+
echo "Running unittests for ${BUILD_TOOL} ..."
12+
else
13+
echo "Missing build tool (require buck2 or cmake), exiting..."
14+
exit 1
15+
fi
16+
17+
bash .ci/scripts/setup-conda.sh
18+
eval "$(conda shell.bash hook)"
19+
20+
# Create temp directory for sccache shims
21+
export TMP_DIR=$(mktemp -d)
22+
export PATH="${TMP_DIR}:$PATH"
23+
trap 'rm -rfv ${TMP_DIR}' EXIT
24+
25+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
26+
PYTHON_EXECUTABLE=python \
27+
EXECUTORCH_BUILD_PYBIND=ON \
28+
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
29+
${CONDA_RUN} --no-capture-output \
30+
.ci/scripts/setup-macos.sh cmake
31+
32+
# Install llama3_2_vision dependencies.
33+
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
34+
35+
if [[ "$BUILD_TOOL" == "cmake" ]]; then
36+
.ci/scripts/unittest-macos-cmake.sh
37+
elif [[ "$BUILD_TOOL" == "buck2" ]]; then
38+
.ci/scripts/unittest-buck2.sh
39+
else
40+
echo "Unknown build tool $BUILD_TOOL"
41+
exit 1
42+
fi

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ body:
2121
A clear and concise description of what the bug is.
2222
2323
```python
24-
# Sample code to reproduce the problem
24+
# Sample code to reproduce the problem. If applicable, also include your model export command.
2525
```
2626
2727
```

.github/workflows/_unittest.yml

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
required: true
88
type: string
99
description: Name of the docker image to use.
10+
build-tool:
11+
required: true
12+
type: string
13+
description: Build tool to use, cmake or buck2.
1014
python-version:
1115
required: false
1216
type: string
@@ -26,28 +30,7 @@ jobs:
2630
timeout: 90
2731
script: |
2832
set -eux
29-
30-
# The generic Linux job chooses to use base env, not the one setup by the image
31-
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
32-
conda activate "${CONDA_ENV}"
33-
34-
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
35-
source .ci/scripts/setup-vulkan-linux-deps.sh
36-
37-
# Setup MacOS dependencies as there is no Docker support on MacOS atm
38-
PYTHON_EXECUTABLE=python \
39-
EXECUTORCH_BUILD_PYBIND=ON \
40-
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
41-
.ci/scripts/setup-linux.sh cmake
42-
43-
# Install llama3_2_vision dependencies.
44-
PYTHON_EXECUTABLE=python ./examples/models/llama3_2_vision/install_requirements.sh
45-
46-
# Run pytest with coverage
47-
pytest -n auto --cov=./ --cov-report=xml
48-
# Run gtest
49-
LLVM_PROFDATA=llvm-profdata-12 LLVM_COV=llvm-cov-12 \
50-
test/run_oss_cpp_tests.sh
33+
.ci/scripts/unittest-linux.sh "${{ inputs.build-tool }}"
5134
5235
macos:
5336
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
@@ -58,27 +41,4 @@ jobs:
5841
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
5942
script: |
6043
set -eux
61-
62-
bash .ci/scripts/setup-conda.sh
63-
64-
# Create temp directory for sccache shims
65-
export TMP_DIR=$(mktemp -d)
66-
export PATH="${TMP_DIR}:$PATH"
67-
trap 'rm -rfv ${TMP_DIR}' EXIT
68-
69-
# Setup MacOS dependencies as there is no Docker support on MacOS atm
70-
PYTHON_EXECUTABLE=python \
71-
EXECUTORCH_BUILD_PYBIND=ON \
72-
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
73-
${CONDA_RUN} --no-capture-output \
74-
.ci/scripts/setup-macos.sh cmake
75-
76-
# Install llama3_2_vision dependencies.
77-
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
78-
./examples/models/llama3_2_vision/install_requirements.sh
79-
80-
# Run pytest with coverage
81-
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml
82-
# Run gtest
83-
LLVM_PROFDATA="xcrun llvm-profdata" LLVM_COV="xcrun llvm-cov" \
84-
${CONDA_RUN} test/run_oss_cpp_tests.sh
44+
.ci/scripts/unittest-macos.sh "${{ inputs.build-tool }}"

.github/workflows/pull.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ jobs:
367367
id-token: write
368368
contents: read
369369
with:
370+
build-tool: cmake
371+
docker-image: executorch-ubuntu-22.04-clang12
372+
373+
unittest-buck:
374+
uses: ./.github/workflows/_unittest.yml
375+
permissions:
376+
id-token: write
377+
contents: read
378+
with:
379+
build-tool: buck2
370380
docker-image: executorch-ubuntu-22.04-clang12
371381

372382
unittest-arm:

.github/workflows/trunk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ jobs:
159159
sudo sysctl fs.inotify.max_user_watches=1048576 # 1024 * 1024
160160
161161
# Test ethos-u delegate examples with run.sh
162-
backends/arm/test/test_arm_baremetal.sh test_run_ethosu_fvp
162+
backends/arm/test/test_arm_baremetal.sh test_full_ethosu_fvp
163163
164164
165165
test-arm-reference-delegation:

0 commit comments

Comments
 (0)