Skip to content

Commit dedfdaf

Browse files
Arm backend: Support Short input dtype in EthosUDelegate (#8761)
1 parent 8348ec0 commit dedfdaf

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

backends/arm/runtime/EthosUBackend.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
193193
supported |=
194194
(tensor_in.scalar_type() == ScalarType::Char and
195195
handles.inputs->io[i].elem_size == 1);
196+
// 16 bit int (IOQDQ pass prepared networks)
197+
supported |=
198+
(tensor_in.scalar_type() == ScalarType::Short and
199+
handles.inputs->io[i].elem_size == 2);
196200
if (!supported) {
197201
ET_LOG(
198202
Error,
@@ -220,6 +224,8 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
220224
handles.inputs->io[i].elem_size == 1;
221225
bool both_int = tensor_in.scalar_type() == ScalarType::Int and
222226
handles.inputs->io[i].elem_size == 4;
227+
bool both_short = tensor_in.scalar_type() == ScalarType::Short and
228+
handles.inputs->io[i].elem_size == 2;
223229

224230
// Select a compatible copy routine
225231
if (both_char and permuted_input_shape) {
@@ -233,7 +239,7 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
233239
tensor_in.size(1),
234240
tensor_in.size(2),
235241
tensor_in.size(3));
236-
} else if (both_char or both_int) {
242+
} else if (both_char or both_int or both_short) {
237243
EXECUTORCH_PROF_SCOPE(
238244
event_tracer, "+EthosUBackend::execute()handles.input.memcpy()");
239245
// Sizes match and elt size matches so memcpy

backends/arm/test/ops/test_rshift.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Copyright 2024-2025 Arm Limited and/or its affiliates.
2-
# All rights reserved.
32
#
43
# This source code is licensed under the BSD-style license found in the
54
# LICENSE file in the root directory of this source tree.
@@ -75,16 +74,14 @@ def test_rshift_tosa_MI(self, test_data):
7574
def test_rshift_tosa_BI(self, test_data):
7675
self._test_rshift_tosa_BI(test_data)
7776

78-
# TODO: MLETORCH-644 - Add support for INT16 input/output
79-
@parameterized.expand(Rshift.test_data[:-1])
77+
@parameterized.expand(Rshift.test_data)
8078
def test_rshift_u55_BI(self, test_data):
8179
compile_spec = common.get_u55_compile_spec()
8280
tester = self._test_rshift_ethosu_BI(test_data, compile_spec)
8381
if conftest.is_option_enabled("corstone_fvp"):
8482
tester.run_method_and_compare_outputs(atol=1, inputs=test_data)
8583

86-
# TODO: MLETORCH-644 - Add support for INT16 input/output
87-
@parameterized.expand(Rshift.test_data[:-1])
84+
@parameterized.expand(Rshift.test_data)
8885
def test_rshift_u85_BI(self, test_data):
8986
compile_spec = common.get_u85_compile_spec()
9087
tester = self._test_rshift_ethosu_BI(test_data, compile_spec)

0 commit comments

Comments
 (0)