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

[MLIR][TORCH] Add OnnxToTorch support for BlackmanWindow function #3181

Merged
merged 7 commits into from
Apr 30, 2024

Conversation

vinayakdsci
Copy link
Contributor

Implements OnnxToTorch lowering for the BlackmanWindow Function.

@vinayakdsci
Copy link
Contributor Author

@vinayakdsci vinayakdsci marked this pull request as draft April 17, 2024 19:19
@vinayakdsci vinayakdsci force-pushed the blackman-window-impl branch 2 times, most recently from cfcf831 to fcfa8cd Compare April 17, 2024 20:40
@vinayakdsci vinayakdsci marked this pull request as ready for review April 17, 2024 20:58
@vinayakdsci
Copy link
Contributor Author

@vivekkhandelwal1 gentle ping.

Copy link
Collaborator

@renxida renxida left a comment

Choose a reason for hiding this comment

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

Also needs an e2e test.

This can either be done in torch-mlir/projects/pt1 or Shark-TestSuite

SharkTestSuite is what we're moving towards, and in the past, for ONNX models, it has given me less trouble.

All you need to do is:

  1. Make a new folder named after your op in
    https://github.com/nod-ai/SHARK-TestSuite/tree/main/e2eshark/onnx/operators
  2. Add a file named 'model.py' inside that folder. Reference https://github.com/nod-ai/SHARK-TestSuite/blob/main/e2eshark/onnx/operators/If/model.py for an example i just pushed today
  3. run it with
PYTHONPATH="/home/azureuser/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir:$PYTHONPATH" python ./run.py -c ~/torch-mlir/build -i ~/iree-build --tests onnx/operators/If --verbose --cachedir /tmp/ --verbose --torchtolinalg

Note that you have to
cd Shark-TestSuite/e2eshark
and modify the string after --tests to match the directory of the oprerator you're testing. Here, i'm testing onnx.If

@vinayakdsci
Copy link
Contributor Author

Note that you have to cd Shark-TestSuite/e2eshark and modify the string after --tests to match the directory of the oprerator you're testing. Here, i'm testing onnx.If

I have written the test, but would it require to be pushed to the SHARK-TestSuite repository?

Copy link
Collaborator

@vivekkhandelwal1 vivekkhandelwal1 left a comment

Choose a reason for hiding this comment

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

Hi @vinayakdsci, I think you have adopted the PyTorch Blackman Window instead of Onnx Blackman Window implementation for this lowering. Although they both might be same but I think it's better for an onnx op to be lowered as per their implementation, and it's more readable as well to compare the algo.

lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp Outdated Show resolved Hide resolved
lib/Conversion/TorchOnnxToTorch/DefaultDomainAtoF.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@vivekkhandelwal1 vivekkhandelwal1 left a comment

Choose a reason for hiding this comment

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

Apart from a small nit, everything else looks fine.

@vivekkhandelwal1
Copy link
Collaborator

@vinayakdsci, you need an approval from @renxida too to merge this.

@renxida renxida merged commit 05f8b69 into llvm:main Apr 30, 2024
3 checks passed
archana-ramalingam pushed a commit to archana-ramalingam/torch-mlir that referenced this pull request May 8, 2024
…vm#3181)

Implements OnnxToTorch lowering for the BlackmanWindow Function.
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.

3 participants