Skip to content

Arm backend: Revert 5D-updates to EthosUBackend #11522

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
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
52 changes: 10 additions & 42 deletions backends/arm/runtime/EthosUBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,24 +261,12 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
event_tracer,
"+EthosUBackend::execute()handles.input.permute_CHW_to_HWC()");
// permuted byte copy CHW to HWC
int c, h, w;
if (tensor_in.dim() == 4) {
c = tensor_in.size(1);
h = tensor_in.size(2);
w = tensor_in.size(3);
} else if (tensor_in.dim() == 5) {
c = tensor_in.size(2);
h = tensor_in.size(3);
w = tensor_in.size(4);
} else {
ET_LOG(
Error,
"Unsupported input tensor dimension %d, expected 4 or 5",
tensor_in.dim());
return Error::InvalidProgram;
}
permute_CHW_to_HWC(
tensor_in.mutable_data_ptr<char>(), scratch_addr, c, h, w);
tensor_in.mutable_data_ptr<char>(),
scratch_addr,
tensor_in.size(1),
tensor_in.size(2),
tensor_in.size(3));
} else if (both_char or both_int or both_short) {
EXECUTORCH_PROF_SCOPE(
event_tracer, "+EthosUBackend::execute()handles.input.memcpy()");
Expand Down Expand Up @@ -376,24 +364,12 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
"+EthosUBackend::execute()handles.output.permute_HWC_to_CHW()");

char* output_address = (char*)output_addr;
int c, h, w;
if (tensor_out.dim() == 4) {
c = tensor_out.size(1);
h = tensor_out.size(2);
w = tensor_out.size(3);
} else if (tensor_out.dim() == 5) {
c = tensor_out.size(2);
h = tensor_out.size(3);
w = tensor_out.size(4);
} else {
ET_LOG(
Error,
"Unsupported output tensor dimension %d, expected 4 or 5",
tensor_out.dim());
return Error::InvalidProgram;
}
permute_HWC_to_CHW(
output_address, tensor_out.mutable_data_ptr<char>(), c, h, w);
output_address,
tensor_out.mutable_data_ptr<char>(),
tensor_out.size(1),
tensor_out.size(2),
tensor_out.size(3));
} else {
EXECUTORCH_PROF_SCOPE(
event_tracer, "+EthosUBackend::execute()handles.output.move()");
Expand Down Expand Up @@ -454,14 +430,6 @@ class EthosUBackend final : public ::executorch::runtime::BackendInterface {
if (permuted_shape) {
ET_LOG(Debug, "Tensor input/output %d will be permuted", index);
}
} else if (tensor.dim() == 5) {
// Same as above, but for 5D tensors.
permuted_shape = tensor.size(0) == io->shape[0] &&
tensor.size(1) == io->shape[1] && tensor.size(2) == io->shape[4] &&
tensor.size(3) == io->shape[2] && tensor.size(4) == io->shape[3];
if (permuted_shape) {
ET_LOG(Debug, "Tensor input/output %d will be permuted", index);
}
}
*is_permuted = permuted_shape;
return Error::Ok;
Expand Down
Loading