Skip to content

Commit 77ca13c

Browse files
committed
Update base for Update on "Introduce public MergedDataMap"
Add public merged data map. Module can use this to resolve multiple named data maps. Differential Revision: [D83527299](https://our.internmc.facebook.com/intern/diff/D83527299/) [ghstack-poisoned]
2 parents 23bed28 + 815ae92 commit 77ca13c

File tree

15 files changed

+87
-54
lines changed

15 files changed

+87
-54
lines changed

.ci/scripts/setup-openvino.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ set -ex
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
git clone https://github.com/openvinotoolkit/openvino.git
14-
cd openvino && git checkout releases/2025/1
15-
git submodule update --init --recursive
16-
sudo ./install_build_dependencies.sh
17-
mkdir build && cd build
18-
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
19-
make -j$(nproc)
13+
# Download and install OpenVINO from release packages
14+
OPENVINO_VERSION="2025.3"
15+
OPENVINO_BUILD="2025.3.0.19807.44526285f24"
16+
OPENVINO_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages/${OPENVINO_VERSION}/linux/openvino_toolkit_ubuntu22_${OPENVINO_BUILD}_x86_64.tgz"
2017

21-
cd ..
22-
cmake --install build --prefix dist
18+
curl -Lo /tmp/openvino_toolkit.tgz --retry 3 --fail ${OPENVINO_URL}
19+
tar -xzf /tmp/openvino_toolkit.tgz
20+
mv openvino_toolkit_ubuntu22_${OPENVINO_BUILD}_x86_64 openvino
2321

24-
source dist/setupvars.sh
25-
cd ../backends/openvino
22+
source openvino/setupvars.sh
23+
cd backends/openvino
2624
pip install -r requirements.txt
2725
cd scripts
2826
./openvino_build.sh --enable_python

.ci/scripts/test_openvino.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -ex
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
source openvino/dist/setupvars.sh
13+
source openvino/setupvars.sh
1414
cd backends/openvino/tests
1515
python test_runner.py --test_type ops
1616
python test_runner.py --test_type models

.github/workflows/pull.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,6 @@ jobs:
787787
contents: read
788788
strategy:
789789
fail-fast: false
790-
if: false # TODO Re-enable after fixing timeouts (#14314)
791790
with:
792791
runner: linux.2xlarge
793792
docker-image: ci-image:executorch-ubuntu-22.04-gcc9

.github/workflows/trunk.yml

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,26 @@ jobs:
823823
echo "Recipe: $RECIPE"
824824
echo "Quantize: $QUANTIZE"
825825
826-
echo "::group::Set up ExecuTorch"
827826
# The generic Linux job chooses to use base env, not the one setup by the image
828827
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
829828
conda activate "${CONDA_ENV}"
830-
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool cmake
829+
830+
echo "::group::Setup ExecuTorch"
831+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool "cmake"
832+
echo "::endgroup::"
833+
834+
echo "::group::Setup Huggingface"
835+
pip install -U "huggingface_hub[cli]" accelerate
836+
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
837+
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
838+
pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}
839+
echo "::endgroup::"
840+
841+
echo "::group::Test MODEL: $MODEL RECIPE: $RECIPE QUANTIZE: $QUANTIZE"
842+
export OUTPUT_DIR="$(pwd)/${MODEL}_${RECIPE}_${QUANTIZE}"
843+
python .ci/scripts/test_huggingface_optimum_model.py --model "$MODEL" --recipe "$RECIPE" $QUANTIZE --model_dir "$OUTPUT_DIR"
844+
echo "::endgroup::"
845+
831846
# Build executor_runner with ETdump enabled
832847
PYTHON_EXECUTABLE=python cmake -DPYTHON_EXECUTABLE=python \
833848
-DCMAKE_INSTALL_PREFIX=cmake-out \
@@ -845,25 +860,6 @@ jobs:
845860
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
846861
-Bcmake-out .
847862
cmake --build cmake-out -j16 --target install --config Release
848-
echo "::endgroup::"
849-
850-
echo "::group::Set up Hugging Face"
851-
pip install -U "huggingface_hub[cli]"
852-
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
853-
OPTIMUM_ET_COMMIT=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
854-
git clone https://github.com/huggingface/optimum-executorch
855-
pushd optimum-executorch
856-
# There is no release yet, for CI stability, always test from the same commit on main
857-
git checkout $OPTIMUM_ET_COMMIT
858-
python install_dev.py --skip_override_torch
859-
popd
860-
pip list
861-
echo "::endgroup::"
862-
863-
echo "::group::Run tests"
864-
export OUTPUT_DIR="$(pwd)/${MODEL}_${RECIPE}_${QUANTIZE}"
865-
python .ci/scripts/test_huggingface_optimum_model.py --model ${MODEL} --recipe ${RECIPE} ${QUANTIZE} --model_dir ${OUTPUT_DIR}
866-
echo "::endgroup::"
867863
868864
echo "::group::Generate artifacts for performance profiling"
869865
./cmake-out/executor_runner \
@@ -930,16 +926,11 @@ jobs:
930926
${CONDA_RUN} python install_executorch.py
931927
echo "::endgroup::"
932928
933-
echo "::group::Set up Hugging Face"
934-
pip install -U "huggingface_hub[cli]"
935-
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
936-
OPTIMUM_ET_COMMIT=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
937-
git clone https://github.com/huggingface/optimum-executorch
938-
pushd optimum-executorch
939-
# There is no release yet, for CI stability, always test from the same commit on main
940-
git checkout $OPTIMUM_ET_COMMIT
941-
${CONDA_RUN} python install_dev.py --skip_override_torch
942-
popd
929+
echo "::group::Set up Huggingface"
930+
${CONDA_RUN} pip install -U "huggingface_hub[cli]" accelerate
931+
${CONDA_RUN} huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
932+
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
933+
${CONDA_RUN} pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}
943934
${CONDA_RUN} pip list
944935
echo "::endgroup::"
945936

