Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

229 parse all arguments in pytorch trace file #230

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fengxizhou
Copy link
Contributor

@fengxizhou fengxizhou commented Mar 8, 2025

What does this PR do?

  • The HTA currently filters a specific set of arguments defined by the ParserConfig class. This approach effectively minimizes memory footprint, which is crucial when dealing with fixed traces.

  • When working with new types of traces, such as MTIA traces, the current implementation requires modifying the ParserConfig class. This introduces an additional layer of effort and potential complexity.

Proposed Solution

We're adding a new boolean attribute, parse_all_arguments (default False), to the ParserConfig class. When set to True, the parser will parse all arguments in the trace file. Arguments defined in events_args will be parsed as specified, while undefined arguments will be parsed using a standard naming convention with inferred default values.

The undefined arguments are parsed with the following method:
name: the converted name, which is the raw name from the trace file converted to lowercase and with spaces replaced by underscores.

  • raw_name: the original name as it appeared in the trace file
  • value_type, the data type inferred based on the value that was given to the argument
  • default_value: -1 for int, "" for string, None for object

Benefits

  • Flexibility: Enables seamless adaptation to new trace types without modifying the ParserConfig class.
  • Ease of Use: Provides a simple and intuitive way to toggle between parsing specific arguments and parsing all arguments.
  • Reduced Maintenance: Simplifies the codebase by eliminating the need for frequent updates to the ParserConfig class for new trace types.

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
    • N/A
  • Did you write any new necessary tests?
    • N/A
  • Did you make sure to update the docs?
    • N/A
  • Did you update the changelog?
    • N/A

@fengxizhou fengxizhou linked an issue Mar 8, 2025 that may be closed by this pull request
@fengxizhou fengxizhou self-assigned this Mar 8, 2025
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 8, 2025
- Add parse_all_args attribute and corresponding setter method
- Set default parser_backend to JSON
- Introduce transform_arg_name static method for argument normalization
- Implement unit tests for new features in ParserConfig
… test case test_set_global_parser_config_version to prevent the side impact due to mocking parse_event_args_yaml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parse All Arguments in PyTorch Trace File
2 participants