Skip to content

Commit 0ce0066

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
delete Constants.h
Summary: https://docs.google.com/spreadsheets/d/17mEkBHN0XwXN21pG2IxpANX-jd4hNMrX4x9FthYB5Ok/edit#gid=0 I dont think this is a file thats worth maintaining in executorch repo, so I'm deleting it. With this change executorch/core is fully gone Reviewed By: dbort Differential Revision: D47338165 Privacy Context Container: L1124100 fbshipit-source-id: a63eb84aeb18b35d60824f2a1a91fc6d88e55bfb
1 parent 0b12480 commit 0ce0066

File tree

14 files changed

+23
-100
lines changed

14 files changed

+23
-100
lines changed

backends/test/demos/rpc/ExecutorBackend.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <cstdlib> /* strtol */
66
#include <memory>
77

8-
#include <executorch/core/Constants.h>
98
#include <executorch/runtime/backend/backend_registry.h>
109
#include <executorch/runtime/core/error.h>
1110
#include <executorch/runtime/core/evalue.h>
@@ -88,7 +87,7 @@ class ExecutorBackend final : public PyTorchBackendInterface {
8887
// dedicated to this specific hardware
8988
auto client_runtime_allocator = ET_ALLOCATE_INSTANCE_OR_RETURN_ERROR(
9089
runtime_allocator, MemoryAllocator);
91-
const size_t kClientRuntimeMemorySize = 4 * kKB;
90+
const size_t kClientRuntimeMemorySize = 4 * 1024U;
9291
auto runtime_pool = ET_ALLOCATE_OR_RETURN_ERROR(
9392
runtime_allocator, kClientRuntimeMemorySize);
9493
new (client_runtime_allocator) MemoryAllocator(

core/Constants.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

core/TARGETS

Lines changed: 0 additions & 6 deletions
This file was deleted.

core/targets.bzl

Lines changed: 0 additions & 25 deletions
This file was deleted.

pybindings/module.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <pybind11/pybind11.h>
66
#include <pybind11/stl.h>
77

8-
#include <executorch/core/Constants.h>
98
#include <executorch/runtime/core/data_loader.h>
109
#include <executorch/runtime/executor/executor.h>
1110
#include <executorch/runtime/executor/program.h>
@@ -274,9 +273,10 @@ py::object pyFromEValue(const EValue& v, KeepAlive& keep_alive) {
274273
ET_ASSERT_UNREACHABLE();
275274
}
276275

277-
static constexpr size_t kDEFAULT_NON_CONSTANT_POOL_SIZE = 256 * kMB;
278-
static constexpr size_t kRUNTIME_POOL_SIZE = 256 * kMB;
279-
static constexpr size_t kDEFAULT_BUNDLED_INPUT_POOL_SIZE = 16 * kKB;
276+
static constexpr size_t kDEFAULT_NON_CONSTANT_POOL_SIZE =
277+
256 * 1024U * 1024U; // 256 MB
278+
static constexpr size_t kRUNTIME_POOL_SIZE = 256 * 1024U * 1024U; // 256 MB
279+
static constexpr size_t kDEFAULT_BUNDLED_INPUT_POOL_SIZE = 16 * 1024U;
280280

281281
struct PyBundledModule final {
282282
explicit PyBundledModule(

runtime/core/targets.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def define_common_targets():
2727
],
2828
exported_deps = [
2929
"//executorch/runtime/platform:platform",
30-
"//executorch/core:core", # for legacy clients that need Constants.h or macros.h TODO remove this
3130
],
3231
)
3332

@@ -48,9 +47,11 @@ def define_common_targets():
4847
"hierarchical_allocator.h",
4948
"memory_allocator.h",
5049
],
50+
deps = [
51+
"//executorch/profiler:profiler",
52+
],
5153
exported_deps = [
5254
":core",
53-
"//executorch/profiler:profiler",
5455
],
5556
visibility = [
5657
"//executorch/...",

runtime/executor/test/allocation_failure_stress_test.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <filesystem>
33
#include <memory>
44

5-
#include <executorch/core/Constants.h>
65
#include <executorch/runtime/core/exec_aten/exec_aten.h>
76
#include <executorch/runtime/executor/executor.h>
87
#include <executorch/runtime/executor/test/managed_memory_manager.h>
@@ -18,16 +17,15 @@ using exec_aten::Scalar;
1817
using exec_aten::Tensor;
1918
using torch::executor::Error;
2019
using torch::executor::Executor;
21-
using torch::executor::kKB;
2220
using torch::executor::MemoryAllocator;
2321
using torch::executor::MemoryManager;
2422
using torch::executor::Program;
2523
using torch::executor::Result;
2624
using torch::executor::testing::ManagedMemoryManager;
2725
using torch::executor::util::FileDataLoader;
2826

29-
constexpr size_t kDefaultNonConstMemBytes = 32 * kKB;
30-
constexpr size_t kDefaultRuntimeMemBytes = 32 * kKB;
27+
constexpr size_t kDefaultNonConstMemBytes = 32 * 1024U;
28+
constexpr size_t kDefaultRuntimeMemBytes = 32 * 1024U;
3129

3230
class AllocationFailureStressTest : public ::testing::Test {
3331
protected:

runtime/executor/test/execution_plan_test.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <cstdlib>
22
#include <filesystem>
33

4-
#include <executorch/core/Constants.h>
54
#include <executorch/runtime/core/exec_aten/exec_aten.h>
65
#include <executorch/runtime/executor/executor.h>
76
#include <executorch/runtime/executor/test/managed_memory_manager.h>
@@ -15,14 +14,13 @@ using exec_aten::ArrayRef;
1514
using torch::executor::Error;
1615
using torch::executor::EValue;
1716
using torch::executor::Executor;
18-
using torch::executor::kKB;
1917
using torch::executor::Program;
2018
using torch::executor::Result;
2119
using torch::executor::testing::ManagedMemoryManager;
2220
using torch::executor::util::FileDataLoader;
2321

24-
constexpr size_t kDefaultNonConstMemBytes = 32 * kKB;
25-
constexpr size_t kDefaultRuntimeMemBytes = 32 * kKB;
22+
constexpr size_t kDefaultNonConstMemBytes = 32 * 1024U;
23+
constexpr size_t kDefaultRuntimeMemBytes = 32 * 1024U;
2624

2725
class ExecutionPlanTest : public ::testing::Test {
2826
protected:

runtime/executor/test/kernel_resolution_test.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <cstring>
55
#include <memory>
66

7-
#include <executorch/core/Constants.h>
87
#include <executorch/runtime/core/error.h>
98
#include <executorch/runtime/core/result.h>
109
#include <executorch/runtime/executor/executor.h>
@@ -24,7 +23,6 @@ using torch::executor::Executor;
2423
using torch::executor::Kernel;
2524
using torch::executor::KernelKey;
2625
using torch::executor::KernelRuntimeContext;
27-
using torch::executor::kKB;
2826
using torch::executor::Program;
2927
using torch::executor::register_kernels;
3028
using torch::executor::Result;
@@ -34,8 +32,8 @@ using torch::executor::TensorMeta;
3432
using torch::executor::testing::ManagedMemoryManager;
3533
using torch::executor::util::FileDataLoader;
3634

37-
constexpr size_t kDefaultNonConstMemBytes = 32 * kKB;
38-
constexpr size_t kDefaultRuntimeMemBytes = 32 * kKB;
35+
constexpr size_t kDefaultNonConstMemBytes = 32 * 1024U;
36+
constexpr size_t kDefaultRuntimeMemBytes = 32 * 1024U;
3937

4038
class KernelResolutionTest : public ::testing::Test {
4139
protected:

test/executor_runner.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <gflags/gflags.h>
22

3-
#include <executorch/core/Constants.h>
43
#include <executorch/runtime/executor/executor.h>
54
#include <executorch/runtime/platform/log.h>
65
#include <executorch/runtime/platform/profiler.h>
@@ -32,9 +31,9 @@
3231

3332
using namespace torch::executor;
3433

35-
static constexpr size_t kRuntimeMemorySize = 4 * kMB;
34+
static constexpr size_t kRuntimeMemorySize = 4 * 1024U * 1024U; // 4 MB
3635
static uint8_t runtime_pool[kRuntimeMemorySize];
37-
static constexpr size_t kBundledAllocatorPoolSize = 16 * kKB;
36+
static constexpr size_t kBundledAllocatorPoolSize = 16 * 1024U;
3837
static uint8_t bundled_allocator_pool[kBundledAllocatorPoolSize];
3938

4039
DEFINE_bool(

test/multi_runner.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <thread>
2424
#include <tuple>
2525

26-
#include <executorch/core/Constants.h>
2726
#include <executorch/runtime/core/error.h>
2827
#include <executorch/runtime/core/result.h>
2928
#include <executorch/runtime/executor/executor.h>
@@ -56,7 +55,6 @@ using torch::executor::DataLoader;
5655
using torch::executor::Error;
5756
using torch::executor::Executor;
5857
using torch::executor::FreeableBuffer;
59-
using torch::executor::kMB;
6058
using torch::executor::MemoryAllocator;
6159
using torch::executor::MemoryManager;
6260
using torch::executor::Program;
@@ -141,8 +139,8 @@ class ModelFactory {
141139
const std::string& name, // For debugging
142140
std::shared_ptr<const char> model_data,
143141
size_t model_data_size,
144-
size_t non_const_mem_bytes = 40 * kMB,
145-
size_t runtime_mem_bytes = 2 * kMB)
142+
size_t non_const_mem_bytes = 40 * 1024U * 1024U, // 40 MB
143+
size_t runtime_mem_bytes = 2 * 1024U * 1024U) // 2 MB
146144
: name_(name),
147145
model_data_(model_data),
148146
model_data_size_(model_data_size),

test/relocatable_runner.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <memory>
22
#include <vector>
33

4-
#include <executorch/core/Constants.h>
54
#include <executorch/runtime/executor/executor.h>
65
#include <executorch/runtime/platform/log.h>
76
#include <executorch/runtime/platform/runtime.h>
@@ -29,12 +28,12 @@ using namespace torch::executor;
2928
* This tool demonstrates that the memory can be managed this way.
3029
*/
3130

32-
static constexpr size_t kRuntimeMemorySize = 2 * kMB;
31+
static constexpr size_t kRuntimeMemorySize = 2 * 1024U * 1024U; // 2MB
3332
static uint8_t runtime_pool[kRuntimeMemorySize];
3433

3534
// This is to emulate the local memory that a particular instance of hardware
3635
// own and shared across different model instances
37-
static constexpr size_t kNonConstantMemorySize = 10 * kMB;
36+
static constexpr size_t kNonConstantMemorySize = 10 * 1024U * 1024U; // 10MB
3837
static uint8_t shared_local_non_constant_pool[kNonConstantMemorySize];
3938

4039
#define MAX_INPUTS_PER_MODEL 16
@@ -247,7 +246,7 @@ int main(int argc, char** argv) {
247246
* Step 2: Prepare the memory space required for worker core
248247
*/
249248
// The actual allocation size can be backend/model specific and smaller
250-
constexpr size_t kWorkerBufferSize = 1 * kMB;
249+
constexpr size_t kWorkerBufferSize = 1 * 1024U * 1024U; // 1 MB
251250
auto worker_buffer = std::make_unique<uint8_t[]>(kWorkerBufferSize);
252251
MemoryAllocator worker_allocator(kWorkerBufferSize, worker_buffer.get());
253252

test/size_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <executorch/core/Constants.h>
21
#include <executorch/runtime/executor/executor.h>
32
#include <executorch/runtime/executor/program.h>
43
#include <executorch/runtime/platform/log.h>

util/TestMemoryConfig.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <executorch/core/Constants.h>
43
#include <executorch/runtime/executor/memory_manager.h>
54
#include <memory>
65

@@ -12,10 +11,10 @@
1211
constexpr size_t NUM_NON_CONSTANT_POOLS = 1;
1312

1413
// NON_CONSTANT_POOL_SIZE is set at compilation
15-
constexpr size_t NON_CONSTANT_POOL_SIZE = 2 * torch::executor::kMB;
14+
constexpr size_t NON_CONSTANT_POOL_SIZE = 2 * 1024U * 1024U; // 2MB
1615

1716
// Memory used to save executor related structures
18-
constexpr size_t EXECUTOR_POOL_SIZE = 128 * torch::executor::kKB;
17+
constexpr size_t EXECUTOR_POOL_SIZE = 128 * 1024U;
1918

2019
namespace torch {
2120
namespace executor {

0 commit comments

Comments
 (0)