Skip to content

Commit a8ae6c1

Browse files
committed
Update base for Update on "Use unlifted export pass to tag delegated constants"
Use the unlifted pass to tag constants for delegates. Implications: - Tagging must happen on the unlifted ep.module(), before going into to_edge_transform_and_lower/to_edge. Why? - The unlifted graph contains constants in getattr nodes, which is a convenient way to isolate constants. - After going into to_edge_transform_and_lower/to_edge, transforms happen on the graph_module, which is lifted. - The lifted graph requires the ep graph signature to differentiate constants via the `is_param` function. However, in to_edge.transform, we do not have access to the ep. Baking the ep as an argument via partial function doesn't work, as the ep from earlier may be outdated. This means we are comparing an older ep to a newer graph_module, which may not have corresponding graph signatures etc. Differential Revision: [D79736684](https://our.internmc.facebook.com/intern/diff/D79736684/) [ghstack-poisoned]
2 parents 7f5efa1 + b36d6b6 commit a8ae6c1

File tree

254 files changed

+8897
-1770
lines changed

Some content is hidden

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

254 files changed

+8897
-1770
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ install_swiftshader() {
2323

2424
export VK_ICD_FILENAMES="${_swiftshader_dir}/swiftshader/build/Linux/vk_swiftshader_icd.json"
2525
export LD_LIBRARY_PATH="${_swiftshader_dir}/swiftshader/build/Linux/"
26+
export ETVK_USING_SWIFTSHADER=1
2627
}
2728

2829
install_vulkan_sdk() {

.github/workflows/build-presets.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ on:
66
branches:
77
- main
88
- release/*
9-
paths:
10-
- .github/workflows/build-presets.yml
119
workflow_dispatch:
1210

1311
concurrency:

.github/workflows/pull.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ jobs:
801801
id-token: write
802802
contents: read
803803
strategy:
804+
matrix:
805+
enable-etdump: ['', '--enable-etdump']
804806
fail-fast: false
805807
with:
806808
runner: linux.2xlarge
@@ -820,7 +822,7 @@ jobs:
820822
source .ci/scripts/setup-emscripten.sh
821823
822824
# Test selective build
823-
bash scripts/build_wasm_tests.sh
825+
bash scripts/build_wasm_tests.sh ${{ matrix.enable-etdump }}
824826
825827
# Install Jest
826828
cd cmake-out-wasm/extension/wasm/test
@@ -862,6 +864,43 @@ jobs:
862864
PYTHON_EXECUTABLE=python bash examples/nxp/run_aot_example.sh
863865
864866
867+
test-vulkan-models-linux:
868+
name: test-vulkan-models-linux
869+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
870+
permissions:
871+
id-token: write
872+
contents: read
873+
with:
874+
runner: linux.2xlarge
875+
docker-image: ci-image:executorch-ubuntu-22.04-clang12
876+
submodules: 'recursive'
877+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
878+
timeout: 90
879+
script: |
880+
set -eux
881+
882+
# The generic Linux job chooses to use base env, not the one setup by the image
883+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
884+
conda activate "${CONDA_ENV}"
885+
886+
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
887+
source .ci/scripts/setup-vulkan-linux-deps.sh
888+
889+
# Setup python
890+
PYTHON_EXECUTABLE=python \
891+
CMAKE_ARGS="-DEXECUTORCH_BUILD_VULKAN=ON" \
892+
.ci/scripts/setup-linux.sh --build-tool "cmake"
893+
894+
PYTHON_EXECUTABLE=python bash backends/vulkan/test/scripts/test_model.sh --build
895+
896+
# Test models serially
897+
models="mv2 mv3 edsr resnet18 resnet50 dl3"
898+
for model in $models; do
899+
python -m examples.vulkan.export --model_name=$model --test
900+
done
901+
902+
903+
865904
nxp-build-test:
866905
name: nxp-build-test
867906
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main

.github/workflows/trunk.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ jobs:
288288
- test_arm_baremetal: test_models_tosa
289289
- test_arm_baremetal: test_models_ethos-u55
290290
- test_arm_baremetal: test_models_ethos-u85
291+
- test_arm_baremetal: test_smaller_stories_llama
291292
fail-fast: false
292293
with:
293294
runner: linux.2xlarge.memory

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pip-out/
2424
# Any exported models and profiling outputs
2525
*.bin
2626
*.model
27+
*.etdump
2728
tokenizer.json
2829
*.pte
2930
*.ptd
@@ -58,6 +59,7 @@ xcuserdata/
5859
/include/
5960
/share/
6061
/version.py
62+
*.csv
6163

6264
# Android
6365
*.aar

.lintrunner.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,36 @@ init_command = [
136136
'--requirement=requirements-lintrunner.txt',
137137
]
138138

139+
[[linter]]
140+
code = 'CMAKEFORMAT'
141+
include_patterns = [
142+
"**/*.cmake",
143+
"**/*.cmake.in",
144+
"**/CMakeLists.txt",
145+
]
146+
exclude_patterns = [
147+
'third-party/**',
148+
'**/third-party/**',
149+
]
150+
command = [
151+
'python',
152+
'-m',
153+
'lintrunner_adapters',
154+
'run',
155+
'cmake_format_linter',
156+
'--',
157+
'@{{PATHSFILE}}',
158+
]
159+
init_command = [
160+
'python',
161+
'-m',
162+
'lintrunner_adapters',
163+
'run',
164+
'pip_init',
165+
'--dry-run={{DRYRUN}}',
166+
'--requirement=requirements-lintrunner.txt',
167+
]
168+
139169
[[linter]]
140170
code = 'ETCAPITAL'
141171
include_patterns = [

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,19 @@ if(EXECUTORCH_BUILD_KERNELS_TORCHAO)
284284
set(TORCHAO_BUILD_CPU_AARCH64 ON)
285285
set(TORCHAO_ENABLE_ARM_NEON_DOT ON)
286286

287-
list(APPEND TORCHAO_INCLUDE_DIRS
287+
list(
288+
APPEND
289+
TORCHAO_INCLUDE_DIRS
288290
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/pthreadpool/include
289291
${EXECUTORCH_ROOT}/backends/xnnpack/third-party/cpuinfo/include
290292
${EXECUTORCH_ROOT}/third-party/ao
291293
)
292294

293295
set(EXECUTORCH_INCLUDE_DIRS ${TORCHAO_INCLUDE_DIRS})
294296

295-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/ao/torchao/experimental)
297+
add_subdirectory(
298+
${CMAKE_CURRENT_SOURCE_DIR}/third-party/ao/torchao/experimental
299+
)
296300
executorch_target_link_options_shared_lib(torchao_ops_executorch)
297301
list(APPEND _executorch_kernels torchao_ops_executorch)
298302
endif()
@@ -759,6 +763,10 @@ if(EXECUTORCH_BUILD_PYBIND)
759763
list(APPEND _dep_libs xnnpack_backend XNNPACK xnnpack-microkernels-prod)
760764
endif()
761765

766+
if(EXECUTORCH_BUILD_VULKAN)
767+
list(APPEND _dep_libs vulkan_backend)
768+
endif()
769+
762770
# compile options for pybind
763771
set(_pybind_compile_options -Wno-deprecated-declarations -fPIC -frtti
764772
-fexceptions

backends/apple/coreml/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ runtime.python_test(
120120
"test/*.py",
121121
]),
122122
deps = [
123+
"fbsource//third-party/pypi/coremltools:coremltools",
123124
"fbsource//third-party/pypi/pytest:pytest",
124125
":partitioner",
125126
":quantizer",

0 commit comments

Comments
 (0)