Skip to content

Commit 09f9a61

Browse files
dbortfacebook-github-bot
authored andcommitted
Migrate backends/arm to the new namespace
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. Differential Revision: D63923290
1 parent d9aeca5 commit 09f9a61

File tree

3 files changed

+44
-13
lines changed

3 files changed

+44
-13
lines changed

backends/arm/runtime/ArmBackendEthosU.cpp

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,30 @@
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::Result;
38+
39+
namespace executorch {
40+
namespace backends {
41+
namespace arm {
2942

3043
typedef struct {
3144
FreeableBuffer* processed;
@@ -268,7 +281,7 @@ class ArmBackend final : public ::executorch::runtime::BackendInterface {
268281
private:
269282
Error check_requires_permute(
270283
int index,
271-
const exec_aten::Tensor tensor,
284+
const executorch::aten::Tensor tensor,
272285
VelaIO* io,
273286
bool permuted_io_flag,
274287
bool* is_permuted) const {
@@ -343,5 +356,6 @@ Backend backend_id{"ArmBackend", &backend};
343356
static auto registered = register_backend(backend_id);
344357
} // namespace
345358

346-
} // namespace executor
347-
} // namespace torch
359+
} // namespace arm
360+
} // namespace backends
361+
} // 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)