Skip to content

Commit 64b25c8

Browse files
authored
Merge branch 'main' into vgf_ethosu_docs
2 parents c683f3f + 131d1f4 commit 64b25c8

File tree

240 files changed

+8408
-3402
lines changed

Some content is hidden

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

240 files changed

+8408
-3402
lines changed

.ci/scripts/test_backend.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,25 @@ if [[ "$FLOW" == *vulkan* ]]; then
5757
fi
5858

5959
if [[ "$FLOW" == *arm* ]]; then
60+
6061
# Setup ARM deps.
61-
.ci/scripts/setup-arm-baremetal-tools.sh
62+
if [[ "$FLOW" == *vgf* ]]; then
63+
.ci/scripts/setup-arm-baremetal-tools.sh --enable-mlsdk-deps --install-mlsdk-deps-with-pip
64+
else
65+
.ci/scripts/setup-arm-baremetal-tools.sh
66+
fi
6267
source examples/arm/ethos-u-scratch/setup_path.sh
6368

6469
if [[ "$FLOW" == *ethos_u* ]]; then
6570
# Prepare a test runner binary that can run on the Corstone-3x0 FVPs
6671
backends/arm/scripts/build_executorch.sh
6772
backends/arm/test/setup_testing.sh
6873
fi
74+
75+
if [[ "$FLOW" == *vgf* ]]; then
76+
# Prepare a test runner binary for VKML runtime
77+
backends/arm/test/setup_testing_vkml.sh
78+
fi
6979
fi
7080

7181
if [[ $IS_MACOS -eq 1 ]]; then

.ci/scripts/test_model_e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ case "$MODEL_NAME" in
181181
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/$TOKENIZER_FILE --audio_path ${MODEL_DIR}/$AUDIO_FILE --processor_path ${MODEL_DIR}/$PREPROCESSOR"
182182
;;
183183
whisper-*)
184-
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/ --audio_path ${MODEL_DIR}/$AUDIO_FILE --processor_path ${MODEL_DIR}/$PREPROCESSOR --model_name ${MODEL_NAME}"
184+
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/ --audio_path ${MODEL_DIR}/$AUDIO_FILE --processor_path ${MODEL_DIR}/$PREPROCESSOR"
185185
;;
186186
gemma3)
187187
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/ --image_path $IMAGE_PATH"

