Skip to content

Conversation

@gprateek93
Copy link
Collaborator

This PR adds two commits:

  1. adds support for aten.native_layer_norm_backward operation. It also adds support for matching constant bools stored in a boolean list.
  2. fixes aten.native_layer_norm. Previously this operation was not calculating correct shapes for mean and inverted STD. This has been corrected in this commit. Some new helper functions are added to calculate the inverted STD and to broadcast a given input with the help of a broadcast mask.

Signed-Off-By: Prateek Gupta prateek@nod-labs.com

Copy link
Contributor

@cathyzhyi cathyzhyi left a comment

Choose a reason for hiding this comment

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

Left some comments. Haven't done reviewing yet.

@gprateek93 gprateek93 force-pushed the prateek/native-layer-norm-backward branch 3 times, most recently from 624de1e to 5a9f66f Compare February 2, 2022 15:47
Copy link
Contributor

@cathyzhyi cathyzhyi left a comment

Choose a reason for hiding this comment

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

Still haven't done reviewing but I am wondering if you've considered implementing this in DecomposeComplexOps?

@gprateek93
Copy link
Collaborator Author

gprateek93 commented Feb 3, 2022

Still haven't done reviewing but I am wondering if you've considered implementing this in DecomposeComplexOps?

I was following the previous code of batchNorm and layerNorm. But you are right, AFAIK these ops can be done in the DecomposeComplexOps pass. I can add a patch in this PR to make such change.

@gprateek93 gprateek93 force-pushed the prateek/native-layer-norm-backward branch 2 times, most recently from f9dbf33 to 04bfc4c Compare February 9, 2022 09:11
This commit fixs the lowering of `aten.native_layer_norm` operation.
Previously this operation was not calculating correct shapes for
mean and inverted STD. This has been corrected in this commit.
Some new helper functions are added to calculate the inverted STD
and to broadcast a given input with the help of a broadcast mask.

Signed-Off-By: Prateek Gupta <prateek@nod-labs.com>
This commit adds support for `aten.native_layer_norm_backward` operation.
It also adds support for matching constant bools stored in a boolean
list.

Signed-Off-By: Prateek Gupta <prateek@nod-labs.com>
@gprateek93 gprateek93 force-pushed the prateek/native-layer-norm-backward branch from 04bfc4c to d2cd480 Compare February 9, 2022 09:19
@gprateek93
Copy link
Collaborator Author

Still haven't done reviewing but I am wondering if you've considered implementing this in DecomposeComplexOps?

Hi @cathyzhyi I tried to use the DecomposeComplexOps, but the preprocessing(Checking of requirements) of both the lowerings viz aten.native_layer_norm and its backward op require some std dialect ops like AssertOp.

@cathyzhyi
Copy link
Contributor

Still haven't done reviewing but I am wondering if you've considered implementing this in DecomposeComplexOps?

Hi @cathyzhyi I tried to use the DecomposeComplexOps, but the preprocessing(Checking of requirements) of both the lowerings viz aten.native_layer_norm and its backward op require some std dialect ops like AssertOp.

Yea, @Shukla-Gaurav has a PR for adding assert into Torch dialect #564. We can use that once it's merged.

@gprateek93
Copy link
Collaborator Author

Opened the PR at (#570)

@gprateek93 gprateek93 closed this Feb 9, 2022
@gprateek93 gprateek93 deleted the prateek/native-layer-norm-backward branch February 9, 2022 16:02
qedawkins pushed a commit to nod-ai/torch-mlir that referenced this pull request Oct 3, 2022
* change dialect

Signed-off-by: chentong <chentong@us.ibm.com>

* fix pad

Signed-off-by: chentong <chentong@us.ibm.com>

* Reshape

Signed-off-by: chentong <chentong@us.ibm.com>

* format

Signed-off-by: chentong <chentong@us.ibm.com>

* adjust test

Signed-off-by: chentong <chentong@us.ibm.com>

* docs

Signed-off-by: chentong <chentong@us.ibm.com>

* remove the code

Signed-off-by: chentong <chentong@us.ibm.com>

* clean gen_onnx_mlir

Signed-off-by: chentong <chentong@us.ibm.com>

* format

Signed-off-by: chentong <chentong@us.ibm.com>
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.

4 participants