Skip to content

feat: Add options kwargs for Torch compile [3 / x] #2005

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

Merged

Conversation

gs-olive
Copy link
Collaborator

@gs-olive gs-olive commented Jun 8, 2023

Description

  • Add ability to pass options dictionary to kwargs in torch_tensorrt_backend, for compatibility with updated torch compile API
  • The options dictionary is automatically parsed for specified fields and overwrites those fields in the settings object

Type of change

Please delete options that are not relevant and/or add your own.

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [ x ] My code follows the style guidelines of this project (You can use the linters)
  • [ x ] I have performed a self-review of my own code
  • [ x ] I have commented my code, particularly in hard-to-understand areas and hacks
  • [ x ] I have made corresponding changes to the documentation
  • [ x ] I have added tests to verify my fix or my feature
  • [ x ] New and existing unit tests pass locally with my changes
  • [ x ] I have added the relevant labels to my PR in so that relevant reviewers are notified

@gs-olive gs-olive added the component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths label Jun 8, 2023
@gs-olive gs-olive requested a review from narendasan June 8, 2023 20:06
@gs-olive gs-olive self-assigned this Jun 8, 2023
@github-actions github-actions bot added the component: api [Python] Issues re: Python API label Jun 8, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

@gs-olive gs-olive force-pushed the trt_interpreter_output_dtypes branch from f12670a to f3bdc49 Compare June 8, 2023 23:29
@gs-olive gs-olive force-pushed the dynamo_backend_options branch from 849ce42 to ff5707d Compare June 8, 2023 23:29
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

@gs-olive gs-olive force-pushed the trt_interpreter_output_dtypes branch from f3bdc49 to 5b2e1cb Compare June 14, 2023 00:26
@gs-olive gs-olive force-pushed the dynamo_backend_options branch from ff5707d to 24eda3f Compare June 14, 2023 00:34
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

@gs-olive gs-olive changed the title feat: Add options kwargs for Torch compile [5 / x] feat: Add options kwargs for Torch compile [3 / x] Jun 14, 2023
@gs-olive gs-olive requested a review from narendasan June 20, 2023 17:24
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

@gs-olive gs-olive force-pushed the dynamo_backend_options branch from 24eda3f to 208b40f Compare June 20, 2023 18:34
@gs-olive gs-olive changed the base branch from trt_interpreter_output_dtypes to main June 20, 2023 18:35
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

@gs-olive gs-olive force-pushed the dynamo_backend_options branch from 208b40f to 2161370 Compare June 20, 2023 19:35
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

@gs-olive gs-olive force-pushed the dynamo_backend_options branch from 2161370 to 9b42e75 Compare June 20, 2023 19:53
@gs-olive gs-olive changed the base branch from main to torch_version_upgrade_jun23_nightly June 20, 2023 19:53
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Add ability to pass `options` dictionary to `kwargs` in
`torch_tensorrt_backend`, for compatibility with updated torch compile
API
- The `options` dictionary is automatically parsed for specified fields
and overwrites those fields in the `settings` object
- Refactor code so that registered Dynamo backends accept keyword-args,
while internal-only backends accept settings objects
@gs-olive gs-olive force-pushed the dynamo_backend_options branch from 9b42e75 to 7672cce Compare June 20, 2023 20:13
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

Comment on lines +102 to +105
if settings.debug:
logger.setLevel(logging.DEBUG)

logger.debug(f"Compiling with Settings:\n{settings}")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug enablement and settings dump to debug logs moved into kwargs parser.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

@gs-olive gs-olive merged commit 34638b6 into torch_version_upgrade_jun23_nightly Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants