-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New URL for the ETDump page (#5809) Summary: Pull Request resolved: #5809 This diff is to rename the "sdk-etdump" documentation page to just "etdump". Old URL: https://pytorch.org/executorch/main/sdk-etdump.html New URL ("sdk" is removed): https://pytorch.org/executorch/main/etdump.html Design doc: https://docs.google.com/document/d/1l6DYTq9Kq6VrPohruRFP-qScZDj01W_g4zlKyvqKGF4/edit?usp=sharing Reviewed By: dbort Differential Revision: D63738952 fbshipit-source-id: dda59dc74512aacd2ad168a36e567556b44baa2f (cherry picked from commit 6f17947) Co-authored-by: Olivia Liu <olivialpx@meta.com>
- Loading branch information
1 parent
c678cbd
commit 19584a8
Showing
13 changed files
with
61 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Prerequisite | ETDump - ExecuTorch Dump | ||
|
||
ETDump (ExecuTorch Dump) is one of the core components of the ExecuTorch Developer Tools. It is the mechanism through which all forms of profiling and debugging data is extracted from the runtime. Users can't parse ETDump directly; instead, they should pass it into the Inspector API, which deserializes the data, offering interfaces for flexible analysis and debugging. | ||
|
||
|
||
## Generating an ETDump | ||
|
||
Generating an ETDump is a relatively straightforward process. Users can follow the steps detailed below to integrate it into their application that uses ExecuTorch. | ||
|
||
1. ***Include*** the ETDump header in your code. | ||
```C++ | ||
#include <executorch/devtools/etdump/etdump_flatcc.h> | ||
``` | ||
|
||
2. ***Create*** an Instance of the ETDumpGen class and pass it into the `load_method` call that is invoked in the runtime. | ||
|
||
```C++ | ||
torch::executor::ETDumpGen etdump_gen = torch::executor::ETDumpGen(); | ||
Result<Method> method = | ||
program->load_method(method_name, &memory_manager, &etdump_gen); | ||
``` | ||
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.) | ||
```C++ | ||
etdump_result result = etdump_gen.get_etdump_data(); | ||
if (result.buf != nullptr && result.size > 0) { | ||
// On a device with a file system users can just write it out | ||
// to the file-system. | ||
FILE* f = fopen(FLAGS_etdump_path.c_str(), "w+"); | ||
fwrite((uint8_t*)result.buf, 1, result.size, f); | ||
fclose(f); | ||
free(result.buf); | ||
} | ||
``` | ||
|
||
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. This flag 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 interest are: | ||
``` | ||
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED) | ||
target_compile_options(portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED) | ||
``` | ||
## Using an ETDump | ||
|
||
Pass this ETDump into the [Inspector API](./sdk-inspector.rst) to access this data and do post-run analysis. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,3 @@ | ||
# Prerequisite | ETDump - ExecuTorch Dump | ||
|
||
ETDump (ExecuTorch Dump) is one of the core components of the ExecuTorch Developer Tools. It is the mechanism through which all forms of profiling and debugging data is extracted from the runtime. Users can't parse ETDump directly; instead, they should pass it into the Inspector API, which deserializes the data, offering interfaces for flexible analysis and debugging. | ||
|
||
|
||
## Generating an ETDump | ||
|
||
Generating an ETDump is a relatively straightforward process. Users can follow the steps detailed below to integrate it into their application that uses ExecuTorch. | ||
|
||
1. ***Include*** the ETDump header in your code. | ||
```C++ | ||
#include <executorch/devtools/etdump/etdump_flatcc.h> | ||
``` | ||
|
||
2. ***Create*** an Instance of the ETDumpGen class and pass it into the `load_method` call that is invoked in the runtime. | ||
|
||
```C++ | ||
torch::executor::ETDumpGen etdump_gen = torch::executor::ETDumpGen(); | ||
Result<Method> method = | ||
program->load_method(method_name, &memory_manager, &etdump_gen); | ||
``` | ||
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.) | ||
```C++ | ||
etdump_result result = etdump_gen.get_etdump_data(); | ||
if (result.buf != nullptr && result.size > 0) { | ||
// On a device with a file system users can just write it out | ||
// to the file-system. | ||
FILE* f = fopen(FLAGS_etdump_path.c_str(), "w+"); | ||
fwrite((uint8_t*)result.buf, 1, result.size, f); | ||
fclose(f); | ||
free(result.buf); | ||
} | ||
``` | ||
|
||
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. This flag 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 interest are: | ||
``` | ||
target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED) | ||
target_compile_options(portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED) | ||
``` | ||
## Using an ETDump | ||
|
||
Pass this ETDump into the [Inspector API](./sdk-inspector.rst) to access this data and do post-run analysis. | ||
Please update your link to <https://pytorch.org/executorch/main/etdump.html>. This URL will be deleted after v0.4.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters