From d0898de0cb11288e932972ad5c4be2e340e13a59 Mon Sep 17 00:00:00 2001 From: Matthias Cremon Date: Thu, 11 Apr 2024 10:43:33 -0700 Subject: [PATCH] Update name from xtensa to cadence (#2982) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/2982 As titled. Reviewed By: cccclai Differential Revision: D55998135 --- docs/source/build-run-xtensa.md | 28 +++++++++---------- examples/{xtensa => cadence}/CMakeLists.txt | 16 +++++------ examples/{xtensa => cadence}/aot/compiler.py | 0 .../{xtensa => cadence}/aot/export_example.py | 24 ++++++++-------- .../aot/meta_registrations.py | 4 +-- examples/{xtensa => cadence}/aot/quantizer.py | 28 +++++++++---------- examples/{xtensa => cadence}/aot/utils.py | 0 .../xtensa.cmake => cadence/cadence.cmake} | 0 .../{xtensa => cadence}/executor_runner.cpp | 2 +- .../kernels/CMakeLists.txt | 4 +-- .../{xtensa => cadence}/kernels/kernels.cpp | 0 .../{xtensa => cadence}/kernels/kernels.h | 0 .../{xtensa => cadence}/ops/CMakeLists.txt | 18 ++++++------ .../ops/dequantize_per_tensor.cpp | 0 .../{xtensa => cadence}/ops/functions.yaml | 10 +++---- examples/{xtensa => cadence}/ops/op_add.cpp | 0 .../{xtensa => cadence}/ops/op_embedding.cpp | 0 examples/{xtensa => cadence}/ops/op_full.cpp | 0 .../{xtensa => cadence}/ops/op_view_copy.cpp | 0 .../ops/quantize_per_tensor.cpp | 0 .../ops/quantized_conv_out.cpp | 0 .../ops/quantized_layer_norm.cpp | 0 .../ops/quantized_linear_out.cpp | 0 .../ops/quantized_relu_out.cpp | 0 .../tests/quantized_conv1d_example.py | 4 +-- .../tests/quantized_linear_example.py | 4 +-- .../tests/rnnt_predictor_quantized_example.py | 4 +-- .../third-party/nnlib-hifi4/license.txt | 0 .../matmul_asym8uxasym8u_asym8u.cpp | 0 .../matmul_asym8uxasym8u_asym8u_macros.h | 0 .../xa_nnlib_matmul_unroll_macros.h | 0 .../{xtensa => cadence}/utils/gen_header.py | 0 .../utils/post_compilation.py | 0 33 files changed, 73 insertions(+), 73 deletions(-) rename examples/{xtensa => cadence}/CMakeLists.txt (90%) rename examples/{xtensa => cadence}/aot/compiler.py (100%) rename examples/{xtensa => cadence}/aot/export_example.py (71%) rename examples/{xtensa => cadence}/aot/meta_registrations.py (98%) rename examples/{xtensa => cadence}/aot/quantizer.py (97%) rename examples/{xtensa => cadence}/aot/utils.py (100%) rename examples/{xtensa/xtensa.cmake => cadence/cadence.cmake} (100%) rename examples/{xtensa => cadence}/executor_runner.cpp (99%) rename examples/{xtensa => cadence}/kernels/CMakeLists.txt (78%) rename examples/{xtensa => cadence}/kernels/kernels.cpp (100%) rename examples/{xtensa => cadence}/kernels/kernels.h (100%) rename examples/{xtensa => cadence}/ops/CMakeLists.txt (80%) rename examples/{xtensa => cadence}/ops/dequantize_per_tensor.cpp (100%) rename examples/{xtensa => cadence}/ops/functions.yaml (59%) rename examples/{xtensa => cadence}/ops/op_add.cpp (100%) rename examples/{xtensa => cadence}/ops/op_embedding.cpp (100%) rename examples/{xtensa => cadence}/ops/op_full.cpp (100%) rename examples/{xtensa => cadence}/ops/op_view_copy.cpp (100%) rename examples/{xtensa => cadence}/ops/quantize_per_tensor.cpp (100%) rename examples/{xtensa => cadence}/ops/quantized_conv_out.cpp (100%) rename examples/{xtensa => cadence}/ops/quantized_layer_norm.cpp (100%) rename examples/{xtensa => cadence}/ops/quantized_linear_out.cpp (100%) rename examples/{xtensa => cadence}/ops/quantized_relu_out.cpp (100%) rename examples/{xtensa => cadence}/tests/quantized_conv1d_example.py (93%) rename examples/{xtensa => cadence}/tests/quantized_linear_example.py (91%) rename examples/{xtensa => cadence}/tests/rnnt_predictor_quantized_example.py (94%) rename examples/{xtensa => cadence}/third-party/nnlib-hifi4/license.txt (100%) rename examples/{xtensa => cadence}/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u.cpp (100%) rename examples/{xtensa => cadence}/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u_macros.h (100%) rename examples/{xtensa => cadence}/third-party/nnlib-hifi4/xa_nnlib_matmul_unroll_macros.h (100%) rename examples/{xtensa => cadence}/utils/gen_header.py (100%) rename examples/{xtensa => cadence}/utils/post_compilation.py (100%) diff --git a/docs/source/build-run-xtensa.md b/docs/source/build-run-xtensa.md index 7827ea5e36d..cd58d09a0da 100644 --- a/docs/source/build-run-xtensa.md +++ b/docs/source/build-run-xtensa.md @@ -64,7 +64,7 @@ Step 2. Make sure you have completed the ExecuTorch setup tutorials linked to at The working tree is: ``` -examples/xtensa/ +examples/cadence/ ├── aot ├── kernels ├── ops @@ -75,7 +75,7 @@ examples/xtensa/ ***AoT (Ahead-of-Time) Components***: -The AoT folder contains all of the python scripts and functions needed to export the model to an ExecuTorch `.pte` file. In our case, [export_example.py](https://github.com/pytorch/executorch/blob/main/examples/xtensa/aot/export_example.py) is an API that takes a model (nn.Module) and representative inputs and runs it through the quantizer (from [quantizer.py](https://github.com/pytorch/executorch/blob/main/examples/xtensa/aot/quantizer.py)). Then a few compiler passes, also defined in [quantizer.py](https://github.com/pytorch/executorch/blob/main/examples/xtensa/aot/quantizer.py), will replace operators with custom ones that are supported and optimized on the chip. Any operator needed to compute things should be defined in [meta_registrations.py](https://github.com/pytorch/executorch/blob/main/examples/xtensa/aot/meta_registrations.py) and have corresponding implemetations in the other folders. +The AoT folder contains all of the python scripts and functions needed to export the model to an ExecuTorch `.pte` file. In our case, [export_example.py](https://github.com/pytorch/executorch/blob/main/examples/cadence/aot/export_example.py) is an API that takes a model (nn.Module) and representative inputs and runs it through the quantizer (from [quantizer.py](https://github.com/pytorch/executorch/blob/main/examples/cadence/aot/quantizer.py)). Then a few compiler passes, also defined in [quantizer.py](https://github.com/pytorch/executorch/blob/main/examples/cadence/aot/quantizer.py), will replace operators with custom ones that are supported and optimized on the chip. Any operator needed to compute things should be defined in [meta_registrations.py](https://github.com/pytorch/executorch/blob/main/examples/cadence/aot/meta_registrations.py) and have corresponding implemetations in the other folders. ***Operators***: @@ -101,14 +101,14 @@ python3 -m examples.portable.scripts.export --model_name="add" ***Quantized Operators***: The other, more complex model are custom operators, including: - - a quantized [linear](https://pytorch.org/docs/stable/generated/torch.nn.Linear.html) operation. The model is defined [here](https://github.com/pytorch/executorch/blob/main/examples/xtensa/tests/quantized_linear_example.py#L28). Linear is the backbone of most Automatic Speech Recognition (ASR) models. - - a quantized [conv1d](https://pytorch.org/docs/stable/generated/torch.nn.Conv1d.html) operation. The model is defined [here](https://github.com/pytorch/executorch/blob/main/examples/xtensa/tests/quantized_conv1d_example.py#L36). Convolutions are important in wake word and many denoising models. + - a quantized [linear](https://pytorch.org/docs/stable/generated/torch.nn.Linear.html) operation. The model is defined [here](https://github.com/pytorch/executorch/blob/main/examples/cadence/tests/quantized_linear_example.py#L28). Linear is the backbone of most Automatic Speech Recognition (ASR) models. + - a quantized [conv1d](https://pytorch.org/docs/stable/generated/torch.nn.Conv1d.html) operation. The model is defined [here](https://github.com/pytorch/executorch/blob/main/examples/cadence/tests/quantized_conv1d_example.py#L36). Convolutions are important in wake word and many denoising models. In both cases the generated file is called `XtensaDemoModel.pte`. ```bash cd executorch -python3 -m examples.xtensa.tests.quantized__example +python3 -m examples.cadence.tests.quantized__example ``` ***Small Model: RNNT predictor***: @@ -118,7 +118,7 @@ The predictor is a sequence of basic ops (embedding, ReLU, linear, layer norm) a ```bash cd executorch -python3 -m examples.xtensa.tests.rnnt_predictor_quantized_example +python3 -m examples.cadence.tests.rnnt_predictor_quantized_example ``` The generated file is called `XtensaDemoModel.pte`. @@ -131,7 +131,7 @@ In this step, you'll be building the DSP firmware image that consists of the sam ***Step 1***. Configure the environment variables needed to point to the Xtensa toolchain that you have installed in the previous step. The three environment variables that need to be set include: ```bash # Directory in which the Xtensa toolchain was installed -export XTENSA_TOOLCHAIN=/home/user_name/xtensa/XtDevTools/install/tools +export XTENSA_TOOLCHAIN=/home/user_name/cadence/XtDevTools/install/tools # The version of the toolchain that was installed. This is essentially the name of the directory # that is present in the XTENSA_TOOLCHAIN directory from above. export TOOLCHAIN_VER=RI-2021.8-linux @@ -151,7 +151,7 @@ cd executorch rm -rf cmake-out # prebuild and install executorch library cmake -DBUCK2=buck2 \ - -DCMAKE_TOOLCHAIN_FILE=/examples/xtensa/xtensa.cmake \ + -DCMAKE_TOOLCHAIN_FILE=/examples/cadence/cadence.cmake \ -DCMAKE_INSTALL_PREFIX=cmake-out \ -DCMAKE_BUILD_TYPE=Debug \ -DPYTHON_EXECUTABLE=python3 \ @@ -165,18 +165,18 @@ cmake -DBUCK2=buck2 \ -Bcmake-out . cmake --build cmake-out -j8 --target install --config Debug -# build xtensa runner +# build cadence runner cmake -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_TOOLCHAIN_FILE=/examples/xtensa/xtensa.cmake \ + -DCMAKE_TOOLCHAIN_FILE=/examples/cadence/cadence.cmake \ -DCMAKE_PREFIX_PATH=/cmake-out \ -DMODEL_PATH= \ -DNXP_SDK_ROOT_DIR= -DEXECUTORCH_BUILD_FLATC=0 \ -DFLATC_EXECUTABLE="$(which flatc)" \ -DNN_LIB_BASE_DIR= \ - -Bcmake-out/examples/xtensa \ - examples/xtensa + -Bcmake-out/examples/cadence \ + examples/cadence -cmake --build cmake-out/examples/xtensa -j8 -t xtensa_executorch_example +cmake --build cmake-out/examples/cadence -j8 -t cadence_executorch_example ``` After having succesfully run the above step you should see two binary files in their CMake output directory. @@ -213,6 +213,6 @@ First 20 elements of output 0 In this tutorial, you have learned how to export a quantized operation, build the ExecuTorch runtime and run this model on the Xtensa HiFi4 DSP chip. -The (quantized linear) model in this tutorial is a typical operation appearing in ASR models, and can be extended to a complete ASR model by creating the model as a new test and adding the needed operators/kernels to [operators](https://github.com/pytorch/executorch/blob/main/examples/xtensa/ops) and [kernels](https://github.com/pytorch/executorch/blob/main/examples/xtensa/kernels). +The (quantized linear) model in this tutorial is a typical operation appearing in ASR models, and can be extended to a complete ASR model by creating the model as a new test and adding the needed operators/kernels to [operators](https://github.com/pytorch/executorch/blob/main/examples/cadence/ops) and [kernels](https://github.com/pytorch/executorch/blob/main/examples/cadence/kernels). Other models can be created following the same structure, always assuming that operators and kernels are available. diff --git a/examples/xtensa/CMakeLists.txt b/examples/cadence/CMakeLists.txt similarity index 90% rename from examples/xtensa/CMakeLists.txt rename to examples/cadence/CMakeLists.txt index 8c9a251a168..ec4658b6701 100644 --- a/examples/xtensa/CMakeLists.txt +++ b/examples/cadence/CMakeLists.txt @@ -12,7 +12,7 @@ if(NOT CMAKE_CXX_STANDARD) endif() # Set the project name. -project(xtensa_executorch_example) +project(cadence_executorch_example) # Source root directory for executorch. if(NOT EXECUTORCH_ROOT) @@ -100,21 +100,21 @@ add_custom_command( add_custom_target(gen_model_header DEPENDS ${CMAKE_BINARY_DIR}/model_pte.h) -add_executable(xtensa_executorch_example executor_runner.cpp) -add_dependencies(xtensa_executorch_example gen_model_header) +add_executable(cadence_executorch_example executor_runner.cpp) +add_dependencies(cadence_executorch_example gen_model_header) # lint_cmake: -linelength -target_include_directories(xtensa_executorch_example PUBLIC ${ROOT_DIR}/.. +target_include_directories(cadence_executorch_example PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR} ${_common_include_directories}) -target_link_options(xtensa_executorch_example PRIVATE +target_link_options(cadence_executorch_example PRIVATE -mlsp=${NXP_SDK_ROOT_DIR}/devices/MIMXRT685S/xtensa/min-rt) -target_link_libraries(xtensa_executorch_example dsp_mu_polling_libs - xtensa_ops_lib extension_runner_util executorch) +target_link_libraries(cadence_executorch_example dsp_mu_polling_libs + cadence_ops_lib extension_runner_util executorch) add_custom_command( - TARGET xtensa_executorch_example + TARGET cadence_executorch_example POST_BUILD COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/utils/post_compilation.py diff --git a/examples/xtensa/aot/compiler.py b/examples/cadence/aot/compiler.py similarity index 100% rename from examples/xtensa/aot/compiler.py rename to examples/cadence/aot/compiler.py diff --git a/examples/xtensa/aot/export_example.py b/examples/cadence/aot/export_example.py similarity index 71% rename from examples/xtensa/aot/export_example.py rename to examples/cadence/aot/export_example.py index 509538f5437..23cc9fd789a 100644 --- a/examples/xtensa/aot/export_example.py +++ b/examples/cadence/aot/export_example.py @@ -17,10 +17,10 @@ from .compiler import export_to_edge from .quantizer import ( + CadenceBaseQuantizer, QuantFusion, - ReplacePT2DequantWithXtensaDequant, - ReplacePT2QuantWithXtensaQuant, - XtensaBaseQuantizer, + ReplacePT2DequantWithCadenceDequant, + ReplacePT2QuantWithCadenceQuant, ) @@ -28,9 +28,9 @@ logging.basicConfig(level=logging.INFO, format=FORMAT) -def export_xtensa_model(model, example_inputs): +def export_model(model, example_inputs): # Quantizer - quantizer = XtensaBaseQuantizer() + quantizer = CadenceBaseQuantizer() # Export model_exp = capture_pre_autograd_graph(model, example_inputs) @@ -42,24 +42,24 @@ def export_xtensa_model(model, example_inputs): # Convert converted_model = convert_pt2e(prepared_model) - # pyre-fixme[16]: Pyre doesn't get that XtensaQuantizer has a patterns attribute + # pyre-fixme[16]: Pyre doesn't get that CadenceQuantizer has a patterns attribute patterns = [q.pattern for q in quantizer.quantizers] QuantFusion(patterns)(converted_model) - # Get edge program (note: the name will change to export_to_xtensa in future PRs) + # Get edge program (note: the name will change to export_to_cadence in future PRs) edge_prog_manager = export_to_edge(converted_model, example_inputs, pt2_quant=True) # Run a couple required passes for quant/dequant ops - xtensa_prog_manager = edge_prog_manager.transform( - [ReplacePT2QuantWithXtensaQuant(), ReplacePT2DequantWithXtensaDequant()], + cadence_prog_manager = edge_prog_manager.transform( + [ReplacePT2QuantWithCadenceQuant(), ReplacePT2DequantWithCadenceDequant()], check_ir_validity=False, ) - exec_prog = xtensa_prog_manager.to_executorch() + exec_prog = cadence_prog_manager.to_executorch() logging.info( f"Final exported graph module:\n{exec_prog.exported_program().graph_module}" ) - # Save the program as XtensaDemoModel.pte - save_pte_program(exec_prog, "XtensaDemoModel") + # Save the program as CadenceDemoModel.pte + save_pte_program(exec_prog, "CadenceDemoModel") diff --git a/examples/xtensa/aot/meta_registrations.py b/examples/cadence/aot/meta_registrations.py similarity index 98% rename from examples/xtensa/aot/meta_registrations.py rename to examples/cadence/aot/meta_registrations.py index d62334fda4b..f7dabe1ec11 100644 --- a/examples/xtensa/aot/meta_registrations.py +++ b/examples/cadence/aot/meta_registrations.py @@ -12,7 +12,7 @@ from .utils import get_conv1d_output_size -lib = Library("xtensa", "DEF") +lib = Library("cadence", "DEF") lib.define( "quantize_per_tensor(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype) -> (Tensor Z)" @@ -56,7 +56,7 @@ "quantized_conv.out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, Tensor weight_zero_point, Tensor bias_scale, float out_scale, int out_zero_point, Tensor out_multiplier, Tensor out_shift, bool channel_last=False, *, Tensor(a!) out) -> Tensor(a!)" ) -m = Library("xtensa", "IMPL", "Meta") +m = Library("cadence", "IMPL", "Meta") @impl(m, "quantize_per_tensor") diff --git a/examples/xtensa/aot/quantizer.py b/examples/cadence/aot/quantizer.py similarity index 97% rename from examples/xtensa/aot/quantizer.py rename to examples/cadence/aot/quantizer.py index e664e0fb59f..df184f9d92c 100644 --- a/examples/xtensa/aot/quantizer.py +++ b/examples/cadence/aot/quantizer.py @@ -437,7 +437,7 @@ def get_anchors( ) def replacement_op(self): - return torch.ops.xtensa.quantized_linear.default + return torch.ops.cadence.quantized_linear.default class LinearFunctionalPattern(QuantizationPattern): @@ -457,7 +457,7 @@ def get_anchors( ) def replacement_op(self): - return torch.ops.xtensa.quantized_linear.default + return torch.ops.cadence.quantized_linear.default class LayerNormPattern(QuantizationPattern): @@ -476,7 +476,7 @@ def get_anchors(self, gm, fused_partition) -> PartitionAnchors: ) def replacement_op(self): - return torch.ops.xtensa.quantized_layer_norm.default + return torch.ops.cadence.quantized_layer_norm.default class Conv1dPattern(QuantizationPattern): @@ -503,7 +503,7 @@ def get_anchors( ) def replacement_op(self): - return torch.ops.xtensa.quantized_conv.default + return torch.ops.cadence.quantized_conv.default class Conv2dPattern(QuantizationPattern): @@ -530,7 +530,7 @@ def get_anchors( ) def replacement_op(self): - return torch.ops.xtensa.quantized_conv.default + return torch.ops.cadence.quantized_conv.default class AddmmPattern(QuantizationPattern): @@ -550,7 +550,7 @@ def get_anchors( ) def replacement_op(self): - return torch.ops.xtensa.quantized_linear.default + return torch.ops.cadence.quantized_linear.default class ReluPattern(QuantizationPattern): @@ -573,7 +573,7 @@ def get_anchors( ) def replacement_op(self): - return torch.ops.xtensa.quantized_relu.default + return torch.ops.cadence.quantized_relu.default class GenericQuantizer(Quantizer): @@ -657,7 +657,7 @@ def get_supported_operators(cls) -> List[OperatorConfig]: ) -class XtensaBaseQuantizer(ComposableQuantizer): +class CadenceBaseQuantizer(ComposableQuantizer): def __init__(self): static_qconfig = QuantizationConfig( act_qspec, @@ -821,9 +821,9 @@ def mark_fused(cls, nodes) -> bool: n.meta["QuantFusion"] = True -class ReplacePT2QuantWithXtensaQuant(ExportPass): +class ReplacePT2QuantWithCadenceQuant(ExportPass): """ - Replace the pt2 quantization ops with custom xtensa quantization ops. + Replace the pt2 quantization ops with custom cadence quantization ops. """ def call_operator(self, op, args, kwargs, meta): @@ -831,16 +831,16 @@ def call_operator(self, op, args, kwargs, meta): return super().call_operator(op, args, kwargs, meta) return super().call_operator( - exir_ops.edge.xtensa.quantize_per_tensor.default, + exir_ops.edge.cadence.quantize_per_tensor.default, args, kwargs, meta, ) -class ReplacePT2DequantWithXtensaDequant(ExportPass): +class ReplacePT2DequantWithCadenceDequant(ExportPass): """ - Replace the pt2 dequantization ops with custom xtensa dequantization ops. + Replace the pt2 dequantization ops with custom cadence dequantization ops. """ def call_operator(self, op, args, kwargs, meta): @@ -848,7 +848,7 @@ def call_operator(self, op, args, kwargs, meta): return super().call_operator(op, args, kwargs, meta) return super().call_operator( - exir_ops.edge.xtensa.dequantize_per_tensor.default, + exir_ops.edge.cadence.dequantize_per_tensor.default, args, kwargs, meta, diff --git a/examples/xtensa/aot/utils.py b/examples/cadence/aot/utils.py similarity index 100% rename from examples/xtensa/aot/utils.py rename to examples/cadence/aot/utils.py diff --git a/examples/xtensa/xtensa.cmake b/examples/cadence/cadence.cmake similarity index 100% rename from examples/xtensa/xtensa.cmake rename to examples/cadence/cadence.cmake diff --git a/examples/xtensa/executor_runner.cpp b/examples/cadence/executor_runner.cpp similarity index 99% rename from examples/xtensa/executor_runner.cpp rename to examples/cadence/executor_runner.cpp index 37ade9914fc..7144f84507b 100644 --- a/examples/xtensa/executor_runner.cpp +++ b/examples/cadence/executor_runner.cpp @@ -12,7 +12,7 @@ * This is a simple executor_runner that boots up the DSP, configures the serial * port, sends a bunch of test messages to the M33 core and then loads the model * defined in model_pte.h. It runs this model using the ops available in - * xtensa/ops directory. + * cadence/ops directory. */ #include diff --git a/examples/xtensa/kernels/CMakeLists.txt b/examples/cadence/kernels/CMakeLists.txt similarity index 78% rename from examples/xtensa/kernels/CMakeLists.txt rename to examples/cadence/kernels/CMakeLists.txt index edd2a606000..963181c0664 100644 --- a/examples/xtensa/kernels/CMakeLists.txt +++ b/examples/cadence/kernels/CMakeLists.txt @@ -5,10 +5,10 @@ # LICENSE file in the root directory of this source tree. # lint_cmake: -linelength -add_library(xtensa_kernels kernels.cpp ${EXECUTORCH_ROOT}/examples/xtensa/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u.cpp) +add_library(cadence_kernels kernels.cpp ${EXECUTORCH_ROOT}/examples/cadence/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u.cpp) target_include_directories( - xtensa_kernels + cadence_kernels PUBLIC . ${NN_LIB_BASE_DIR}/xa_nnlib/algo/common/include/ ${NN_LIB_BASE_DIR}/xa_nnlib/include/nnlib diff --git a/examples/xtensa/kernels/kernels.cpp b/examples/cadence/kernels/kernels.cpp similarity index 100% rename from examples/xtensa/kernels/kernels.cpp rename to examples/cadence/kernels/kernels.cpp diff --git a/examples/xtensa/kernels/kernels.h b/examples/cadence/kernels/kernels.h similarity index 100% rename from examples/xtensa/kernels/kernels.h rename to examples/cadence/kernels/kernels.h diff --git a/examples/xtensa/ops/CMakeLists.txt b/examples/cadence/ops/CMakeLists.txt similarity index 80% rename from examples/xtensa/ops/CMakeLists.txt rename to examples/cadence/ops/CMakeLists.txt index abcac83d283..98f631175f2 100644 --- a/examples/xtensa/ops/CMakeLists.txt +++ b/examples/cadence/ops/CMakeLists.txt @@ -31,16 +31,16 @@ set(_aten_ops__srcs "${CMAKE_CURRENT_SOURCE_DIR}/op_view_copy.cpp" "${EXECUTORCH_ROOT}/kernels/portable/cpu/util/broadcast_util.cpp" "${EXECUTORCH_ROOT}/kernels/portable/cpu/util/repeat_util.cpp") -add_library(aten_ops_xtensa ${_aten_ops__srcs}) -target_link_libraries(aten_ops_xtensa PUBLIC executorch) -target_link_libraries(aten_ops_xtensa PRIVATE xtensa_kernels) +add_library(aten_ops_cadence ${_aten_ops__srcs}) +target_link_libraries(aten_ops_cadence PUBLIC executorch) +target_link_libraries(aten_ops_cadence PRIVATE cadence_kernels) # Let files say "include ". set(_common_include_directories ${EXECUTORCH_ROOT}/..) -target_include_directories(aten_ops_xtensa PUBLIC ${ROOT_DIR}/.. - ${CMAKE_BINARY_DIR} - ${_common_include_directories}) +target_include_directories(aten_ops_cadence PUBLIC ${ROOT_DIR}/.. + ${CMAKE_BINARY_DIR} + ${_common_include_directories}) # Custom ops that are needed to run the test model. add_library( @@ -52,7 +52,7 @@ target_include_directories(custom_ops PUBLIC ${ROOT_DIR}/.. ${_common_include_directories}) target_link_libraries(custom_ops PUBLIC executorch) -target_link_libraries(custom_ops PRIVATE xtensa_kernels) +target_link_libraries(custom_ops PRIVATE cadence_kernels) # Generate C++ bindings to register kernels into both PyTorch (for AOT) and # Executorch (for runtime). Here select all ops in functions.yaml @@ -62,6 +62,6 @@ generate_bindings_for_kernels( message("Generated files ${gen_command_sources}") gen_operators_lib( - "xtensa_ops_lib" + "cadence_ops_lib" KERNEL_LIBS custom_ops - DEPS aten_ops_xtensa) + DEPS aten_ops_cadence) diff --git a/examples/xtensa/ops/dequantize_per_tensor.cpp b/examples/cadence/ops/dequantize_per_tensor.cpp similarity index 100% rename from examples/xtensa/ops/dequantize_per_tensor.cpp rename to examples/cadence/ops/dequantize_per_tensor.cpp diff --git a/examples/xtensa/ops/functions.yaml b/examples/cadence/ops/functions.yaml similarity index 59% rename from examples/xtensa/ops/functions.yaml rename to examples/cadence/ops/functions.yaml index 91ffd18063a..650df5fd6b5 100644 --- a/examples/xtensa/ops/functions.yaml +++ b/examples/cadence/ops/functions.yaml @@ -33,29 +33,29 @@ kernel_name: torch::executor::view_copy_out # custom ops -- func: xtensa::quantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!) +- func: cadence::quantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!) variants: function kernels: - arg_meta: null kernel_name: impl::HiFi::quantize_per_tensor_out -- func: xtensa::dequantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!) +- func: cadence::dequantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!) variants: function kernels: - arg_meta: null kernel_name: impl::HiFi::dequantize_per_tensor_out -- func: xtensa::quantized_conv.out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, Tensor weight_zero_point, Tensor bias_scale, float out_scale, int out_zero_point, Tensor out_multiplier, Tensor out_shift, bool channel_last=False, *, Tensor(a!) out) -> Tensor(a!) +- func: cadence::quantized_conv.out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, Tensor weight_zero_point, Tensor bias_scale, float out_scale, int out_zero_point, Tensor out_multiplier, Tensor out_shift, bool channel_last=False, *, Tensor(a!) out) -> Tensor(a!) kernels: - arg_meta: null kernel_name: impl::HiFi::quantized_conv_out -- func: xtensa::quantized_linear.out(Tensor src, Tensor weight, Tensor bias, float src_scale, int src_zero_point, float weight_scale, int weight_zero_point, Tensor out_multiplier, Tensor out_shift, int out_zero_point, *, Tensor(a!) out) -> Tensor(a!) +- func: cadence::quantized_linear.out(Tensor src, Tensor weight, Tensor bias, float src_scale, int src_zero_point, float weight_scale, int weight_zero_point, Tensor out_multiplier, Tensor out_shift, int out_zero_point, *, Tensor(a!) out) -> Tensor(a!) kernels: - arg_meta: null kernel_name: impl::HiFi::quantized_linear_out -- func: xtensa::quantized_relu.out(Tensor X, Tensor X_zero_point, *, Tensor(a!) out) -> Tensor(a!) +- func: cadence::quantized_relu.out(Tensor X, Tensor X_zero_point, *, Tensor(a!) out) -> Tensor(a!) kernels: - arg_meta: null kernel_name: impl::HiFi::quantized_relu_out diff --git a/examples/xtensa/ops/op_add.cpp b/examples/cadence/ops/op_add.cpp similarity index 100% rename from examples/xtensa/ops/op_add.cpp rename to examples/cadence/ops/op_add.cpp diff --git a/examples/xtensa/ops/op_embedding.cpp b/examples/cadence/ops/op_embedding.cpp similarity index 100% rename from examples/xtensa/ops/op_embedding.cpp rename to examples/cadence/ops/op_embedding.cpp diff --git a/examples/xtensa/ops/op_full.cpp b/examples/cadence/ops/op_full.cpp similarity index 100% rename from examples/xtensa/ops/op_full.cpp rename to examples/cadence/ops/op_full.cpp diff --git a/examples/xtensa/ops/op_view_copy.cpp b/examples/cadence/ops/op_view_copy.cpp similarity index 100% rename from examples/xtensa/ops/op_view_copy.cpp rename to examples/cadence/ops/op_view_copy.cpp diff --git a/examples/xtensa/ops/quantize_per_tensor.cpp b/examples/cadence/ops/quantize_per_tensor.cpp similarity index 100% rename from examples/xtensa/ops/quantize_per_tensor.cpp rename to examples/cadence/ops/quantize_per_tensor.cpp diff --git a/examples/xtensa/ops/quantized_conv_out.cpp b/examples/cadence/ops/quantized_conv_out.cpp similarity index 100% rename from examples/xtensa/ops/quantized_conv_out.cpp rename to examples/cadence/ops/quantized_conv_out.cpp diff --git a/examples/xtensa/ops/quantized_layer_norm.cpp b/examples/cadence/ops/quantized_layer_norm.cpp similarity index 100% rename from examples/xtensa/ops/quantized_layer_norm.cpp rename to examples/cadence/ops/quantized_layer_norm.cpp diff --git a/examples/xtensa/ops/quantized_linear_out.cpp b/examples/cadence/ops/quantized_linear_out.cpp similarity index 100% rename from examples/xtensa/ops/quantized_linear_out.cpp rename to examples/cadence/ops/quantized_linear_out.cpp diff --git a/examples/xtensa/ops/quantized_relu_out.cpp b/examples/cadence/ops/quantized_relu_out.cpp similarity index 100% rename from examples/xtensa/ops/quantized_relu_out.cpp rename to examples/cadence/ops/quantized_relu_out.cpp diff --git a/examples/xtensa/tests/quantized_conv1d_example.py b/examples/cadence/tests/quantized_conv1d_example.py similarity index 93% rename from examples/xtensa/tests/quantized_conv1d_example.py rename to examples/cadence/tests/quantized_conv1d_example.py index aa29c85c166..47ec4e9b661 100644 --- a/examples/xtensa/tests/quantized_conv1d_example.py +++ b/examples/cadence/tests/quantized_conv1d_example.py @@ -12,7 +12,7 @@ import torch -from ..aot.export_example import export_xtensa_model +from ..aot.export_example import export_model FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s" @@ -55,4 +55,4 @@ def forward(self, x: torch.Tensor): example_inputs = (torch.randn(shape),) - export_xtensa_model(model, example_inputs) + export_model(model, example_inputs) diff --git a/examples/xtensa/tests/quantized_linear_example.py b/examples/cadence/tests/quantized_linear_example.py similarity index 91% rename from examples/xtensa/tests/quantized_linear_example.py rename to examples/cadence/tests/quantized_linear_example.py index 410a825ee92..916b684173a 100644 --- a/examples/xtensa/tests/quantized_linear_example.py +++ b/examples/cadence/tests/quantized_linear_example.py @@ -12,7 +12,7 @@ import torch -from ..aot.export_example import export_xtensa_model +from ..aot.export_example import export_model FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s" @@ -39,4 +39,4 @@ def forward(self, x: torch.Tensor): example_inputs = (torch.ones(shape),) - export_xtensa_model(model, example_inputs) + export_model(model, example_inputs) diff --git a/examples/xtensa/tests/rnnt_predictor_quantized_example.py b/examples/cadence/tests/rnnt_predictor_quantized_example.py similarity index 94% rename from examples/xtensa/tests/rnnt_predictor_quantized_example.py rename to examples/cadence/tests/rnnt_predictor_quantized_example.py index cfc1531cb7c..fd94f48f88b 100644 --- a/examples/xtensa/tests/rnnt_predictor_quantized_example.py +++ b/examples/cadence/tests/rnnt_predictor_quantized_example.py @@ -14,7 +14,7 @@ from typing import Tuple -from ..aot.export_example import export_xtensa_model +from ..aot.export_example import export_model FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s" @@ -66,4 +66,4 @@ def forward( predictor_lengths, ) - export_xtensa_model(model, example_inputs) + export_model(model, example_inputs) diff --git a/examples/xtensa/third-party/nnlib-hifi4/license.txt b/examples/cadence/third-party/nnlib-hifi4/license.txt similarity index 100% rename from examples/xtensa/third-party/nnlib-hifi4/license.txt rename to examples/cadence/third-party/nnlib-hifi4/license.txt diff --git a/examples/xtensa/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u.cpp b/examples/cadence/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u.cpp similarity index 100% rename from examples/xtensa/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u.cpp rename to examples/cadence/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u.cpp diff --git a/examples/xtensa/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u_macros.h b/examples/cadence/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u_macros.h similarity index 100% rename from examples/xtensa/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u_macros.h rename to examples/cadence/third-party/nnlib-hifi4/matmul_asym8uxasym8u_asym8u_macros.h diff --git a/examples/xtensa/third-party/nnlib-hifi4/xa_nnlib_matmul_unroll_macros.h b/examples/cadence/third-party/nnlib-hifi4/xa_nnlib_matmul_unroll_macros.h similarity index 100% rename from examples/xtensa/third-party/nnlib-hifi4/xa_nnlib_matmul_unroll_macros.h rename to examples/cadence/third-party/nnlib-hifi4/xa_nnlib_matmul_unroll_macros.h diff --git a/examples/xtensa/utils/gen_header.py b/examples/cadence/utils/gen_header.py similarity index 100% rename from examples/xtensa/utils/gen_header.py rename to examples/cadence/utils/gen_header.py diff --git a/examples/xtensa/utils/post_compilation.py b/examples/cadence/utils/post_compilation.py similarity index 100% rename from examples/xtensa/utils/post_compilation.py rename to examples/cadence/utils/post_compilation.py