Repository navigation
Add ETDump profiling workflow for CpuBackend (#24335) - #24335
JakeStevens wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24335
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (4 Unrelated Failures)As of commit b2f15d3 with merge base 59fc134 ( BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@JakeStevens has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128598106. |
This PR needs a
|
CpuBackendCpuBackend (#24335)
Summary: `etdump_cpu` runs a CPU delegate model through a traced runner with `ET_CPU_ETDUMP`, drops warmup samples, and writes `profile.json` with median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump. The model runner gains configurable warmups (`ET_CPU_WARMUP_RUNS`), timed iterations (`ET_CPU_TIMED_RUNS`), golden tolerances (`ET_CPU_ATOL`, `ET_CPU_RTOL`) and a latency summary. The workflows README now covers export and profiling. Authored with Claude Code. Differential Revision: D128598106
30e6781 to
434645b
Compare
Summary: Pull Request resolved: pytorch#24335 `etdump_cpu` runs a CPU delegate model through a traced runner with `ET_CPU_ETDUMP`, drops warmup samples, and writes `profile.json` with median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump. The model runner gains configurable warmups (`ET_CPU_WARMUP_RUNS`), timed iterations (`ET_CPU_TIMED_RUNS`), golden tolerances (`ET_CPU_ATOL`, `ET_CPU_RTOL`) and a latency summary. The workflows README now covers export and profiling. Authored with Claude Code. Differential Revision: D128598106
Summary: `etdump_cpu` runs a CPU delegate model through a traced runner with `ET_CPU_ETDUMP`, drops warmup samples, and writes `profile.json` with median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump. The model runner gains configurable warmups (`ET_CPU_WARMUP_RUNS`), timed iterations (`ET_CPU_TIMED_RUNS`), golden tolerances (`ET_CPU_ATOL`, `ET_CPU_RTOL`) and a latency summary. The workflows README now covers export and profiling. Authored with Claude Code. Differential Revision: D128598106
434645b to
9355128
Compare
|
@claude review effort=max |
Claude is reviewing PR #24335
|
Summary: `etdump_cpu` runs a CPU delegate model through a traced runner with `ET_CPU_ETDUMP`, drops warmup samples, and writes `profile.json` with median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump. The model runner gains configurable warmups (`ET_CPU_WARMUP_RUNS`), timed iterations (`ET_CPU_TIMED_RUNS`), golden tolerances (`ET_CPU_ATOL`, `ET_CPU_RTOL`) and a latency summary. The workflows README now covers export and profiling. Authored with Claude Code. Differential Revision: D128598106
9355128 to
4862900
Compare
Summary: `etdump_cpu` runs a CPU delegate model through a traced runner with `ET_CPU_ETDUMP`, drops warmup samples, and writes `profile.json` with median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump. The model runner gains configurable warmups (`ET_CPU_WARMUP_RUNS`), timed iterations (`ET_CPU_TIMED_RUNS`), golden tolerances (`ET_CPU_ATOL`, `ET_CPU_RTOL`) and a latency summary. The workflows README now covers export and profiling. Authored with Claude Code. Differential Revision: D128598106
4862900 to
2faef9c
Compare
Summary: Pull Request resolved: pytorch#24335 `etdump_cpu` runs a CPU delegate model through a traced runner with `ET_CPU_ETDUMP`, drops warmup samples, and writes `profile.json` with median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump. The model runner gains configurable warmups (`ET_CPU_WARMUP_RUNS`), timed iterations (`ET_CPU_TIMED_RUNS`), golden tolerances (`ET_CPU_ATOL`, `ET_CPU_RTOL`) and a latency summary. The workflows README now covers export and profiling. Authored with Claude Code. Differential Revision: D128598106
2faef9c to
0335086
Compare
Summary: Pull Request resolved: pytorch#23926 `CPUPlan` records one ETDump delegate event per step, named `provider/implementation:first_node[+N]`, so every provider is traced without provider changes. The XNNPACK provider enables XNNPACK runtime profiling when a tracer is attached and logs `<operator> #<n>` events, such as `Transpose (ND, X32) #3`, inside its step. `runner` writes an ETDump when `ET_CPU_ETDUMP` is set. `backends/cpu/README.md` documents the event names and metadata. The `EXECUTORCH_CPU_XNNPACK_OPERATOR_SHAPES` CMake option (`-c executorch.cpu_xnnpack_operator_shapes=true` in Buck) also attaches each XNNPACK operator's input and output shapes to its event as JSON delegate metadata. It is off by default and turned on by the `profiling` preset for benchmarking. The shapes come from XNNPACK's internal runtime (`src/xnnpack/subgraph.h`), which the public API does not expose. This dependency on XNNPACK internals is known and accepted. Only builds with the option include the header, the structs it reads do not depend on XNNPACK's build flags, and the metadata must match XNNPACK's profiled operator count. The operator shape tests run in the native CPU CI job, so an XNNPACK update that changes these internals fails there. CMake builds `XNNProfiler` as a separate `xnnpack_profiler` library that `xnnpack_backend` and the CPU provider targets link, matching the Buck split. The Apple XNNPACK framework packs the new archive. Builds that link `libxnnpack_backend.a` by path rather than through the `xnnpack_backend` CMake target must now also link `libxnnpack_profiler.a`. The native CPU CI job builds `CPUPlanTest` with the event tracer and operator shapes and runs it. Authored with Claude Code. Differential Revision: D125525223
Summary: Pull Request resolved: pytorch#24335 `etdump_cpu` runs a CPU delegate model through a traced runner with `ET_CPU_ETDUMP`, drops warmup samples, and writes `profile.json` with median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump. The model runner gains configurable warmups (`ET_CPU_WARMUP_RUNS`), timed iterations (`ET_CPU_TIMED_RUNS`), golden tolerances (`ET_CPU_ATOL`, `ET_CPU_RTOL`) and a latency summary. The workflows README now covers export and profiling. Authored with Claude Code. Differential Revision: D128598106
0335086 to
b2f15d3
Compare
|
@claude review effort=max |
|
Claude finished @JakeStevens's task in 48m 57s —— View job PR Review: #24335This PR adds an ETDump profiling workflow for Detailed reviewSummaryThe PR adds
The summarizer gets profiles with several delegates wrong and can drop steps without failing. The CI, Buck and link changes need small fixes. Not verified:
Code Quality
Infrastructure
Testing
API Design
Backward Compatibility
Specific Comments
RecommendationRequest Changes The per-delegate numbering (API Design) and the sample-count classification (Code Quality) let the new workflow report misleading or incomplete profiles without failing. Both are small fixes. Emitting |

Summary:
etdump_cpuruns a CPU delegate model through a traced runner withET_CPU_ETDUMP, drops warmup samples, and writesprofile.jsonwith median/min/max latency per plan step and XNNPACK operator, plus each XNNPACK operator's input and output shapes. Each CPU delegate's plan is reassembled from the runner log, so a program with several CPU delegates is profiled as a whole. Events with an unexpected sample count are reported with a warning, and malformed operator metadata degrades to no shapes. It fails if any plan step or, for XNNPACK regions, operator events are missing from the ETDump.The model runner gains configurable warmups (
ET_CPU_WARMUP_RUNS), timed iterations (ET_CPU_TIMED_RUNS), golden tolerances (ET_CPU_ATOL,ET_CPU_RTOL) and a latency summary. The workflows README now covers export and profiling.Authored with Claude Code.
Differential Revision: D128598106