Skip to content

Commit 4ea2808

Browse files
dbortfacebook-github-bot
authored andcommitted
Migrate backends/arm to the new namespace (#5904)
Summary: Move the Arm backend out of the `torch::` namespace, and update to avoid using the `torch::` or `exec_aten::` namespaces. Also, move the VelaBinStream code into a namespace to avoid declaring symbols in the global namespace. Reviewed By: mergennachin Differential Revision: D63923290
1 parent 6e871c3 commit 4ea2808

File tree

3 files changed

+47
-15
lines changed

3 files changed

+47
-15
lines changed

backends/arm/runtime/ArmBackendEthosU.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,31 @@
1515

1616
#include <ethosu_driver.h>
1717

18-
#include "executorch/backends/arm/runtime/VelaBinStream.h"
19-
#include "executorch/runtime/backend/interface.h"
20-
#include "executorch/runtime/core/error.h"
21-
#include "executorch/runtime/core/evalue.h"
22-
#include "executorch/runtime/core/exec_aten/util/dim_order_util.h"
23-
#include "executorch/runtime/core/exec_aten/util/scalar_type_util.h"
18+
#include <executorch/backends/arm/runtime/VelaBinStream.h>
19+
#include <executorch/runtime/backend/interface.h>
20+
#include <executorch/runtime/core/error.h>
21+
#include <executorch/runtime/core/evalue.h>
22+
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
23+
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>
2424

2525
using namespace std;
2626

27-
namespace torch {
28-
namespace executor {
27+
using executorch::aten::ScalarType;
28+
using executorch::runtime::ArrayRef;
29+
using executorch::runtime::Backend;
30+
using executorch::runtime::BackendExecutionContext;
31+
using executorch::runtime::BackendInitContext;
32+
using executorch::runtime::CompileSpec;
33+
using executorch::runtime::DelegateHandle;
34+
using executorch::runtime::Error;
35+
using executorch::runtime::EValue;
36+
using executorch::runtime::FreeableBuffer;
37+
using executorch::runtime::MemoryAllocator;
38+
using executorch::runtime::Result;
39+
40+
namespace executorch {
41+
namespace backends {
42+
namespace arm {
2943

3044
typedef struct {
3145
FreeableBuffer* processed;
@@ -142,10 +156,10 @@ class ArmBackend final : public ::executorch::runtime::BackendInterface {
142156
Error,
143157
"Input %d expected Integer (4 byte) or Char (1 byte) integer inputs, got ScalarType id %s",
144158
i,
145-
toString(tensor_in.scalar_type()));
159+
executorch::runtime::toString(tensor_in.scalar_type()));
146160
return Error::InvalidProgram;
147161
}
148-
supported = is_contiguous_dim_order(
162+
supported = executorch::runtime::is_contiguous_dim_order(
149163
tensor_in.dim_order().data(), tensor_in.dim());
150164
if (!supported) {
151165
ET_LOG(
@@ -268,7 +282,7 @@ class ArmBackend final : public ::executorch::runtime::BackendInterface {
268282
private:
269283
Error check_requires_permute(
270284
int index,
271-
const exec_aten::Tensor tensor,
285+
const executorch::aten::Tensor tensor,
272286
VelaIO* io,
273287
bool permuted_io_flag,
274288
bool* is_permuted) const {
@@ -343,5 +357,6 @@ Backend backend_id{"ArmBackend", &backend};
343357
static auto registered = register_backend(backend_id);
344358
} // namespace
345359

346-
} // namespace executor
347-
} // namespace torch
360+
} // namespace arm
361+
} // namespace backends
362+
} // namespace executorch

backends/arm/runtime/VelaBinStream.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
* as that function emits this format and the two need to align.
1111
*/
1212

13+
#include <executorch/backends/arm/runtime/VelaBinStream.h>
14+
1315
#include <cstring>
1416

15-
#include "executorch/backends/arm/runtime/VelaBinStream.h"
16-
#include "executorch/runtime/core/error.h"
17+
#include <executorch/runtime/core/error.h>
18+
19+
namespace executorch {
20+
namespace backends {
21+
namespace arm {
1722

1823
// get next mul of 16 ptr, return n if already aligned
1924
static uintptr_t next_mul_16(uintptr_t n) {
@@ -91,3 +96,7 @@ bool vela_bin_read(const char* data, VelaHandles* handles, int size) {
9196
// We've fallen off the end without finding vela_end_stream
9297
return false;
9398
}
99+
100+
} // namespace arm
101+
} // namespace backends
102+
} // namespace executorch

backends/arm/runtime/VelaBinStream.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include <cstddef>
1919
#include <cstdint>
2020

21+
namespace executorch {
22+
namespace backends {
23+
namespace arm {
24+
2125
// Standard block name size
2226
const uint32_t kVelaBlockNameLength = 16;
2327

@@ -67,3 +71,7 @@ bool vela_bin_read(const char* data, VelaHandles* handles, int size);
6771
* on the Ethos-U.
6872
*/
6973
bool vela_bin_validate(const char* data, int size);
74+
75+
} // namespace arm
76+
} // namespace backends
77+
} // namespace executorch

0 commit comments

Comments
 (0)