Skip to content

Commit ec1c431

Browse files
Olivia-liufacebook-github-bot
authored andcommitted
LLM manual fixes on etdump generation (#6299)
Summary: Pull Request resolved: #6299 Fix the problem that LLM Manual profiling part cannot generate ETDump Reviewed By: Gasoonjia Differential Revision: D64485281 fbshipit-source-id: 864dda92112f50850feb94234658fdf6ca3b5922
1 parent 04a82b7 commit ec1c431

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

docs/source/llm/getting-started.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ set(CMAKE_CXX_STANDARD 17)
361361
set(CMAKE_CXX_STANDARD_REQUIRED True)
362362
363363
# Set options for executorch build.
364+
option(EXECUTORCH_ENABLE_LOGGING "" ON)
364365
option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "" ON)
365366
option(EXECUTORCH_BUILD_EXTENSION_MODULE "" ON)
366367
option(EXECUTORCH_BUILD_EXTENSION_TENSOR "" ON)
@@ -518,6 +519,7 @@ set(CMAKE_CXX_STANDARD 17)
518519
set(CMAKE_CXX_STANDARD_REQUIRED True)
519520
520521
# Set options for executorch build.
522+
option(EXECUTORCH_ENABLE_LOGGING "" ON)
521523
option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "" ON)
522524
option(EXECUTORCH_BUILD_EXTENSION_MODULE "" ON)
523525
option(EXECUTORCH_BUILD_EXTENSION_TENSOR "" ON)
@@ -763,6 +765,8 @@ An ETRecord is an artifact generated at the time of export that contains model g
763765
In your export script, after calling `to_edge()` and `to_executorch()`, call `generate_etrecord()` with the `EdgeProgramManager` from `to_edge()` and the `ExecuTorchProgramManager` from `to_executorch()`. Make sure to copy the `EdgeProgramManager`, as the call to `to_backend()` mutates the graph in-place.
764766

765767
```
768+
# export_nanogpt.py
769+
766770
import copy
767771
from executorch.devtools import generate_etrecord
768772
@@ -813,23 +817,24 @@ if (result.buf != nullptr && result.size > 0) {
813817
Additionally, update CMakeLists.txt to build with Developer Tools and enable events to be traced and logged into ETDump:
814818

815819
```
820+
option(EXECUTORCH_ENABLE_EVENT_TRACER "" ON)
816821
option(EXECUTORCH_BUILD_DEVTOOLS "" ON)
817822
818823
# ...
819824
820825
target_link_libraries(
821-
nanogpt_runner
822-
PRIVATE
823-
executorch
824-
extension_module_static # Provides the Module class
825-
optimized_native_cpu_ops_lib # Provides baseline cross-platform kernels
826-
xnnpack_backend # Provides the XNNPACK CPU acceleration backend
826+
# ... omit existing ones
827827
etdump) # Provides event tracing and logging
828828
829829
target_compile_options(executorch PUBLIC -DET_EVENT_TRACER_ENABLED)
830830
target_compile_options(portable_ops_lib PUBLIC -DET_EVENT_TRACER_ENABLED)
831831
```
832-
Run the runner, you will see “etdump.etdp” generated.
832+
Build and run the runner, you will see a file named “etdump.etdp” is generated. (Note that this time we build in release mode to get around a flatccrt build limitation.)
833+
```bash
834+
(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake -DCMAKE_BUILD_TYPE=Release ..)
835+
cmake --build cmake-out -j10
836+
./cmake-out/nanogpt_runner
837+
```
833838

834839
#### Analyze with Inspector APIs
835840

0 commit comments

Comments
 (0)