Skip to content

Commit 93669ee

Browse files
Olivia-liufacebook-github-bot
authored andcommitted
Update some SDK docs from MVP (#3212)
Summary: doc changes including 1. Remove instruction for Buck because we're moving away from it and just use CMake now and future; 2. Remove Coming soon for the realized feature; 3. Formatting. Reviewed By: Jack-Khuu Differential Revision: D56433016
1 parent dbf90c2 commit 93669ee

File tree

3 files changed

+28
-48
lines changed

3 files changed

+28
-48
lines changed

docs/source/sdk-etdump.md

Lines changed: 26 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,37 @@ ETDump (ExecuTorch Dump) is one of the core components of the ExecuTorch SDK exp
88
Generating an ETDump is a relatively straightforward process. Users can follow the steps detailed below to integrate it into their application that uses ExecuTorch.
99

1010
1. ***Include*** the ETDump header in your code.
11-
```C++
12-
#include <executorch/sdk/etdump/etdump_flatcc.h>
13-
```
11+
```C++
12+
#include <executorch/sdk/etdump/etdump_flatcc.h>
13+
```
1414

1515
2. ***Create*** an Instance of the ETDumpGen class and pass it into the `load_method` call that is invoked in the runtime.
1616

17-
```C++
18-
torch::executor::ETDumpGen etdump_gen = torch::executor::ETDumpGen();
19-
Result<Method> method =
20-
program->load_method(method_name, &memory_manager, &etdump_gen);
21-
```
17+
```C++
18+
torch::executor::ETDumpGen etdump_gen = torch::executor::ETDumpGen();
19+
Result<Method> method =
20+
program->load_method(method_name, &memory_manager, &etdump_gen);
21+
```
2222
2323
3. ***Dump Out the ETDump Buffer*** - after the inference iterations have been completed, users can dump out the ETDump buffer. If users are on a device which has a filesystem, they could just write it out to the filesystem. For more constrained embedded devices, users will have to extract the ETDump buffer from the device through a mechanism that best suits them (e.g. UART, JTAG etc.)
2424
25-
```C++
26-
etdump_result result = etdump_gen.get_etdump_data();
27-
if (result.buf != nullptr && result.size > 0) {
28-
// On a device with a file system users can just write it out
29-
// to the file-system.
30-
FILE* f = fopen(FLAGS_etdump_path.c_str(), "w+");
31-
fwrite((uint8_t*)result.buf, 1, result.size, f);
32-
fclose(f);
33-
free(result.buf);
34-
}
35-
```
36-
37-
4. ***Compile*** your binary with the `ET_EVENT_TRACER_ENABLED` pre-processor flag to enable events to be traced and logged into ETDump inside the ExecuTorch runtime.
38-
39-
i). ***Buck***
40-
41-
In Buck, users simply depend on the etdump target which is:
42-
```
43-
//executorch/sdk/etdump:etdump_flatcc
44-
```
45-
When compiling their binary through Buck, users can pass in this buck config to enable the pre-processor flag. For example, when compiling `sdk_example_runner` to enable ETDump generation, users compile using the following command:
46-
```
47-
buck2 build -c executorch.event_tracer_enabled=true examples/sdk/sdk_example_runner:sdk_example_runner
48-
```
49-
50-
ii). ***CMake***
51-
52-
In CMake, users add this to their compile flags:
53-
```
54-
-DET_EVENT_TRACER_ENABLED
55-
```
56-
57-
This flag needs to be added to the ExecuTorch library and any operator library that the users are compiling into their binary. For reference, users can take a look at `examples/sdk/CMakeLists.txt`. The lines of of interest are:
58-
```
59-
target_compile_options(executorch PUBLIC -DET_EVENT_TRACER_ENABLED)
60-
target_compile_options(portable_ops_lib PUBLIC -DET_EVENT_TRACER_ENABLED)
61-
```
25+
```C++
26+
etdump_result result = etdump_gen.get_etdump_data();
27+
if (result.buf != nullptr && result.size > 0) {
28+
// On a device with a file system users can just write it out
29+
// to the file-system.
30+
FILE* f = fopen(FLAGS_etdump_path.c_str(), "w+");
31+
fwrite((uint8_t*)result.buf, 1, result.size, f);
32+
fclose(f);
33+
free(result.buf);
34+
}
35+
```
36+
37+
4. ***Compile*** your binary using CMake with the `ET_EVENT_TRACER_ENABLED` pre-processor flag to enable events to be traced and logged into ETDump inside the ExecuTorch runtime. Flag `-DET_EVENT_TRACER_ENABLED` needs to be added to the ExecuTorch library and any operator library that you are compiling into your binary. For reference, you can take a look at `examples/sdk/CMakeLists.txt`. The lines of of interest are:
38+
```
39+
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED)
40+
target_compile_options(portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED)
41+
```
6242
## Using an ETDump
6343

64-
1. Pass this ETDump into the [Inspector API](./sdk-inspector.rst) to access this data and do post-run analysis.
44+
Pass this ETDump into the [Inspector API](./sdk-inspector.rst) to access this data and do post-run analysis.

docs/source/sdk-etrecord.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ the ExecuTorch program (returned by the call to ``to_executorch()``), and option
2929
they are interested in working with via our tooling.
3030

3131
.. warning::
32-
Users should do a deepcopy of the output of to_edge() and pass in the deepcopy to the generate_etrecord API. This is needed because the subsequent call, to_executorch(), does an in-place mutation and will lose debug data in the process.
32+
Users should do a deepcopy of the output of ``to_edge()`` and pass in the deepcopy to the ``generate_etrecord`` API. This is needed because the subsequent call, ``to_executorch()``, does an in-place mutation and will lose debug data in the process.
3333

3434
.. currentmodule:: executorch.sdk.etrecord._etrecord
3535
.. autofunction:: generate_etrecord

docs/source/sdk-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The ExecuTorch SDK supports the following features:
1414
- Model loading and execution time
1515
- **Delegate Integration** - Surfacing performance details from delegate backends
1616
- Link back delegate operator execution to the nodes they represent in the edge dialect graph (and subsequently linking back to source code and module hierarchy)
17-
- **Debugging** (Intermediate outputs and output quality analysis) - Coming soon
17+
- **Debugging** - Intermediate outputs and output quality analysis
1818
- **Visualization** - Coming soon
1919

2020
## Fundamental components of the SDK

0 commit comments

Comments
 (0)