Skip to content

Commit db7c3cd

Browse files
committed
Update
[ghstack-poisoned]
2 parents ecc92b1 + 8d57c95 commit db7c3cd

File tree

11 files changed

+42
-19
lines changed

11 files changed

+42
-19
lines changed

backends/arm/arm_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def ethosu_compile_spec(
128128
self.compiler_flags.append("--output-format=raw")
129129
self.compiler_flags.append("--debug-force-regor")
130130

131-
base_tosa_version = "TOSA-0.80+BI"
131+
base_tosa_version = "TOSA-1.0+INT"
132132
if "u55" in target:
133133
# Add the Ethos-U55 extension marker
134134
base_tosa_version += "+u55"

backends/arm/test/test_arm_baremetal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ test_models_ethos-u85() { # End to End model tests using model_test.py
228228
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-256 --model=mv2 --extra_flags="-DET_ATOL=2.00 -DET_RTOL=2.00"
229229
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-512 --model=mv3 --extra_flags="-DET_ATOL=5.00 -DET_RTOL=5.00"
230230
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-128 --model=lstm --extra_flags="-DET_ATOL=0.03 -DET_RTOL=0.03"
231-
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-128 --model=w2l --extra_flags="-DET_ATOL=0.01 -DET_RTOL=0.01"
231+
#python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-128 --model=w2l --extra_flags="-DET_ATOL=0.01 -DET_RTOL=0.01" # Takes long time to run
232232
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-256 --model=ic4 --extra_flags="-DET_ATOL=0.8 -DET_RTOL=0.8" --timeout=2400
233233
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-128 --model=resnet18 --extra_flags="-DET_ATOL=0.2 -DET_RTOL=0.2"
234234
python3 backends/arm/test/test_model.py --test_output=arm_test/test_model --target=ethos-u85-128 --model=resnet50 --extra_flags="-DET_ATOL=0.2 -DET_RTOL=0.2"

backends/cadence/aot/compiler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ def _lower_ep_to_edge(
228228
"""
229229
Lower an ExportedProgram to an EdgeProgramManager (in edge IR).
230230
"""
231+
# Apply passes which transform the ExportedProgram before it gets lowered to edge.
232+
expo_program = apply_torch_ops_passes(expo_program)
233+
231234
# Call to_edge to convert the graph to edge IR.
232235
# Note: dim_order is skipped (https://github.com/pytorch/executorch/issues/3704)
233236
edge_prog_manager = to_edge(
@@ -263,9 +266,6 @@ def export_to_edge(
263266
# Export the model into an ExportedProgram.
264267
expo_program = trace(model, inputs)
265268

266-
# Apply passes which transform the ExportedProgram before it gets lowered to edge.
267-
expo_program = apply_torch_ops_passes(expo_program)
268-
269269
# Lower the model to edge IR.
270270
edge_prog_manager = _lower_ep_to_edge(
271271
expo_program, dump_graphs, constant_methods, core_aten_exceptions

backends/cadence/aot/ops_registrations.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@
276276
"requantize.per_tensor_out(Tensor input, float in_scale, int in_zero_point, float out_scale, "
277277
"int out_zero_point, ScalarType out_dtype, *, Tensor(a!) out) -> Tensor(a!)"
278278
)
279+
lib.define(
280+
"roi_align_box_processor.out(Tensor rois, int output_size_h, int output_size_w, "
281+
"int sampling_ratio, bool aligned, *, Tensor(a!) out) -> Tensor(a!)"
282+
)
283+
lib.define(
284+
"roi_align_box_processor(Tensor rois, int output_size_h, int output_size_w, "
285+
"int sampling_ratio, bool aligned) -> (Tensor out)"
286+
)
279287

280288
# Custom ops with aten namespace. Need to specify the lib var as FRAGMENT type as aten library is already defined
281289
aten_lib = Library("aten", "FRAGMENT")
@@ -1038,3 +1046,14 @@ def idma_store_impl(
10381046
channel: int = 0,
10391047
) -> torch.Tensor:
10401048
return copy_idma_copy_impl(src, task_num, channel)
1049+
1050+
1051+
@register_fake("cadence::roi_align_box_processor")
1052+
def roi_align_box_processor_meta(
1053+
rois: torch.Tensor,
1054+
output_size_h: int,
1055+
output_size_w: int,
1056+
sampling_ratio: int,
1057+
aligned: bool,
1058+
) -> torch.Tensor:
1059+
return rois.new_empty((rois.shape[0], 80), dtype=torch.uint8)

backends/cadence/aot/replace_ops.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,12 +2328,15 @@ def call(self, graph_module: torch.fx.GraphModule) -> PassResult:
23282328

23292329
# Extract an argument to a separate full op.
23302330
with graph_module.graph.inserting_before(mul_node):
2331-
full_tensor = graph_module.graph.call_function(
2331+
full_node = graph_module.graph.call_function(
23322332
torch.ops.aten.full.default, args=([1], full_arg)
23332333
)
2334+
full_node.meta = mul_node.meta
2335+
full_node.meta["val"] = [1]
23342336
new_mul_node = graph_module.graph.call_function(
2335-
torch.ops.aten.mul.Tensor, args=(x_arg, full_tensor)
2337+
torch.ops.aten.mul.Tensor, args=(x_arg, full_node)
23362338
)
2339+
new_mul_node.meta = mul_node.meta
23372340
# Replace the old mul with a newly created mul.
23382341
mul_node.replace_all_uses_with(new_mul_node)
23392342
graph_module.graph.erase_node(mul_node)

backends/xnnpack/test/recipes/test_xnnpack_recipes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from executorch.examples.models.model_factory import EagerModelFactory
1919
from executorch.examples.xnnpack import MODEL_NAME_TO_OPTIONS, QuantType
2020
from executorch.exir.schema import DelegateCall, Program
21-
from executorch.export import export, ExportRecipe
21+
from executorch.export import export, ExportRecipe, recipe_registry
2222
from torch import nn
2323
from torch.testing._internal.common_quantization import TestHelperModules
2424

@@ -27,6 +27,7 @@ class TestXnnpackRecipes(unittest.TestCase):
2727
def setUp(self) -> None:
2828
torch._dynamo.reset()
2929
super().setUp()
30+
recipe_registry.register_backend_recipe_provider(XNNPACKRecipeProvider())
3031

3132
def tearDown(self) -> None:
3233
super().tearDown()

examples/arm/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fi
6060

6161
# Vela
6262
vela_repo_url="https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela"
63-
vela_rev="8cac2b9a7204b57125a8718049519b091a98846c"
63+
vela_rev="d37febc1715edf0d236c2ff555739a8a9aadcf9a"
6464

6565
# MLSDK dependencies
6666
mlsdk_manifest_dir="ml-sdk-for-vulkan-manifest"

examples/qualcomm/oss_scripts/llama/CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
87
# model sharding with custom op
98
set(CUSTOM_OP_SRCS_FILE
109
"${EXECUTORCH_SOURCE_DIR}/extension/llm/custom_ops/op_fallback.cpp"
@@ -50,9 +49,7 @@ list(APPEND _llama_runner__srcs)
5049
# build qnn llama runner
5150
add_executable(qnn_llama_runner ${_llama_runner__srcs})
5251
target_include_directories(
53-
qnn_llama_runner
54-
PUBLIC
55-
${_common_include_directories}
52+
qnn_llama_runner PUBLIC ${_common_include_directories}
5653
)
5754

5855
executorch_target_link_options_shared_lib(quantized_ops_lib)
@@ -66,7 +63,6 @@ target_link_libraries(
6663
extension_llm_runner
6764
extension_module
6865
extension_tensor
69-
tokenizers
7066
gflags
7167
custom_ops
7268
quantized_ops_lib
@@ -75,8 +71,7 @@ target_link_libraries(
7571
)
7672

7773
target_include_directories(
78-
qnn_llama_runner
79-
PUBLIC ${EXECUTORCH_ROOT}/extension/llm/tokenizers/include
74+
qnn_llama_runner PUBLIC ${EXECUTORCH_ROOT}/extension/llm/tokenizers/include
8075
)
8176

8277
target_compile_options(qnn_llama_runner PUBLIC ${_common_compile_options})

extension/llm/apple/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ set_source_files_properties(
4242
${OBJC_SOURCES} PROPERTIES COMPILE_FLAGS "-fobjc-arc" "-fno-exceptions"
4343
"-fno-rtti"
4444
)
45+
46+
set_target_properties(extension_llm_apple PROPERTIES
47+
XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION YES
48+
)

pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ addopts =
3333
exir/program/test
3434
exir/tests/
3535
# executorch/export
36-
executorch/export/tests
36+
export/tests
37+
--ignore=export/tests/test_export_stages.py
3738
# kernels/
3839
kernels/prim_ops/test
3940
kernels/quantized

0 commit comments

Comments
 (0)