Skip to content

Commit c8324ed

Browse files
committed
Fix after review (2nd pass)
1 parent 56a1296 commit c8324ed

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

backends/nxp/backend/ir/converter/node_converters/ops_converters/softmax_converter.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def _is_supported_on_target(
6262
if custom_delegation_options.use_new_flow_neutron_c:
6363
"""New flow: Hardware constraints for the new flow:
6464
1. Input and Output must be INT8/UINT8
65-
2. Channels < 4096 / num_pipes * 4
66-
3. Total spatial size (N*H*W) <= 4096
67-
4. (channels * spatial_size) / num_macs <= 65536
65+
2. Channels <= 2040
66+
3. Total spatial size (H*W) <= 4096
67+
4. Total size (channels * spatial_size) <= 524288
6868
"""
6969
# Constraint 1: Input and Output must be INT8/UINT8.
7070
supported_types = [torch.int8, torch.uint8]
@@ -74,9 +74,8 @@ def _is_supported_on_target(
7474
return False
7575

7676
# Constraint 2: Channel size limit
77-
num_pipes = neutron_target_spec.get_num_pipes()
7877
channels = SoftmaxConverter._get_channels(node)
79-
if channels >= 4096 / num_pipes * 4:
78+
if channels > 2040:
8079
return False
8180

8281
# Constraint 3: Spatial size limit
@@ -85,8 +84,7 @@ def _is_supported_on_target(
8584
return False
8685

8786
# Constraint 4: Total processing size limit
88-
num_macs = neutron_target_spec.get_num_macs()
89-
if channels * total_spatial_size / num_macs > 65536:
87+
if channels * total_spatial_size > 524288:
9088
return False
9189

9290
return True

backends/nxp/tests/ir/converter/node_converter/test_softmax_converter.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
ToChannelLastPreprocess,
1919
)
2020

21-
from executorch.backends.nxp.tests.graph_verifier import BaseGraphVerifier
21+
from executorch.backends.nxp.tests.graph_verifier import DetailedGraphVerifier
2222

2323
from executorch.backends.nxp.tests.model_output_comparator import (
2424
NumericalStatsOutputComparator,
@@ -224,11 +224,12 @@ class TestSoftmaxNewNeutronFlow:
224224
pytest.param((5, 4, 3, 2, 180), -1, id="5D_dim_-1"),
225225
],
226226
)
227-
def test__basic_nsys_inference(self, input_shape, dim):
227+
def test__basic_nsys_inference(self, mocker, input_shape, dim):
228228
model = SoftmaxModule(dim)
229-
graph_verifier = BaseGraphVerifier(
230-
exp_num_delegate_call_nodes=1, # Delegated Softmax.
231-
exp_non_delegated_nodes=[],
229+
graph_verifier = DetailedGraphVerifier(
230+
mocker,
231+
expected_delegated_ops={Softmax: 1},
232+
expected_non_delegated_ops={},
232233
)
233234
output_comparator = NumericalStatsOutputComparator(
234235
max_mse_error=0.001, is_classification_task=True

0 commit comments

Comments
 (0)