Skip to content

Commit 080a6ff

Browse files
Update base for Update on "[ExecuTorch][#10375] Add extension.BundledModule to Wrap extension.Module with Bundled Program Logic"
#10375 # Context This issue is a step of #9638. In #9638, we want to have `extension.Module` as the single source of implementation in `pybindings`, which means that `pybindings.PyModule` should use `extension.Module` rather than its own `pybindings.Module`. The issue is that `pybindings.PyModule` is dependent on the `method` getter from `pybindings.Module`, which `extension.Module` do not have. Since we don't want to expose `method` getter in `extension.Module`, we have to protect the getter, wrap the functions that is dependent on it and use the protected getter there, ultimately decouple `pybindings` from a `method` getter. # Proposal Now that we have a protected `method` getter, we can introduce a `extension.BundledModule`, a child class inheriting `extension.Module` which wraps up bundled program logic that is dependent on the `method` getter. Differential Revision: [D73564125](https://our.internmc.facebook.com/intern/diff/D73564125/) [ghstack-poisoned]
2 parents 59dce3d + df75088 commit 080a6ff

File tree

90 files changed

+1912
-525
lines changed

Some content is hidden

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

90 files changed

+1912
-525
lines changed

.ci/scripts/check_c10_sync.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 -eux
9+
ls pytorch/.git || git clone https://github.com/pytorch/pytorch.git
10+
pytorch_pin="$(< .ci/docker/ci_commit_pins/pytorch.txt)"
11+
pushd pytorch
12+
git checkout "$pytorch_pin"
13+
popd
14+
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10

.ci/scripts/compare_dirs.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 -eux
9+
10+
# Check if dir1's files are also found in dir2 with the same
11+
# contents. Exempt files named BUCK, CMakeLists.txt, TARGETS, or
12+
# targets.bzl.
13+
14+
if [ $# -ne 2 ]; then
15+
echo "Usage: $0 dir1 dir2" >&2
16+
exit 1
17+
fi
18+
dir1="$1"
19+
dir2="$2"
20+
21+
if [ ! -d "$dir1" ] || [ ! -d "$dir2" ]; then
22+
echo "Error: Both directories must exist" >&2
23+
exit 1
24+
fi
25+
26+
exit_status=0
27+
while IFS= read -r -d '' file; do
28+
base=$(basename "$file")
29+
case "$base" in
30+
"BUCK"|"CMakeLists.txt"|"TARGETS"|"targets.bzl")
31+
continue
32+
;;
33+
esac
34+
# Construct the corresponding path in the second directory
35+
file2="$dir2/${file#$dir1/}"
36+
# Check if the corresponding file exists in the second directory
37+
if [ ! -f "$file2" ]; then
38+
echo "Error: File '$file' found in '$dir1' but not found in '$dir2'" >&2
39+
exit 1
40+
fi
41+
# Compare the contents of the two files using diff
42+
set +ex
43+
differences=$(diff -u -p "$file" "$file2")
44+
set -e # leave x off
45+
# If there are any differences, print an error message and exit with failure status
46+
if [ -n "$differences" ]; then
47+
echo "Error: Mismatch detected in file '$file':" >&2
48+
echo "$differences" >&2
49+
exit_status=1
50+
fi
51+
set -x
52+
done < <(find "$dir1" -type f -print0)
53+
54+
exit $exit_status

.github/workflows/_unittest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
runner: linux.2xlarge
3535
docker-image: ${{ inputs.docker-image }}
36-
submodules: 'true'
36+
submodules: 'recursive'
3737
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
3838
timeout: 90
3939
script: |
@@ -45,7 +45,7 @@ jobs:
4545
with:
4646
runner: macos-m1-stable
4747
python-version: '3.11'
48-
submodules: 'true'
48+
submodules: 'recursive'
4949
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
5050
script: |
5151
set -eux

.github/workflows/android-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
with:
168168
runner: linux.2xlarge.memory
169169
docker-image: executorch-ubuntu-22.04-qnn-sdk
170-
submodules: 'true'
170+
submodules: 'recursive'
171171
timeout: 60
172172
upload-artifact: android-models
173173
upload-artifact-to-s3: true

