Skip to content

Commit d71a2a5

Browse files
authored
Merge branch 'main' into dev_lookahead
2 parents 325ab05 + c9f46e2 commit d71a2a5

File tree

339 files changed

+11480
-6373
lines changed

Some content is hidden

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

339 files changed

+11480
-6373
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
40b02a2dc61bbf901a2df91719f47c98d65368ec
1+
828ae02053a6e0e20a2dfd6e737ba10c6f4dee6b
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4d4abec80f03cd8fdefe1d9cb3a60d3690cd777e
1+
53a2908a10f414a2f85caa06703a26a40e873869

.ci/scripts/setup-samsung-linux-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -ex
1111

1212
download_ai_lite_core() {
1313
API_BASE="https://soc-developer.semiconductor.samsung.com/api/v1/resource/ai-litecore/download"
14-
API_KEY="kn10SoSY3hkC-9Qny5TqD2mnqVrlupv3krnjLeBt5cY"
14+
API_KEY=$SAMSUNG_AI_LITECORE_KEY
1515

1616
VERSION="0.5"
1717
OS_NAME="Ubuntu 22.04"

.ci/scripts/test-cuda-build.sh

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/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+
8+
set -exu
9+
10+
CUDA_VERSION=${1:-"12.6"}
11+
12+
echo "=== Testing ExecutorTorch CUDA ${CUDA_VERSION} Build ==="
13+
14+
# Function to build and test ExecutorTorch with CUDA support
15+
test_executorch_cuda_build() {
16+
local cuda_version=$1
17+
18+
echo "Building ExecutorTorch with CUDA ${cuda_version} support..."
19+
echo "ExecutorTorch will automatically detect CUDA and install appropriate PyTorch wheel"
20+
21+
# Check available resources before starting
22+
echo "=== System Information ==="
23+
echo "Available memory: $(free -h | grep Mem | awk '{print $2}')"
24+
echo "Available disk space: $(df -h . | tail -1 | awk '{print $4}')"
25+
echo "CPU cores: $(nproc)"
26+
echo "CUDA version check:"
27+
nvcc --version || echo "nvcc not found"
28+
nvidia-smi || echo "nvidia-smi not found"
29+
30+
# Set CMAKE_ARGS to enable CUDA build - ExecutorTorch will handle PyTorch installation automatically
31+
export CMAKE_ARGS="-DEXECUTORCH_BUILD_CUDA=ON"
32+
33+
echo "=== Starting ExecutorTorch Installation ==="
34+
# Install ExecutorTorch with CUDA support with timeout and error handling
35+
timeout 5400 ./install_executorch.sh || {
36+
local exit_code=$?
37+
echo "ERROR: install_executorch.sh failed with exit code: $exit_code"
38+
if [ $exit_code -eq 124 ]; then
39+
echo "ERROR: Installation timed out after 90 minutes"
40+
fi
41+
exit $exit_code
42+
}
43+
44+
echo "SUCCESS: ExecutorTorch CUDA build completed"
45+
46+
# Verify the installation
47+
echo "=== Verifying ExecutorTorch CUDA Installation ==="
48+
49+
# Test that ExecutorTorch was built successfully
50+
python -c "
51+
import executorch
52+
print('SUCCESS: ExecutorTorch imported successfully')
53+
"
54+
55+
# Test CUDA availability and show details
56+
python -c "
57+
try:
58+
import torch
59+
print('INFO: PyTorch version:', torch.__version__)
60+
print('INFO: CUDA available:', torch.cuda.is_available())
61+
62+
if torch.cuda.is_available():
63+
print('SUCCESS: CUDA is available for ExecutorTorch')
64+
print('INFO: CUDA version:', torch.version.cuda)
65+
print('INFO: GPU device count:', torch.cuda.device_count())
66+
print('INFO: Current GPU device:', torch.cuda.current_device())
67+
print('INFO: GPU device name:', torch.cuda.get_device_name())
68+
69+
# Test basic CUDA tensor operation
70+
device = torch.device('cuda')
71+
x = torch.randn(10, 10).to(device)
72+
y = torch.randn(10, 10).to(device)
73+
z = torch.mm(x, y)
74+
print('SUCCESS: CUDA tensor operation completed on device:', z.device)
75+
print('INFO: Result tensor shape:', z.shape)
76+
77+
print('SUCCESS: ExecutorTorch CUDA integration verified')
78+
else:
79+
print('WARNING: CUDA not detected, but ExecutorTorch built successfully')
80+
exit(1)
81+
except Exception as e:
82+
print('ERROR: ExecutorTorch CUDA test failed:', e)
83+
exit(1)
84+
"
85+
86+
echo "SUCCESS: ExecutorTorch CUDA ${cuda_version} build and verification completed successfully"
87+
}
88+
89+
# Main execution
90+
echo "Current working directory: $(pwd)"
91+
echo "Directory contents:"
92+
ls -la
93+
94+
# Run the CUDA build test
95+
test_executorch_cuda_build "${CUDA_VERSION}"

.ci/scripts/test_model.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ test_model_with_xnnpack() {
131131
return 0
132132
fi
133133

134-
# Delegation
134+
# Delegation and test with pybindings
135135
if [[ ${WITH_QUANTIZATION} == true ]]; then
136136
SUFFIX="q8"
137-
"${PYTHON_EXECUTABLE}" -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate --quantize
137+
"${PYTHON_EXECUTABLE}" -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate --quantize --test_after_export
138138
else
139139
SUFFIX="fp32"
140-
"${PYTHON_EXECUTABLE}" -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate
140+
"${PYTHON_EXECUTABLE}" -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate --test_after_export
141141
fi
142142

143143
OUTPUT_MODEL_PATH="${MODEL_NAME}_xnnpack_${SUFFIX}.pte"

.ci/scripts/test_wheel_package_qnn.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ run_core_tests () {
145145
echo "=== [$LABEL] Import smoke tests ==="
146146
"$PYBIN" -c "import executorch; print('executorch imported successfully')"
147147
"$PYBIN" -c "import executorch.backends.qualcomm; print('executorch.backends.qualcomm imported successfully')"
148+
"$PYBIN" -c "from executorch.export.target_recipes import get_android_recipe; recipe = get_android_recipe('android-arm64-snapdragon-fp16'); print(f'executorch.export.target_recipes imported successfully: {recipe}')"
148149

149150
echo "=== [$LABEL] List installed executorch/backends/qualcomm/python ==="
150151
local SITE_DIR

.ci/scripts/wheel/test_base.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ class ModelTest:
4141

4242

4343
def run_tests(model_tests: List[ModelTest]) -> None:
44+
# Test that we can import the portable_lib module - verifies RPATH is correct
45+
print("Testing portable_lib import...")
46+
try:
47+
from executorch.extension.pybindings._portable_lib import ( # noqa: F401
48+
_load_for_executorch,
49+
)
50+
51+
print("✓ Successfully imported _load_for_executorch from portable_lib")
52+
except ImportError as e:
53+
print(f"✗ Failed to import portable_lib: {e}")
54+
raise
55+
4456
# Why are we doing this envvar shenanigans? Since we build the testers, which
4557
# uses buck, we cannot run as root. This is a sneaky of getting around that
4658
# test.

.github/scripts/cherry_pick.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ def parse_args() -> Any:
3939
)
4040
parser.add_argument(
4141
"--classification",
42-
choices=["regression", "critical", "fixnewfeature", "docs", "release"],
42+
choices=[
43+
"regression",
44+
"critical",
45+
"fixnewfeature",
46+
"docs",
47+
"release",
48+
"examples",
49+
"testci",
50+
],
4351
required=True,
4452
help="the cherry pick category",
4553
)

.github/scripts/propose_ghstack_orig_pr.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ def get_pr_stack_from_number(ref: str, repo: Repository) -> List[int]:
8686
return pr_stack
8787

8888

89+
def get_differential_revision(pr, repo: Repository) -> str:
90+
body = repo.get_pull(pr.number).body
91+
matches = re.findall(r"Differential Revision: .*", body)
92+
count = len(matches)
93+
if count == 1:
94+
# If there's more than one Differential Revision, let's just return empty
95+
# so that we can disambiguate manually.
96+
return matches[0]
97+
return ""
98+
99+
89100
def create_prs_for_orig_branch(pr_stack: List[int], repo: Repository):
90101
# For the first PR, we want to merge to `main` branch, and we will update
91102
# as we go through the stack
@@ -100,13 +111,15 @@ def create_prs_for_orig_branch(pr_stack: List[int], repo: Repository):
100111
# The PR we want to create is then "branch_to_merge" <- gh/user/x/orig
101112
# gh/user/x/orig is the clean diff between gh/user/x/base <- gh/user/x/head
102113
orig_branch_merge_head = pr.base.ref.replace("base", "orig")
114+
differential_revision_text = get_differential_revision(pr, repo)
103115
bot_metadata = f"""This PR was created by the merge bot to help merge the original PR into the main branch.
104116
ghstack PR number: https://github.com/pytorch/executorch/pull/{pr.number} by @{pr.user.login}
105117
^ Please use this as the source of truth for the PR details, comments, and reviews
106118
ghstack PR base: https://github.com/pytorch/executorch/tree/{pr.base.ref}
107119
ghstack PR head: https://github.com/pytorch/executorch/tree/{pr.head.ref}
108120
Merge bot PR base: https://github.com/pytorch/executorch/tree/{orig_branch_merge_base}
109121
Merge bot PR head: https://github.com/pytorch/executorch/tree/{orig_branch_merge_head}
122+
{differential_revision_text}
110123
@diff-train-skip-merge"""
111124

112125
existing_orig_pr = repo.get_pulls(

.github/workflows/_android.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ jobs:
4848
bash examples/models/llama/install_requirements.sh
4949
bash ".ci/scripts/test_llama.sh" -model stories110M -build_tool cmake -dtype fp16 -mode portable -upload ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
5050
51-
mkdir -p examples/demo-apps/android/LlamaDemo/app/libs
52-
cp aar-out/executorch.aar examples/demo-apps/android/LlamaDemo/app/libs
53-
pushd examples/demo-apps/android/LlamaDemo
54-
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build assembleAndroidTest
55-
popd
56-
57-
DEMO_APP_DIR="${ARTIFACTS_DIR_NAME}/llm_demo"
58-
# The app directory is named using its build flavor as a suffix.
59-
mkdir -p "${DEMO_APP_DIR}"
60-
# Collect the app and its test suite
61-
cp examples/demo-apps/android/LlamaDemo/app/build/outputs/apk/debug/*.apk "${DEMO_APP_DIR}"
62-
cp examples/demo-apps/android/LlamaDemo/app/build/outputs/apk/androidTest/debug/*.apk "${DEMO_APP_DIR}"
63-
6451
# Running Android emulator directly on the runner and not using Docker
6552
run-emulator:
6653
needs: build-llm-demo
@@ -103,8 +90,6 @@ jobs:
10390
shell: bash
10491
run: |
10592
set -eux
106-
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug.apk
107-
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug-androidTest.apk
10893
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/fp32-xnnpack-custom/model.zip
10994
curl -o android-test-debug-androidTest.apk https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/library_test_dir/executorch_android-debug-androidTest.apk
11095
unzip model.zip

0 commit comments

Comments
 (0)