backends/arm/_passes/annotate_decomposed_matmul.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ def call(self, graph_module: GraphModule) -> PassResult:
7373
node for node in partition.nodes if node.target in matmul_targets
7474
][0]
7575

76-
if quantized_input:
76+
if quantized_input and not all(
77+
input_node.target in DQ_OPS
78+
for input_node in matmul_node.all_input_nodes
79+
):
7780
matmul_args = matmul_node.all_input_nodes
7881
for node in matmul_args:
7982
# Find the dq-node connected to this mm/bmm arg
@@ -99,7 +102,9 @@ def call(self, graph_module: GraphModule) -> PassResult:
99102

100103
partition_output = list(partition.output_nodes[0].users)[0]
101104
quantized_output = partition_output.target in Q_OPS
102-
if quantized_output:
105+
if quantized_output and not all(
106+
user.target in Q_OPS for user in matmul_node.users
107+
):
103108
with graph_module.graph.inserting_after(matmul_node):
104109
# Create q-node after matmul
105110
q_node = create_node(

backends/arm/test/ops/test_matmul.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
class MatMul(torch.nn.Module):
2424
test_data_generators = {
25+
"rand_rand_2d": lambda: (torch.rand(5, 5), torch.rand(5, 2)),
2526
"rand_rand_3d": lambda: (torch.rand(2, 3, 5), torch.rand(2, 5, 2)),
2627
"rand_rand_4d": lambda: (torch.rand(1, 2, 3, 5), torch.rand(1, 2, 5, 2)),
2728
}
@@ -32,6 +33,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
3233

3334
class MatMulSingleInput(torch.nn.Module):
3435
test_data_generators = {
36+
"rand_2d": lambda: (torch.rand(5, 5),),
3537
"rand_3d": lambda: (torch.rand(2, 5, 5),),
3638
"rand_4d": lambda: (torch.rand(1, 2, 5, 5),),
3739
}
@@ -42,6 +44,11 @@ def forward(self, x: torch.Tensor):
4244

4345
class MatMulCombo(torch.nn.Module):
4446
test_data_generators = {
47+
"rand_rand_rand_2d": lambda: (
48+
torch.rand(5, 5),
49+
torch.rand(5, 2),
50+
torch.rand(2, 5),
51+
),
4552
"rand_rand_rand_3d": lambda: (
4653
torch.rand(2, 5, 5),
4754
torch.rand(2, 5, 2),

backends/cadence/aot/replace_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ def call_operator(self, op, args, kwargs, meta):
15901590
updated_args = list(args)
15911591
for op_arg_index in args_to_be_replaced:
15921592
arg = args[op_arg_index]
1593-
if not arg.is_tensor():
1593+
if not isinstance(arg, ProxyValue) or not arg.is_tensor():
15941594
return super().call_operator(op, args, kwargs, meta)
15951595

15961596
if not isinstance(arg.node.target, EdgeOpOverload):

backends/openvino/partitioner.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828

2929
class OpenvinoOperatorsSupport(OperatorSupportBase):
30+
extended_support_dict = {
31+
"torch.ops.dim_order_ops._clone_dim_order.default": None,
32+
"torch.ops.dim_order_ops._to_dim_order_copy.default": None,
33+
}
3034

3135
def __init__(
3236
self,
@@ -62,7 +66,9 @@ def is_node_supported(self, _, node: torch.fx.Node) -> bool:
6266
op_type = node.target.__name__
6367
else:
6468
op_type = str(node.target)
65-
supported_ops = OperatorSupport(options)._support_dict
69+
supported_ops = (
70+
OperatorSupport(options)._support_dict | self.extended_support_dict
71+
)
6672
if op_type == "getitem":
6773
return True
6874

backends/openvino/preprocess.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
PreprocessResult,
1515
)
1616
from executorch.exir.backend.compile_spec_schema import CompileSpec
17+
18+
from executorch.exir.passes.memory_format_ops_pass import DimOrderOpsRevertPass
1719
from openvino.frontend.pytorch.torchdynamo.compile import ( # type: ignore[import-untyped]
1820
openvino_compile,
1921
)
@@ -36,6 +38,12 @@ def preprocess(
3638
Returns:
3739
PreprocessResult: The result of preprocessing, including the compiled model bytes.
3840
"""
41+
transformed_ep = DimOrderOpsRevertPass()(edge_program.graph_module)
42+
43+
# Update the edge_program with the transformed graph
44+
if transformed_ep and transformed_ep.graph_module:
45+
edge_program._graph_module = transformed_ep.graph_module
46+
3947
input_names = edge_program.graph_signature.user_inputs
4048
args = []
4149
for node in edge_program.graph.nodes:

export/export.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
22
# All rights reserved.
3+
# Copyright 2025 Arm Limited and/or its affiliates.
34
#
45
# This source code is licensed under the BSD-style license found in the
56
# LICENSE file in the root directory of this source tree.
@@ -200,7 +201,9 @@ def _build_stages(self, stages: List[StageType]) -> Dict[StageType, Stage]:
200201
aten_transform_passes = list(
201202
self._export_recipe.aten_transform_passes
202203
)
203-
stage = TorchExportStage(aten_transform_passes)
204+
stage = TorchExportStage(
205+
aten_transform_passes, strict=self._export_recipe.strict
206+
)
204207
elif stage_type == StageType.TO_EDGE_TRANSFORM_AND_LOWER:
205208
stage = EdgeTransformAndLowerStage.from_recipe(self._lowering_recipe)
206209
elif stage_type == StageType.TO_EDGE:

0 commit comments

Comments
 (0)