.github/workflows/apple-perf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
# NB: Need to use our AWS MacOS runner to upload large models to S3
168168
runner: macos-m1-stable
169169
python-version: '3.11'
170-
submodules: 'true'
170+
submodules: 'recursive'
171171
timeout: 60
172172
upload-artifact: ios-models
173173
upload-artifact-to-s3: true

.github/workflows/check-c10-sync.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: check-c10-sync
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .ci/docker/ci_commit_pins/pytorch.txt
7+
- .ci/scripts/compare_dirs.sh
8+
- runtime/core/portable_type/c10/**
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
check-c10-sync:
16+
permissions:
17+
id-token: write
18+
contents: read
19+
name: check-c10-sync
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
- name: Clone PyTorch
26+
run: |
27+
.ci/scripts/check_c10_sync.sh

.github/workflows/doc-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
job-name: Build doc
4242
runner: linux.2xlarge
4343
docker-image: executorch-ubuntu-22.04-clang12-android
44-
submodules: 'true'
44+
submodules: 'recursive'
4545
repository: pytorch/executorch
4646
upload-artifact: docs
4747
timeout: 90

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
runner: linux.2xlarge
2525
docker-image: executorch-ubuntu-22.04-linter
26-
submodules: 'true'
26+
submodules: 'recursive'
2727
fetch-depth: 0
2828
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
2929
timeout: 90

.github/workflows/periodic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
with:
5151
runner: ${{ matrix.runner }}
5252
docker-image: executorch-ubuntu-22.04-clang12
53-
submodules: 'true'
53+
submodules: 'recursive'
5454
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
5555
timeout: ${{ matrix.timeout }}
5656
script: |

.github/workflows/pull.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
runner: linux.2xlarge
2626
docker-image: executorch-ubuntu-22.04-gcc9
27-
submodules: 'true'
27+
submodules: 'recursive'
2828
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
2929
timeout: 90
3030
script: |
@@ -66,7 +66,7 @@ jobs:
6666
with:
6767
runner: ${{ matrix.runner }}
6868
docker-image: ${{ matrix.docker-image }}
69-
submodules: 'true'
69+
submodules: 'recursive'
7070
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
7171
timeout: 90
7272
script: |
@@ -119,7 +119,7 @@ jobs:
119119
with:
120120
runner: ${{ matrix.runner }}
121121
docker-image: executorch-ubuntu-22.04-clang12
122-
submodules: 'true'
122+
submodules: 'recursive'
123123
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
124124
timeout: 90
125125
script: |
@@ -165,7 +165,7 @@ jobs:
165165
with:
166166
runner: ${{ matrix.runner }}
167167
docker-image: ${{ matrix.docker-image }}
168-
submodules: 'true'
168+
submodules: 'recursive'
169169
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
170170
timeout: 900
171171
script: |
@@ -197,7 +197,7 @@ jobs:
197197
with:
198198
runner: linux.2xlarge
199199
docker-image: executorch-ubuntu-22.04-clang12-android
200-
submodules: 'true'
200+
submodules: 'recursive'
201201
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
202202
timeout: 90
203203
script: |
@@ -222,7 +222,7 @@ jobs:
222222
with:
223223
runner: linux.2xlarge
224224
docker-image: executorch-ubuntu-22.04-clang12
225-
submodules: 'true'
225+
submodules: 'recursive'
226226
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
227227
timeout: 90
228228
script: |
@@ -246,7 +246,7 @@ jobs:
246246
with:
247247
runner: linux.2xlarge
248248
docker-image: executorch-ubuntu-22.04-clang12
249-
submodules: 'true'
249+
submodules: 'recursive'
250250
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
251251
timeout: 90
252252
script: |
@@ -270,7 +270,7 @@ jobs:
270270
with:
271271
runner: linux.24xlarge
272272
docker-image: executorch-ubuntu-22.04-clang12
273-
submodules: 'true'
273+
submodules: 'recursive'
274274
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
275275
timeout: 90
276276
script: |
@@ -301,7 +301,7 @@ jobs:
301301
with:
302302
runner: linux.2xlarge
303303
docker-image: executorch-ubuntu-22.04-clang12
304-
submodules: 'true'
304+
submodules: 'recursive'
305305
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
306306
timeout: 90
307307
script: |
@@ -331,7 +331,7 @@ jobs:
331331
with:
332332
runner: linux.2xlarge
333333
docker-image: executorch-ubuntu-22.04-clang12
334-
submodules: 'true'
334+
submodules: 'recursive'
335335
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
336336
timeout: 90
337337
script: |
@@ -354,7 +354,7 @@ jobs:
354354
with:
355355
runner: linux.2xlarge
356356
docker-image: executorch-ubuntu-22.04-clang12
357-
submodules: 'true'
357+
submodules: 'recursive'
358358
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
359359
timeout: 90
360360
script: |
@@ -382,7 +382,7 @@ jobs:
382382
with:
383383
runner: linux.2xlarge
384384
docker-image: executorch-ubuntu-22.04-gcc9
385-
submodules: 'true'
385+
submodules: 'recursive'
386386
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
387387
timeout: 90
388388
script: |
@@ -418,7 +418,7 @@ jobs:
418418
with:
419419
runner: linux.2xlarge
420420
docker-image: executorch-ubuntu-22.04-clang12
421-
submodules: 'true'
421+
submodules: 'recursive'
422422
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
423423
timeout: 90
424424
script: |
@@ -489,7 +489,7 @@ jobs:
489489
with:
490490
runner: linux.2xlarge
491491
docker-image: executorch-ubuntu-22.04-arm-sdk
492-
submodules: 'true'
492+
submodules: 'recursive'
493493
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
494494
timeout: 90
495495
script: |
@@ -528,7 +528,7 @@ jobs:
528528
with:
529529
runner: linux.2xlarge
530530
docker-image: executorch-ubuntu-22.04-qnn-sdk
531-
submodules: 'true'
531+
submodules: 'recursive'
532532
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
533533
timeout: 900
534534
script: |
@@ -563,7 +563,7 @@ jobs:
563563
with:
564564
runner: linux.2xlarge
565565
docker-image: executorch-ubuntu-22.04-qnn-sdk
566-
submodules: 'true'
566+
submodules: 'recursive'
567567
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
568568
timeout: 180
569569
script: |
@@ -596,7 +596,7 @@ jobs:
596596
with:
597597
runner: linux.2xlarge
598598
docker-image: executorch-ubuntu-22.04-qnn-sdk
599-
submodules: 'true'
599+
submodules: 'recursive'
600600
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
601601
timeout: 180
602602
script: |
@@ -618,7 +618,7 @@ jobs:
618618
with:
619619
runner: linux.24xlarge
620620
docker-image: executorch-ubuntu-22.04-clang12
621-
submodules: 'true'
621+
submodules: 'recursive'
622622
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
623623
timeout: 90
624624
script: |
@@ -645,7 +645,7 @@ jobs:
645645
with:
646646
runner: linux.24xlarge
647647
docker-image: executorch-ubuntu-22.04-clang12
648-
submodules: 'true'
648+
submodules: 'recursive'
649649
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
650650
timeout: 90
651651
script: |
@@ -672,7 +672,7 @@ jobs:
672672
with:
673673
runner: linux.24xlarge
674674
docker-image: executorch-ubuntu-22.04-clang12
675-
submodules: 'true'
675+
submodules: 'recursive'
676676
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
677677
timeout: 90
678678
script: |
@@ -699,7 +699,7 @@ jobs:
699699
with:
700700
runner: linux.24xlarge
701701
docker-image: executorch-ubuntu-22.04-clang12
702-
submodules: 'true'
702+
submodules: 'recursive'
703703
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
704704
timeout: 90
705705
script: |
@@ -726,7 +726,7 @@ jobs:
726726
with:
727727
runner: linux.24xlarge
728728
docker-image: executorch-ubuntu-22.04-mediatek-sdk
729-
submodules: 'true'
729+
submodules: 'recursive'
730730
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
731731
timeout: 90
732732
script: |
@@ -747,7 +747,7 @@ jobs:
747747
with:
748748
runner: linux.2xlarge
749749
docker-image: executorch-ubuntu-22.04-gcc9
750-
submodules: 'true'
750+
submodules: 'recursive'
751751
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
752752
timeout: 90
753753
script: |

0 commit comments

Comments
 (0)