Skip to content

Revert "Milestone3.1: Support tanh op in XNNPACK backend (#11364)" #11535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
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
1 change: 0 additions & 1 deletion backends/xnnpack/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@
op_static_constant_pad,
op_static_resize_bilinear_2d,
op_sub,
op_tanh,
op_to_copy,
)
52 changes: 0 additions & 52 deletions backends/xnnpack/operators/op_tanh.py

This file was deleted.

2 changes: 0 additions & 2 deletions backends/xnnpack/partition/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
SoftmaxConfig,
SquareRootConfig,
SubConfig,
TanhConfig,
UpsampleBilinear2dConfig,
)
from executorch.backends.xnnpack.partition.config.node_configs import (
Expand Down Expand Up @@ -102,7 +101,6 @@
PreluConfig,
ReciprocalSquareRootConfig,
ReLUConfig,
TanhConfig,
# SDPAConfig, TODO: D60553559: preserving SDPA for fairseq fails
SigmoidConfig,
SliceCopyConfig,
Expand Down
7 changes: 0 additions & 7 deletions backends/xnnpack/partition/config/generic_node_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,6 @@ def supported_precision_types(self) -> List[ConfigPrecisionType]:
return [ConfigPrecisionType.FP32]


class TanhConfig(GenericNodePartitionerConfig):
target_name = "tanh.default"

def supported_precision_types(self) -> List[ConfigPrecisionType]:
return [ConfigPrecisionType.FP32]


class MeanDimConfig(GenericNodePartitionerConfig):
target_name = "mean.dim"

Expand Down
1 change: 0 additions & 1 deletion backends/xnnpack/partition/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
exir_ops.edge.aten.rsqrt.default,
exir_ops.edge.aten.log.default,
exir_ops.edge.aten.gelu.default,
exir_ops.edge.aten.tanh.default,
]

SUPPORTED_MODULES = [
Expand Down
31 changes: 0 additions & 31 deletions backends/xnnpack/runtime/XNNCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,36 +1521,6 @@ Error defineGeluNode(
return Error::Ok;
}

/*
Define serialized tanh node into the subgraph, using the remapped ids
to map the serialized ids, to the new ids generated when defining the
tensor value
*/
Error defineTanhNode(
xnn_subgraph_t subgraph_ptr,
const std::unordered_map<uint32_t, uint32_t>& remapped_ids,
const NodePtr node,
const fb_xnnpack::XNNGraph* graph) noexcept {
MAYBE_UNUSED(graph);

auto graph_node = node->xnode_union_as_XNNTanh();

xnn_status status = xnn_define_tanh(
subgraph_ptr,
remapped_ids.at(graph_node->input_id()),
remapped_ids.at(graph_node->output_id()),
graph_node->flags());

ET_CHECK_OR_RETURN_ERROR(
status == xnn_status_success,
Internal,
"Failed to create tanh node %i with code: %s",
node->debug_handle(),
xnn_status_to_string(status));

return Error::Ok;
}

/*
Define serialized ceiling node into the subgraph, using the remapped ids
to map the serialized ids, to the new ids generated when defining the
Expand Down Expand Up @@ -2146,7 +2116,6 @@ DefineNodeFunc getDefineNodeFunc(fb_xnnpack::XNodeUnion nodeType) {
_DEFINE(Hardswish)
_DEFINE(LeakyReLU)
_DEFINE(Log)
_DEFINE(Tanh)
_DEFINE(Maximum)
_DEFINE(Negate)
_DEFINE(Square)
Expand Down
1 change: 0 additions & 1 deletion backends/xnnpack/serialization/runtime_schema.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ union XNodeUnion {
XNNReciprocalSquareRoot: _XNNNode1x1,
XNNLog: _XNNNode1x1,
XNNGelu: _XNNNode1x1,
XNNTanh: _XNNNode1x1,
}

union XValueUnion {
Expand Down
1 change: 0 additions & 1 deletion backends/xnnpack/serialization/schema.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ union XNodeUnion {
XNNReciprocalSquareRoot: _XNNNode1x1,
XNNLog: _XNNNode1x1,
XNNGelu: _XNNNode1x1,
XNNTanh: _XNNNode1x1,
}

union XValueUnion {
Expand Down
6 changes: 0 additions & 6 deletions backends/xnnpack/serialization/xnnpack_graph_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,6 @@ class XNNLog(XNNNode1x1):
pass


@dataclass
class XNNTanh(XNNNode1x1):
pass


@dataclass
class XNNMaximum(XNNNode2x1):
pass
Expand Down Expand Up @@ -401,7 +396,6 @@ class XNNScaledDotProductAttention:
XNNReciprocalSquareRoot,
XNNLog,
XNNGelu,
XNNTanh,
]


Expand Down
43 changes: 0 additions & 43 deletions backends/xnnpack/test/ops/test_tanh.py

This file was deleted.

Loading