Skip to content

Enabling var_mean decomposition #2273

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
merged 2 commits into from
Aug 31, 2023
Merged

Enabling var_mean decomposition #2273

merged 2 commits into from
Aug 31, 2023

Conversation

apbose
Copy link
Collaborator

@apbose apbose commented Aug 28, 2023

This PR enables the var_mean and rsub decomposition in torch_enabled_decompositions

@github-actions github-actions bot added component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: lowering Issues re: The lowering / preprocessing passes labels Aug 28, 2023
@github-actions github-actions bot requested a review from peri044 August 28, 2023 19:31
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

@apbose apbose requested review from gs-olive and removed request for peri044 August 28, 2023 19:48
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

@gs-olive gs-olive left a comment

Choose a reason for hiding this comment

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

Change looks good! Consider adding aten.rsub, aten.rsqrt, aten.sqrt, or any other decompositions which might be preferable/have recent PRs.

For instance, the following can just be replaced with aten.rsub:

aten.rsub.Scalar,
aten.rsub.Tensor,

@@ -175,6 +175,7 @@
aten.linalg_vector_norm,
aten.full,
aten.repeat,
aten.var_mean,
Copy link
Collaborator Author

@apbose apbose Aug 28, 2023

Choose a reason for hiding this comment

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

@gs-olive you mentioned the rsub. I will add that.
Regarding sqrt and rsqrt, sqrt is not of lowering type so I don't think it should be included here.
For rsqrt, should I include it here? Since rsqrt is already present in py/torch_tensorrt/dynamo/lowering/_decompositions.py and that would take precedence over the enabled ones, right? And we would not need to add it to the disabled ops then.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is true, I agree with your points. I think the rsub would be the main one to change; we can leave the others out, and the rsqrt implementation in _decompositions.py will take precedence, yes.

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

@apbose apbose requested a review from gs-olive August 29, 2023 19:36
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

@gs-olive gs-olive left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@gs-olive gs-olive merged commit 178f4f3 into main Aug 31, 2023
@gs-olive gs-olive deleted the dynamo_converter_var_mean branch August 31, 2023 20:32
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 component: lowering Issues re: The lowering / preprocessing passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants