Skip to content

Commit 88f36f7

Browse files
committed
Update on "[ET-VK] Adding repeat support to add_copy_packed_dim_offset_node function."
This diff adds support for the repeat operation in `add_copy_packed_dim_offset_node` function in the Vulkan backend for Executorch. The function now takes an additional boolean parameter, "repeat", which indicates whether the copy should wrap around the tensor dimension. `copy_packed_dim_offset` shader now has 2 functions `repeat_copy` and `no_repeat_copy` which are chosen based on specialization constant parameter. `no_repeat_copy` function has the legacy copy code. `repeat_copy` function reads input tensor's dim based on output pos and wraps it according to WHCB repetitions. Push constants `src_offset` and `dst_offset` contains source and destination's WHCB dimensions (and not copy offsets) respectively, when calling repeat function. Differential Revision: [D71477552](https://our.internmc.facebook.com/intern/diff/D71477552/) [ghstack-poisoned]
2 parents 1d4b9b9 + d77c83c commit 88f36f7

File tree

125 files changed

+546
-1564
lines changed

Some content is hidden

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

125 files changed

+546
-1564
lines changed

.ci/docker/ci_commit_pins/pytorch.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
295f2ed4d103017f7e19a7b8263ece606cd629db
1+
7ae0ce6360b6e4f944906502d20da24c04debee5

.ci/scripts/unittest-linux.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ if [[ "$BUILD_TOOL" == "cmake" ]]; then
2121
source .ci/scripts/setup-vulkan-linux-deps.sh
2222

2323
PYTHON_EXECUTABLE=python \
24-
EXECUTORCH_BUILD_PYBIND=ON \
25-
CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
24+
CMAKE_ARGS="-DEXECUTORCH_BUILD_PYBIND=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
2625
.ci/scripts/setup-linux.sh "$@"
2726

2827
# Install llama3_2_vision dependencies.

.ci/scripts/unittest-macos.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ trap 'rm -rfv ${TMP_DIR}' EXIT
2121

2222
# Setup MacOS dependencies as there is no Docker support on MacOS atm
2323
PYTHON_EXECUTABLE=python \
24-
EXECUTORCH_BUILD_PYBIND=ON \
25-
CMAKE_ARGS="-DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
24+
CMAKE_ARGS="-DEXECUTORCH_BUILD_PYBIND=ON -DEXECUTORCH_BUILD_COREML=ON -DEXECUTORCH_BUILD_MPS=ON -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON" \
2625
${CONDA_RUN} --no-capture-output \
2726
.ci/scripts/setup-macos.sh "$@"
2827

.ci/scripts/wheel/envvar_base.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
# should typically only contain shell variable assignments. Be sure to export
99
# any variables so that subprocesses will see them.
1010

11-
# Enable pybindings so that users can execute ExecuTorch programs from python.
12-
export EXECUTORCH_BUILD_PYBIND=1
13-
1411
# Ensure that CMAKE_ARGS is defined before referencing it. Defaults to empty
1512
# if not defined.
1613
export CMAKE_ARGS="${CMAKE_ARGS:-}"
1714

1815
# Link the XNNPACK backend into the pybindings runtime so that users can execute
1916
# ExecuTorch programs that delegate to it.
20-
CMAKE_ARGS="${CMAKE_ARGS} -DEXECUTORCH_BUILD_XNNPACK=ON"
17+
CMAKE_ARGS="${CMAKE_ARGS} -DEXECUTORCH_BUILD_PYBIND=ON -DEXECUTORCH_BUILD_XNNPACK=ON"

.github/workflows/pull.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ jobs:
365365
# build module for executorch.extension.pybindings.portable_lib
366366
BUILD_TOOL="cmake"
367367
PYTHON_EXECUTABLE=python \
368-
EXECUTORCH_BUILD_XNNPACK=ON \
369-
EXECUTORCH_BUILD_PYBIND=ON \
368+
CMAKE_ARGS="-DEXECUTORCH_BUILD_PYBIND=ON -DEXECUTORCH_BUILD_XNNPACK=ON" \
370369
bash .ci/scripts/setup-linux.sh --build-tool "${BUILD_TOOL}"
371370
372371
# see if we can import the module successfully
@@ -504,7 +503,7 @@ jobs:
504503
505504
# Setup MacOS dependencies as there is no Docker support on MacOS atm
506505
PYTHON_EXECUTABLE=python \
507-
EXECUTORCH_BUILD_PYBIND=ON \
506+
CMAKE_ARGS="-DEXECUTORCH_BUILD_PYBIND=ON" \
508507
EXECUTORCH_BUILD_ARM_BAREMETAL=ON \
509508
.ci/scripts/setup-linux.sh --build-tool "${BUILD_TOOL}"
510509

.github/workflows/trunk.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ jobs:
261261
262262
# build module for executorch.extension.pybindings.portable_lib
263263
BUILD_TOOL=${{ matrix.build-tool }}
264-
EXECUTORCH_BUILD_PYBIND=ON PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh --build-tool "${BUILD_TOOL}"
264+
CMAKE_ARGS="-DEXECUTORCH_BUILD_PYBIND=ON" PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh --build-tool "${BUILD_TOOL}"
265265
266266
# see if we can import the module successfully
267267
${CONDA_RUN} python -c "from executorch.extension.pybindings import portable_lib; print('success!')"
@@ -536,9 +536,8 @@ jobs:
536536
git clone https://github.com/huggingface/optimum-executorch
537537
cd optimum-executorch
538538
# There is no release yet, for CI stability, always test from the same commit on main
539-
git checkout 6a7e83f3eee2976fa809335bfb78a45b1ea1cb25
540-
pip install .
541-
pip install accelerate sentencepiece
539+
git checkout 1907349524b5f2d61f9c04d2e985da826d4308ba
540+
pip install .[tests]
542541
pip list
543542
echo "::endgroup::"
544543

Package.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,24 @@ let package = Package(
8282
(value["libraries"] as? [String] ?? []).map { .linkedLibrary($0) }
8383
),
8484
]
85-
}
85+
} + [
86+
.testTarget(
87+
name: "tests",
88+
dependencies: [
89+
.target(name: "executorch_debug"),
90+
.target(name: "kernels_portable"),
91+
],
92+
path: "extension/apple/ExecuTorch/__tests__",
93+
resources: [
94+
.copy("resources/add.pte")
95+
],
96+
linkerSettings: [
97+
.linkedLibrary("c++"),
98+
.unsafeFlags([
99+
"-Xlinker", "-force_load",
100+
"-Xlinker", "cmake-out/kernels_portable.xcframework/macos-arm64/libkernels_portable_macos.a",
101+
])
102+
]
103+
)
104+
]
86105
)

