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

[FX] refactor the fx path in compile function #1141

Merged
merged 14 commits into from
Jun 28, 2022
Merged

[FX] refactor the fx path in compile function #1141

merged 14 commits into from
Jun 28, 2022

Conversation

frank-wei
Copy link
Contributor

Description

Separate the FX lowering process to a single function compile to align with existing ts compile.

Type of change

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

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

Checklist:

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

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 C++ style guidelines

@frank-wei frank-wei requested a review from yinghai June 23, 2022 00:14
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

@yinghai
Copy link

yinghai commented Jun 23, 2022

Other general comments:

  1. Using [FX] instead of [fx2trt]. We should drop such reference in oss.
  2. Once or is accepted, using squash and merge so that it's checked in as one commit to avoid littering in the commit history with a lot of intermediate commits in the PR.

@frank-wei frank-wei changed the title [fx2trt] create a compile method [FX] create a compile method Jun 23, 2022
)
if self.lower_setting.explicit_batch_dimension
if self.lower_setting.explicit_batch_dimension and self.lower_setting.dynamic_batch
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dynamic_batch is added to differentiate two cases: with or w/o dynamic shape on batch dim (dim=0). cc @wushirong. I keep the dynamic_batch=True as default value so it will not change the previous behavior in production. Please have a review.

Copy link

Choose a reason for hiding this comment

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

What's the use case of w/o dyanmic shape on batch dim with explicit_batch_dimension=True? What's the different in terms of behavior in TensorRT? Basically, if I have explicit_batch_dimension=True while all my input dims are positive, how does TRT interprets it?

Maybe a question to @narendasan too.

Copy link
Contributor Author

@frank-wei frank-wei Jun 27, 2022

Choose a reason for hiding this comment

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

Here is my understanding, firstly, explicit_batch_dimension=True will become the default in next year and there is no explicit_batch_dimension=False(implicit) mode.
Secondly,

if I have explicit_batch_dimension=True while all my input dims are positive, how does TRT interprets it?

TRT will treat it as fixed shape for any future input. And that is what I tested for all the torchdynamo benchmarks

@frank-wei frank-wei changed the title [FX] create a compile method [FX] refactor the fx path in compile function Jun 24, 2022
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 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 C++ style guidelines

Copy link
Contributor

@wushirong wushirong left a comment

Choose a reason for hiding this comment

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

Add a description for the new field 'dynamic_batch', and I am a bit unsure whether we should set it default to true.

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 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 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 C++ style guidelines

@frank-wei
Copy link
Contributor Author

frank-wei commented Jun 28, 2022

Add a description for the new field 'dynamic_batch', and I am a bit unsure whether we should set it default to true.

addressed and set it to True as default.

@frank-wei frank-wei merged commit 3c87214 into master Jun 28, 2022
@frank-wei frank-wei deleted the fx2trt_wei_2 branch June 28, 2022 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants