@@ -75,7 +75,20 @@ DEFINE_int32(
75
75
262144 , // 256 KB
76
76
" Size of the debug buffer in bytes to allocate for intermediate outputs and program outputs logging." );
77
77
78
- using namespace torch ::executor;
78
+ using executorch::etdump::ETDumpGen;
79
+ using executorch::etdump::ETDumpResult;
80
+ using executorch::extension::BufferDataLoader;
81
+ using executorch::runtime::Error;
82
+ using executorch::runtime::EValue;
83
+ using executorch::runtime::EventTracerDebugLogLevel;
84
+ using executorch::runtime::HierarchicalAllocator;
85
+ using executorch::runtime::MemoryAllocator;
86
+ using executorch::runtime::MemoryManager;
87
+ using executorch::runtime::Method;
88
+ using executorch::runtime::MethodMeta;
89
+ using executorch::runtime::Program;
90
+ using executorch::runtime::Result;
91
+ using executorch::runtime::Span;
79
92
80
93
std::vector<uint8_t > load_file_or_die (const char * path) {
81
94
std::ifstream file (path, std::ios::binary | std::ios::ate);
@@ -90,7 +103,7 @@ std::vector<uint8_t> load_file_or_die(const char* path) {
90
103
}
91
104
92
105
int main (int argc, char ** argv) {
93
- runtime_init ();
106
+ executorch::runtime:: runtime_init ();
94
107
95
108
gflags::ParseCommandLineFlags (&argc, &argv, true );
96
109
if (argc != 1 ) {
@@ -109,19 +122,18 @@ int main(int argc, char** argv) {
109
122
// Find the offset to the embedded Program.
110
123
const void * program_data;
111
124
size_t program_data_len;
112
- Error status = torch::executor:: bundled_program::GetProgramData (
125
+ Error status = executorch:: bundled_program::get_program_data (
113
126
reinterpret_cast <void *>(file_data.data ()),
114
127
file_data.size (),
115
128
&program_data,
116
129
&program_data_len);
117
130
ET_CHECK_MSG (
118
131
status == Error::Ok,
119
- " GetProgramData () failed on file '%s': 0x%x" ,
132
+ " get_program_data () failed on file '%s': 0x%x" ,
120
133
bundled_program_path,
121
134
(unsigned int )status);
122
135
123
- auto buffer_data_loader =
124
- util::BufferDataLoader (program_data, program_data_len);
136
+ auto buffer_data_loader = BufferDataLoader (program_data, program_data_len);
125
137
126
138
// Parse the program file. This is immutable, and can also be reused
127
139
// between multiple execution invocations across multiple threads.
@@ -202,7 +214,7 @@ int main(int argc, char** argv) {
202
214
// the method can mutate the memory-planned buffers, so the method should only
203
215
// be used by a single thread at at time, but it can be reused.
204
216
//
205
- torch::executor:: ETDumpGen etdump_gen = torch::executor::ETDumpGen () ;
217
+ ETDumpGen etdump_gen;
206
218
Result<Method> method =
207
219
program->load_method (method_name, &memory_manager, &etdump_gen);
208
220
ET_CHECK_MSG (
@@ -225,7 +237,7 @@ int main(int argc, char** argv) {
225
237
EventTracerDebugLogLevel::kProgramOutputs );
226
238
}
227
239
// Use the inputs embedded in the bundled program.
228
- status = torch::executor:: bundled_program::LoadBundledInput (
240
+ status = executorch:: bundled_program::load_bundled_input (
229
241
*method, file_data.data (), FLAGS_testset_idx);
230
242
ET_CHECK_MSG (
231
243
status == Error::Ok,
@@ -262,7 +274,7 @@ int main(int argc, char** argv) {
262
274
263
275
// Dump the etdump data containing profiling/debugging data to the specified
264
276
// file.
265
- etdump_result result = etdump_gen.get_etdump_data ();
277
+ ETDumpResult result = etdump_gen.get_etdump_data ();
266
278
if (result.buf != nullptr && result.size > 0 ) {
267
279
FILE* f = fopen (FLAGS_etdump_path.c_str (), " w+" );
268
280
fwrite ((uint8_t *)result.buf , 1 , result.size , f);
@@ -272,14 +284,13 @@ int main(int argc, char** argv) {
272
284
273
285
if (FLAGS_output_verification) {
274
286
// Verify the outputs.
275
- status =
276
- torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput (
277
- *method,
278
- file_data.data (),
279
- FLAGS_testset_idx,
280
- 1e-3 , // rtol
281
- 1e-5 // atol
282
- );
287
+ status = executorch::bundled_program::verify_method_outputs (
288
+ *method,
289
+ file_data.data (),
290
+ FLAGS_testset_idx,
291
+ 1e-3 , // rtol
292
+ 1e-5 // atol
293
+ );
283
294
ET_CHECK_MSG (
284
295
status == Error::Ok,
285
296
" Bundle verification failed with status 0x%" PRIx32,
0 commit comments