backends/apple/coreml/runtime/delegate/ETCoreMLModelManager.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void set_outputs(std::vector<executorchcoreml::MultiArray>& outputs,
208208
const inmemoryfs::InMemoryFileSystem *inmemory_fs,
209209
NSError * __autoreleasing *error) {
210210
NSError *local_error = nil;
211-
if (![fm createDirectoryAtURL:dst_url withIntermediateDirectories:NO attributes:@{} error:error]) {
211+
if (![fm createDirectoryAtURL:dst_url withIntermediateDirectories:YES attributes:@{} error:error]) {
212212
ETCoreMLLogUnderlyingErrorAndSetNSError(error,
213213
ETCoreMLErrorModelSaveFailed,
214214
local_error,

backends/xnnpack/test/models/deeplab_v3.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def forward(self, *args):
2323

2424

2525
class TestDeepLabV3(unittest.TestCase):
26+
def setUp(self):
27+
torch._dynamo.reset()
28+
2629
dl3 = DL3Wrapper()
2730
dl3 = dl3.eval()
2831
model_inputs = (torch.randn(1, 3, 224, 224),)

backends/xnnpack/test/models/edsr.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515

1616
class TestEDSR(unittest.TestCase):
17+
def setUp(self):
18+
torch._dynamo.reset()
19+
1720
edsr = edsr_r16f64(2, False).eval() # noqa
1821
model_inputs = (torch.randn(1, 3, 224, 224),)
1922

0 commit comments

Comments
 (0)