Skip to content

Migrate backends/arm to the new namespace #5904

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

Closed
wants to merge 1 commit into from
Closed
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
41 changes: 28 additions & 13 deletions backends/arm/runtime/ArmBackendEthosU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,31 @@

#include <ethosu_driver.h>

#include "executorch/backends/arm/runtime/VelaBinStream.h"
#include "executorch/runtime/backend/interface.h"
#include "executorch/runtime/core/error.h"
#include "executorch/runtime/core/evalue.h"
#include "executorch/runtime/core/exec_aten/util/dim_order_util.h"
#include "executorch/runtime/core/exec_aten/util/scalar_type_util.h"
#include <executorch/backends/arm/runtime/VelaBinStream.h>
#include <executorch/runtime/backend/interface.h>
#include <executorch/runtime/core/error.h>
#include <executorch/runtime/core/evalue.h>
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>

using namespace std;

namespace torch {
namespace executor {
using executorch::aten::ScalarType;
using executorch::runtime::ArrayRef;
using executorch::runtime::Backend;
using executorch::runtime::BackendExecutionContext;
using executorch::runtime::BackendInitContext;
using executorch::runtime::CompileSpec;
using executorch::runtime::DelegateHandle;
using executorch::runtime::Error;
using executorch::runtime::EValue;
using executorch::runtime::FreeableBuffer;
using executorch::runtime::MemoryAllocator;
using executorch::runtime::Result;

namespace executorch {
namespace backends {
namespace arm {

typedef struct {
FreeableBuffer* processed;
Expand Down Expand Up @@ -142,10 +156,10 @@ class ArmBackend final : public ::executorch::runtime::BackendInterface {
Error,
"Input %d expected Integer (4 byte) or Char (1 byte) integer inputs, got ScalarType id %s",
i,
toString(tensor_in.scalar_type()));
executorch::runtime::toString(tensor_in.scalar_type()));
return Error::InvalidProgram;
}
supported = is_contiguous_dim_order(
supported = executorch::runtime::is_contiguous_dim_order(
tensor_in.dim_order().data(), tensor_in.dim());
if (!supported) {
ET_LOG(
Expand Down Expand Up @@ -268,7 +282,7 @@ class ArmBackend final : public ::executorch::runtime::BackendInterface {
private:
Error check_requires_permute(
int index,
const exec_aten::Tensor tensor,
const executorch::aten::Tensor tensor,
VelaIO* io,
bool permuted_io_flag,
bool* is_permuted) const {
Expand Down Expand Up @@ -343,5 +357,6 @@ Backend backend_id{"ArmBackend", &backend};
static auto registered = register_backend(backend_id);
} // namespace

} // namespace executor
} // namespace torch
} // namespace arm
} // namespace backends
} // namespace executorch
13 changes: 11 additions & 2 deletions backends/arm/runtime/VelaBinStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
* as that function emits this format and the two need to align.
*/

#include <executorch/backends/arm/runtime/VelaBinStream.h>

#include <cstring>

#include "executorch/backends/arm/runtime/VelaBinStream.h"
#include "executorch/runtime/core/error.h"
#include <executorch/runtime/core/error.h>

namespace executorch {
namespace backends {
namespace arm {

// get next mul of 16 ptr, return n if already aligned
static uintptr_t next_mul_16(uintptr_t n) {
Expand Down Expand Up @@ -91,3 +96,7 @@ bool vela_bin_read(const char* data, VelaHandles* handles, int size) {
// We've fallen off the end without finding vela_end_stream
return false;
}

} // namespace arm
} // namespace backends
} // namespace executorch
8 changes: 8 additions & 0 deletions backends/arm/runtime/VelaBinStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include <cstddef>
#include <cstdint>

namespace executorch {
namespace backends {
namespace arm {

// Standard block name size
const uint32_t kVelaBlockNameLength = 16;

Expand Down Expand Up @@ -67,3 +71,7 @@ bool vela_bin_read(const char* data, VelaHandles* handles, int size);
* on the Ethos-U.
*/
bool vela_bin_validate(const char* data, int size);

} // namespace arm
} // namespace backends
} // namespace executorch
Loading