Skip to content

Commit adae047

Browse files
tarun292facebook-github-bot
authored andcommitted
Abstracting away flatcc from any users of etdump (#1376)
Summary: Pull Request resolved: #1376 This diff hides away all the flatcc types and isolates them `etdump_flatcc.cpp` so that any user who includes `etdump_flatcc.h` doesn't need to access any of the flatcc namespace variables. Most of these issues surfaced while integrating etdump into coreml_executor_runner. Reviewed By: Jack-Khuu Differential Revision: D51966334 fbshipit-source-id: 7b89c39a8ac41272fbcaa8ece70ec3863c6c0136
1 parent a08c8b7 commit adae047

File tree

5 files changed

+208
-207
lines changed

5 files changed

+208
-207
lines changed

sdk/etdump/emitter.h

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,14 @@
99
#include <stdint.h>
1010
#include <stdlib.h>
1111

12+
#include <executorch/sdk/etdump/etdump_flatcc.h>
1213
#include <flatcc/flatcc_builder.h>
1314

1415
#pragma once
1516

1617
namespace torch {
1718
namespace executor {
1819

19-
struct etdump_static_allocator {
20-
etdump_static_allocator(
21-
uint8_t* buffer,
22-
size_t total_buf_size,
23-
size_t alloc_buf_size)
24-
: data{buffer},
25-
data_size{alloc_buf_size},
26-
allocated{0},
27-
out_size{total_buf_size - alloc_buf_size},
28-
front_cursor{&buffer[alloc_buf_size]},
29-
front_left{out_size / 2} {}
30-
// Pointer to backing buffer to allocate from.
31-
uint8_t* data{nullptr};
32-
33-
// Size of backing buffer.
34-
size_t data_size{0};
35-
36-
// Current allocation offset.
37-
size_t allocated{0};
38-
39-
// Size of build buffer.
40-
size_t out_size{0};
41-
42-
// Pointer to front of build buffer.
43-
uint8_t* front_cursor{nullptr};
44-
45-
// Bytes left in front of front_cursor.
46-
size_t front_left{0};
47-
};
48-
4920
int et_flatcc_custom_init(
5021
flatcc_builder_t* builder,
5122
struct etdump_static_allocator* alloc);

0 commit comments

Comments
 (0)