Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backends/nxp/backend/custom_delegation_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ class CustomDelegationOptions:
# not create any NeutronGraph that can be called. This is done by the partitioner itself, and is not handled by
# the individual node converters.
allow_no_op_partitions: bool = False

# The new neutron converter flow has different constraints for supported operators. These need to be addressed when
# deciding is operator is delegated or not in _is_supported_on_target().
use_new_flow_neutron_c: bool = False
6 changes: 6 additions & 0 deletions backends/nxp/nxp_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import numpy as np
import torch

from executorch.backends.nxp.backend.custom_delegation_options import (
CustomDelegationOptions,
)
from executorch.backends.nxp.backend.data_format import DataFormat
from executorch.backends.nxp.backend.edge_program_converter import (
EdgeProgramToIRConverter,
Expand Down Expand Up @@ -229,6 +232,9 @@ def preprocess( # noqa C901
edge_program,
neutron_target_spec=NeutronTargetSpec(target),
conversion_config=conversion_config,
custom_delegation_options=CustomDelegationOptions(
use_new_flow_neutron_c=use_new_flow_neutron_c
),
)

neutron_model = NeutronConverterManager(dump_kernel_selection_code).convert(
Expand Down
1 change: 1 addition & 0 deletions backends/nxp/tests/executorch_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def to_quantized_edge_program(
delegate_to_npu=True,
) -> EdgeProgramManager:
_neutron_target_spec = NeutronTargetSpec(target)
custom_delegation_options.use_new_flow_neutron_c = use_new_flow_neutron_c
if get_quantizer_fn is None:
get_quantizer_fn = partial(
_get_default_quantizer, _neutron_target_spec, use_qat
Expand Down
26 changes: 26 additions & 0 deletions backends/nxp/tests/ops_aliases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2026 NXP
Comment thread
roman-janik-nxp marked this conversation as resolved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# This file defines ops aliases for shorter and more readable test description. List is sorted alphabetically.
# When finding a missing alias, add it at the correct place.

import torch
from executorch.exir.dialects._ops import ops as exir_ops

AvgPool2D = exir_ops.edge.aten.avg_pool2d.default
Bmm = exir_ops.edge.aten.bmm.default
ExecutorchDelegateCall = torch.ops.higher_order.executorch_call_delegate
HardTanh = exir_ops.edge.aten.hardtanh.default
HardTanh_ = exir_ops.edge.aten.hardtanh_.default
Slice = exir_ops.edge.aten.slice.Tensor
SliceCopy = exir_ops.edge.aten.slice_copy.Tensor
Softmax = exir_ops.edge.aten._softmax.default
Squeeze = exir_ops.edge.aten.squeeze.default
SqueezeDim = exir_ops.edge.aten.squeeze.dim
SqueezeDims = exir_ops.edge.aten.squeeze.dims
Unsqueeze = exir_ops.edge.aten.unsqueeze.default
UpsampleBilinear2D = exir_ops.edge.aten.upsample_bilinear2d.vec
UpsampleNearest2D = exir_ops.edge.aten.upsample_nearest2d.vec
ViewCopy = exir_ops.edge.aten.view_copy.default
Loading