.ci/scripts/utils.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ dedupe_macos_loader_path_rpaths() {
8484

8585
install_domains() {
8686
echo "Install torchvision and torchaudio"
87-
pip install --no-use-pep517 --user "git+https://github.com/pytorch/audio.git@${TORCHAUDIO_VERSION}"
88-
pip install --no-use-pep517 --user "git+https://github.com/pytorch/vision.git@${TORCHVISION_VERSION}"
87+
pip install --no-build-isolation --user "git+https://github.com/pytorch/audio.git@${TORCHAUDIO_VERSION}"
88+
pip install --no-build-isolation --user "git+https://github.com/pytorch/vision.git@${TORCHVISION_VERSION}"
8989
}
9090

9191
install_pytorch_and_domains() {

.github/workflows/cuda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
strategy:
7272
fail-fast: false
7373
matrix:
74-
model: [linear, add, add_mul, resnet18, conv1d]
74+
model: [linear, add, add_mul, resnet18, conv1d, sdpa]
7575
with:
7676
timeout: 90
7777
runner: linux.g5.4xlarge.nvidia.gpu

.github/workflows/test-backend-arm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: ./.github/workflows/_test_backend.yml
2727
with:
2828
backend: arm
29-
flows: '["arm_tosa_fp", "arm_tosa_int", "arm_ethos_u55", "arm_ethos_u85"]'
29+
flows: '["arm_tosa_fp", "arm_tosa_int", "arm_ethos_u55", "arm_ethos_u85", "arm_vgf_fp", "arm_vgf_int"]'
3030
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
3131
timeout: 120
3232
run-linux: true

.github/workflows/trunk.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,40 @@ jobs:
317317
# Test test_arm_baremetal.sh with test
318318
backends/arm/test/test_arm_baremetal.sh "${ARM_TEST}"
319319
320+
test-arm-backend-vkml:
321+
name: test-arm-backend-vkml
322+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
323+
permissions:
324+
id-token: write
325+
contents: read
326+
strategy:
327+
matrix:
328+
include:
329+
- test_arm_baremetal: test_pytest_ops_vkml
330+
fail-fast: false
331+
with:
332+
runner: linux.2xlarge.memory
333+
docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk
334+
submodules: 'recursive'
335+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
336+
timeout: 120
337+
script: |
338+
# The generic Linux job chooses to use base env, not the one setup by the image
339+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
340+
conda activate "${CONDA_ENV}"
341+
source .ci/scripts/utils.sh
342+
install_executorch "--use-pt-pinned-commit"
343+
344+
.ci/scripts/setup-arm-baremetal-tools.sh --disable-ethos-u-deps --enable-mlsdk-deps --install-mlsdk-deps-with-pip
345+
346+
# Increase number of files user can monitor to bypass buck failures.
347+
# Hopefully this is high enough for this setup.
348+
sudo sysctl fs.inotify.max_user_watches=1048576 # 1024 * 1024
349+
350+
ARM_TEST=${{ matrix.test_arm_baremetal }}
351+
352+
backends/arm/test/test_arm_baremetal.sh "${ARM_TEST}"
353+
320354
test-arm-cortex-m-size-test:
321355
name: test-arm-cortex-m-size-test
322356
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main

CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,9 @@ if(EXECUTORCH_BUILD_PYBIND)
801801
torch
802802
)
803803

804+
# RPATH for _portable_lib.so
805+
set(_portable_lib_rpath "$ORIGIN/../../../torch/lib")
806+
804807
if(EXECUTORCH_BUILD_EXTENSION_MODULE)
805808
# Always use static linking for pybindings to avoid runtime symbol
806809
# resolution issues
@@ -835,6 +838,7 @@ if(EXECUTORCH_BUILD_PYBIND)
835838

836839
if(EXECUTORCH_BUILD_QNN)
837840
list(APPEND _dep_libs qnn_executorch_backend)
841+
string(APPEND _portable_lib_rpath ":$ORIGIN/../../backends/qualcomm")
838842
endif()
839843

840844
if(EXECUTORCH_BUILD_ENN)
@@ -886,19 +890,20 @@ if(EXECUTORCH_BUILD_PYBIND)
886890
target_compile_options(portable_lib PUBLIC ${_pybind_compile_options})
887891
target_link_libraries(portable_lib PRIVATE ${_dep_libs})
888892

889-
# Set RPATH to find PyTorch libraries relative to the installation location
890-
# This goes from executorch/extension/pybindings up to site-packages, then to
891-
# torch/lib. Don't do this to APPLE, as it will error out on the following
892-
# error:
893+
# Set RPATH to find PyTorch and backend libraries relative to the installation
894+
# location. This goes from executorch/extension/pybindings up to
895+
# site-packages, then to torch/lib. If QNN is enabled, also add
896+
# backends/qualcomm/. Don't do this to APPLE, as it will error out on the
897+
# following error:
893898
#
894899
if(APPLE)
895900
# Skip setting @loader_path for APPLE, since it causes error like ld:
896901
# duplicate LC_RPATH '@loader_path' in '<site-packages>/torch/lib/
897902
# libtorch_cpu.dylib'
898903
else()
899904
set_target_properties(
900-
portable_lib PROPERTIES BUILD_RPATH "$ORIGIN/../../../torch/lib"
901-
INSTALL_RPATH "$ORIGIN/../../../torch/lib"
905+
portable_lib PROPERTIES BUILD_RPATH "${_portable_lib_rpath}"
906+
INSTALL_RPATH "${_portable_lib_rpath}"
902907
)
903908
endif()
904909

backends/aoti/aoti_partitioner.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,24 @@ def partition(self, exported_program: ExportedProgram) -> PartitionResult:
5252
partition_tags: Dict[str, DelegationSpec] = {}
5353
tag = "tag0"
5454

55+
# Tag torch.cond and other control flow operations
56+
def is_control_flow(node: torch.fx.Node) -> bool:
57+
return node.op == "call_function" and node.target in [
58+
torch.ops.higher_order.cond,
59+
torch.ops.higher_order.map_impl,
60+
torch.ops.higher_order.while_loop,
61+
]
62+
5563
for node in exported_program.graph.nodes:
56-
if node.op != "call_function":
57-
continue
58-
node.meta["delegation_tag"] = tag
64+
if node.op == "call_function":
65+
node.meta["delegation_tag"] = tag
66+
# Tag get_attr nodes that are used by control flow operations
67+
elif node.op == "get_attr":
68+
# Check if any user is a control flow operation
69+
for user in node.users:
70+
if is_control_flow(user):
71+
node.meta["delegation_tag"] = tag
72+
break
5973

6074
partition_tags[tag] = self.delegation_spec
6175

backends/aoti/common_shims.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,6 @@ aoti_torch_clone(Tensor* self, Tensor** ret_new_tensor) {
238238
return Error::Internal;
239239
}
240240

241-
AOTI_SHIM_EXPORT AOTITorchError
242-
aoti_torch_new_tensor_handle(Tensor* orig_handle, Tensor** new_handle) {
243-
(void)orig_handle;
244-
(void)new_handle;
245-
throw std::runtime_error("Not implemented");
246-
return Error::Internal;
247-
}
248-
249241
AOTI_SHIM_EXPORT AOTITorchError aoti_torch_create_tensor_from_blob(
250242
void* data_ptr,
251243
int64_t ndim,

backends/aoti/common_shims.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ aoti_torch_clone_preserve_strides(Tensor* self, Tensor** ret_new_tensor);
9494
AOTI_SHIM_EXPORT AOTITorchError
9595
aoti_torch_clone(Tensor* self, Tensor** ret_new_tensor);
9696

97-
AOTI_SHIM_EXPORT AOTITorchError
98-
aoti_torch_new_tensor_handle(Tensor* orig_handle, Tensor** new_handle);
99-
10097
AOTI_SHIM_EXPORT AOTITorchError aoti_torch_create_tensor_from_blob(
10198
void* data_ptr,
10299
int64_t ndim,

0 commit comments

Comments
 (0)