Skip to content

Add include_op_ids to strip_debug_info and strip_debug_info_from_aimodel - #135

Merged
cymbalrush merged 4 commits into
apple:mainfrom
cymbalrush:strip_debug_info_fix
Oct 21, 2026
Merged

cymbalrush merged 4 commits into
apple:mainfrom
cymbalrush:strip_debug_info_fix

Conversation

@cymbalrush

Copy link
Copy Markdown
Contributor

strip_debug_info now takes include_op_ids (default True).

  • True keeps the existing behavior. Every operation gets a fresh sequential op ID. That logic is now in a private helper, _assign_fresh_op_ids.
  • False sets the module, every nested operation and every block argument to a plain loc(unknown). No op IDs remain, so get_operation_id returns None for all of them.

New strip_debug_info_from_aimodel(path, output_path=None, include_op_ids=True) loads an .aimodel asset and strips it. It saves the result with the original metadata and returns the saved path. With output_path=None it overwrites the input asset.

Tests:

  • test_strip_debug_info_without_op_ids checks that every location is unknown and carries no op ID.
  • test_strip_debug_info_from_aimodel is parametrized over include_op_ids. It checks both the copy and the in-place overwrite by reloading each saved asset.

include_op_ids=False replaces every location with a plain unknown location.
strip_debug_info_from_aimodel loads an .aimodel, strips it and saves it back.
Self-contained copy of strip_debug_info and strip_debug_info_from_aimodel that
depends only on coreai, with a small command line interface.
@cymbalrush
cymbalrush merged commit 2f06683 into apple:main Oct 21, 2026
2 checks passed
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