Skip to content

Add optional ETRecord generation/saving for the xnnpack recipe#239

Open
sachinhambar wants to merge 1 commit into
huggingface:mainfrom
sachinhambar:add-etrecord-support
Open

Add optional ETRecord generation/saving for the xnnpack recipe#239
sachinhambar wants to merge 1 commit into
huggingface:mainfrom
sachinhambar:add-etrecord-support

Conversation

@sachinhambar

Copy link
Copy Markdown

Summary

This PR adds optional ETRecord generation support during ExecuTorch export, enabling easier debugging and analysis with the ExecuTorch Inspector.

Changes

  • Added a new opt-in generate_etrecord argument to export_to_executorch.
  • When enabled, an ETRecord file ({name}_etrecord.bin) is generated alongside the exported .pte artifact.
  • Propagated the flag through the XNNPACK export flow by wiring it into the to_edge_transform_and_lower(...) call, allowing ETRecord generation during lowering.
  • Preserved existing behavior by keeping ETRecord generation disabled by default.
  • Added warning logging when generate_etrecord=True is requested with unsupported recipes (portable, coreml, cuda, cuda-windows, metal) to avoid silent failures.

Behavior

Recipe ETRecord Support
xnnpack ✅ Supported
portable ⚠️ Warning logged
coreml ⚠️ Warning logged
cuda ⚠️ Warning logged
cuda-windows ⚠️ Warning logged
metal ⚠️ Warning logged

Impact

  • No changes to existing export workflows unless generate_etrecord=True is explicitly specified.
  • Provides ETRecord artifacts required for ExecuTorch Inspector debugging and profiling workflows.
  • Improves user visibility for unsupported backend configurations through explicit warnings.

Exposes a generate_etrecord kwarg on export_to_executorch that, when set,
saves an ETRecord alongside the .pte file for use with the ExecuTorch
Inspector. Currently only the xnnpack recipe forwards the flag through to
to_edge_transform_and_lower; other recipes log a warning instead of
silently no-oping.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants