Skip to content

Commit a62b45f

Browse files
Gasoonjiafacebook-github-bot
authored andcommitted
executor::util -> executor::bundled_program for bp runtime api
Summary: as title. Differential Revision: D50511103 fbshipit-source-id: ee730424bcb8ed9832fb884709aabfa39328bc58
1 parent 9e850ce commit a62b45f

File tree

6 files changed

+33
-32
lines changed

6 files changed

+33
-32
lines changed

docs/source/sdk-bundled-io.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ We need the pointer to ExecuTorch program to do the execution. To unify the proc
213213
:::{dropdown} `GetProgramData`
214214

215215
```{eval-rst}
216-
.. doxygenfunction:: torch::executor::util::GetProgramData
216+
.. doxygenfunction:: torch::executor::bundled_program::GetProgramData
217217
```
218218
:::
219219

@@ -232,7 +232,7 @@ ET_CHECK_MSG(
232232

233233
const void* program_ptr;
234234
size_t program_len;
235-
status = torch::executor::util::GetProgramData(
235+
status = torch::executor::bundled_program::GetProgramData(
236236
buff_ptr.get(), buff_len, &program_ptr, &program_len);
237237
ET_CHECK_MSG(
238238
status == Error::Ok,
@@ -241,22 +241,22 @@ ET_CHECK_MSG(
241241
```
242242
243243
### Load Bundled Input to Method
244-
To execute the program on the bundled input, we need to load the bundled input into the method. Here we provided an API called `torch::executor::util::LoadBundledInput`:
244+
To execute the program on the bundled input, we need to load the bundled input into the method. Here we provided an API called `torch::executor::bundled_program::LoadBundledInput`:
245245
246246
:::{dropdown} `LoadBundledInput`
247247
248248
```{eval-rst}
249-
.. doxygenfunction:: torch::executor::util::LoadBundledInput
249+
.. doxygenfunction:: torch::executor::bundled_program::LoadBundledInput
250250
```
251251
:::
252252

253253
### Verify the Method's Output.
254-
We call `torch::executor::util::VerifyResultWithBundledExpectedOutput` to verify the method's output with bundled expected outputs. Here's the details of this API:
254+
We call `torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput` to verify the method's output with bundled expected outputs. Here's the details of this API:
255255

256256
:::{dropdown} `VerifyResultWithBundledExpectedOutput`
257257

258258
```{eval-rst}
259-
.. doxygenfunction:: torch::executor::util::VerifyResultWithBundledExpectedOutput
259+
.. doxygenfunction:: torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput
260260
```
261261
:::
262262

@@ -277,7 +277,7 @@ ET_CHECK_MSG(
277277
method.error());
278278

279279
// Load testset_idx-th input in the buffer to plan
280-
status = torch::executor::util::LoadBundledInput(
280+
status = torch::executor::bundled_program::LoadBundledInput(
281281
*method,
282282
program_data.bundled_program_data(),
283283
&bundled_input_allocator,
@@ -296,7 +296,7 @@ ET_CHECK_MSG(
296296
status);
297297

298298
// Verify the result.
299-
status = torch::executor::util::VerifyResultWithBundledExpectedOutput(
299+
status = torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput(
300300
*method,
301301
program_data.bundled_program_data(),
302302
&bundled_input_allocator,

docs/website/docs/tutorials/bundled_program.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Here's an example of how to use the GetProgramData API:
6464
6565
const void* program_ptr;
6666
size_t program_len;
67-
status = torch::executor::util::GetProgramData(
67+
status = torch::executor::bundled_program::GetProgramData(
6868
buff_ptr.get(), buff_len, &program_ptr, &program_len);
6969
ET_CHECK_MSG(
7070
status == Error::Ok,
@@ -73,7 +73,7 @@ Here's an example of how to use the GetProgramData API:
7373
```
7474

7575
### Load bundled input to ExecutionPlan
76-
To execute the program on the bundled input, we need to load the bundled input into the ExecutionPlan. Here we provided an API called `torch::executor::util::LoadBundledInput`:
76+
To execute the program on the bundled input, we need to load the bundled input into the ExecutionPlan. Here we provided an API called `torch::executor::bundled_program::LoadBundledInput`:
7777

7878
```c++
7979

@@ -98,7 +98,7 @@ __ET_NODISCARD Error LoadBundledInput(
9898
```
9999
100100
### Verify the plan's output.
101-
We call `torch::executor::util::VerifyResultWithBundledExpectedOutput` to verify the method's output with bundled expected outputs. Here's the details of this API:
101+
We call `torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput` to verify the method's output with bundled expected outputs. Here's the details of this API:
102102
103103
```c++
104104
/**
@@ -142,7 +142,7 @@ Here we provide an example about how to run the bundled program step by step. Mo
142142
method.error());
143143

144144
// Load testset_idx-th input in the buffer to plan
145-
status = torch::executor::util::LoadBundledInput(
145+
status = torch::executor::bundled_program::LoadBundledInput(
146146
*method,
147147
program_data.bundled_program_data(),
148148
&bundled_input_allocator,
@@ -161,7 +161,7 @@ Here we provide an example about how to run the bundled program step by step. Mo
161161
status);
162162

163163
// Verify the result.
164-
status = torch::executor::util::VerifyResultWithBundledExpectedOutput(
164+
status = torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput(
165165
*method,
166166
program_data.bundled_program_data(),
167167
&bundled_input_allocator,

examples/apple/mps/executor_runner/mps_executor_runner.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static ProgramData load_or_die(std::string& filename) {
122122
// Find the offset to the embedded Program.
123123
const void* program_data;
124124
size_t program_data_len;
125-
Error status = torch::executor::util::GetProgramData(
125+
Error status = torch::executor::bundled_program::GetProgramData(
126126
const_cast<void*>(file_data->data()),
127127
file_data->size(),
128128
&program_data,
@@ -262,7 +262,7 @@ int main(int argc, char** argv) {
262262
// Find the offset to the embedded Program.
263263
const void* program_data;
264264
size_t program_data_len;
265-
Error status = torch::executor::util::GetProgramData(
265+
Error status = torch::executor::bundled_program::GetProgramData(
266266
const_cast<void*>(file_data->data()),
267267
file_data->size(),
268268
&program_data,
@@ -403,7 +403,7 @@ MemoryManager memory_manager(
403403
if (FLAGS_bundled_program) {
404404
ET_LOG(Info, "Loading bundled program...\n");
405405
// Use the inputs embedded in the bundled program.
406-
status = torch::executor::util::LoadBundledInput(
406+
status = torch::executor::bundled_program::LoadBundledInput(
407407
*method,
408408
file_data->data(),
409409
&bundled_input_allocator,
@@ -486,7 +486,7 @@ MemoryManager memory_manager(
486486
strstr(model_path, "ic4")) {
487487
atol = 1e-04;
488488
}
489-
status = torch::executor::util::VerifyResultWithBundledExpectedOutput(
489+
status = torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput(
490490
*method,
491491
file_data->data(),
492492
&bundled_input_allocator,

examples/sdk/sdk_example_runner/sdk_example_runner.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int main(int argc, char** argv) {
9696
// Find the offset to the embedded Program.
9797
const void* program_data;
9898
size_t program_data_len;
99-
Error status = torch::executor::util::GetProgramData(
99+
Error status = torch::executor::bundled_program::GetProgramData(
100100
const_cast<void*>(file_data->data()),
101101
file_data->size(),
102102
&program_data,
@@ -205,7 +205,7 @@ int main(int argc, char** argv) {
205205
MemoryAllocator(kBundledAllocatorPoolSize, bundled_allocator_pool)};
206206
exec_aten::ArrayRef<void*> inputs;
207207
// Use the inputs embedded in the bundled program.
208-
status = torch::executor::util::LoadBundledInput(
208+
status = torch::executor::bundled_program::LoadBundledInput(
209209
*method,
210210
file_data->data(),
211211
&bundled_input_allocator,
@@ -256,15 +256,16 @@ int main(int argc, char** argv) {
256256

257257
if (FLAGS_output_verification) {
258258
// Verify the outputs.
259-
status = torch::executor::util::VerifyResultWithBundledExpectedOutput(
260-
*method,
261-
file_data->data(),
262-
&bundled_input_allocator,
263-
method_name,
264-
FLAGS_testset_idx,
265-
1e-3, // rtol
266-
1e-5 // atol
267-
);
259+
status =
260+
torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput(
261+
*method,
262+
file_data->data(),
263+
&bundled_input_allocator,
264+
method_name,
265+
FLAGS_testset_idx,
266+
1e-3, // rtol
267+
1e-5 // atol
268+
);
268269
ET_CHECK_MSG(
269270
status == Error::Ok,
270271
"Bundle verification failed with status 0x%" PRIx32,

sdk/bundled_program/runtime/bundled_program_verification.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
namespace torch {
2626
namespace executor {
27-
namespace util {
27+
namespace bundled_program {
2828

2929
namespace {
3030

@@ -365,6 +365,6 @@ bool IsBundledProgram(void* file_data) {
365365
file_data);
366366
}
367367

368-
} // namespace util
368+
} // namespace bundled_program
369369
} // namespace executor
370370
} // namespace torch

sdk/bundled_program/runtime/bundled_program_verification.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace torch {
1515
namespace executor {
16-
namespace util {
16+
namespace bundled_program {
1717

1818
/**
1919
* An opaque pointer to a serialized bundled program.
@@ -94,6 +94,6 @@ __ET_NODISCARD Error GetProgramData(
9494
*/
9595
bool IsBundledProgram(void* file_data);
9696

97-
} // namespace util
97+
} // namespace bundled_program
9898
} // namespace executor
9999
} // namespace torch

0 commit comments

Comments
 (0)