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

[MHLO] Init MHLO integration. #1083

Merged

Conversation

ZihengJiang
Copy link
Collaborator

@ZihengJiang ZihengJiang commented Jul 19, 2022

See RFC: #999

Co-authored-by: Bairen Yi yibairen.byron@bytedance.com
Co-authored-by: Jiawei Wu xremold@gmail.com
Co-authored-by: Tianyou Guo tianyou.gty@alibaba-inc.com
Co-authored-by: Xu Yan yancey.yx@alibaba-inc.com
Co-authored-by: Ziheng Jiang ziheng.jiang@bytedance.com

@ZihengJiang ZihengJiang marked this pull request as ready for review July 19, 2022 17:43
@ZihengJiang
Copy link
Collaborator Author

ready for review @silvasean @powderluv @fortianyou

test/CMakeLists.txt Outdated Show resolved Hide resolved
python/torch_mlir/__init__.py Outdated Show resolved Hide resolved
lib/Dialect/TorchConversion/Transforms/Passes.cpp Outdated Show resolved Hide resolved
@silvasean
Copy link
Contributor

Awesome :)

@ZihengJiang ZihengJiang force-pushed the upstream-01-init-mhlo-integration branch 2 times, most recently from 483ecdf to 22adff8 Compare July 19, 2022 20:15
setup.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@powderluv powderluv left a comment

Choose a reason for hiding this comment

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

Looks great. One question on the mlir-pdll do we build it ? It will fail when we build for macOS m1 etc.

Copy link
Collaborator

@powderluv powderluv left a comment

Choose a reason for hiding this comment

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

I think you also need to add -DTORCH_MLIR_ENABLE_MHLO=ON in the .github/workflows to get the CIs to pass

@ZihengJiang
Copy link
Collaborator Author

@powderluv I change mhlo's compilation to embedded build so that we don't need to feed the PDLL_EXE option.

@ZihengJiang
Copy link
Collaborator Author

@silvasean @powderluv Please review

Co-authored-by: Bairen Yi <yibairen.byron@bytedance.com>
Co-authored-by: Jiawei Wu <xremold@gmail.com>
Co-authored-by: Tianyou Guo <tianyou.gty@alibaba-inc.com>
Co-authored-by: Xu Yan <yancey.yx@alibaba-inc.com>
Co-authored-by: Ziheng Jiang <ziheng.jiang@bytedance.com>
@ZihengJiang ZihengJiang force-pushed the upstream-01-init-mhlo-integration branch from 0f7e490 to b90a76f Compare July 20, 2022 19:07
@powderluv
Copy link
Collaborator

lmk if you don't have permissions yet to land it

@ZihengJiang ZihengJiang merged commit c61c99e into llvm:main Jul 20, 2022
@ZihengJiang
Copy link
Collaborator Author

Merged now. Thanks @silvasean @powderluv @fortianyou

@ZihengJiang ZihengJiang deleted the upstream-01-init-mhlo-integration branch July 21, 2022 00:00
copybara-service bot pushed a commit to tensorflow/mlir-hlo that referenced this pull request Jul 21, 2022
…oject.

Imported from GitHub PR tensorflow/tensorflow#56831

For the "MLIR_PDLL_TABLEGEN_EXE not set" issue that I met in this PR (llvm/torch-mlir#1083) when building mhlo as an external project
Copybara import of the project:

--
ae404e091f414e37ad1acd519c21ee91f898ce5c by ZihengJiang <ziheng@apache.org>:

Fix compilation issue when building mhlo as an external project.

Merging this change closes #56831

PiperOrigin-RevId: 462344425
gpetters94 pushed a commit to gpetters94/mlir-npcomp that referenced this pull request Jul 27, 2022
Co-authored-by: Bairen Yi <yibairen.byron@bytedance.com>
Co-authored-by: Jiawei Wu <xremold@gmail.com>
Co-authored-by: Tianyou Guo <tianyou.gty@alibaba-inc.com>
Co-authored-by: Xu Yan <yancey.yx@alibaba-inc.com>
Co-authored-by: Ziheng Jiang <ziheng.jiang@bytedance.com>
qedawkins pushed a commit to nod-ai/torch-mlir that referenced this pull request Oct 3, 2022
* Make the doc example obey ONNX_MLIR_BUILD_TESTS

Currently, ONNX_MLIR_BUILD_TESTS controls EXCLUDE_FROM_ALL, however, the targets added through add_executable will always build. We follow the llvm pattern and explicitly set EXCLUDE_FROM_ALL in the add_onnx_mlir_executable function if it is set for the directory, so that add_executable targets don't always build.

Signed-off-by: Stella Stamenova <stilis@microsoft.com>
qedawkins pushed a commit to nod-ai/torch-mlir that referenced this pull request Oct 3, 2022
* Add check-onnx-backend to Mac CI. (llvm#1069)

* Add check-onnx-backend to Mac CI.

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Additional Docker help and split README for easier reading (llvm#1084)

* initial docker documentation

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* split README with no redundant place for info

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* respond to suggestions

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* specify that onnx-mlir.py script generates only code suitable to be exec in Linux and/or Docker env

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* fix checkdocs

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* responded to review suggestion on onnx-mlir --help

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* use ONNX-MLIR everywhere

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* add verify for concat

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* check all inputs

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Support filtering out lit tests based on targets (llvm#1087)

Currently we ignore what targets llvm was built for in the lit tests, but recent changes to onnx-mlir explicitly initialize the available targets.
This makes the corresponding change to the lit configuration, so that we can filter out the lit tests based on the available targets.

Signed-off-by: Stella Stamenova <stilis@microsoft.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Switch URLs to use main instead of master (llvm#1094)

Signed-off-by: Charles Volzka <cjvolzka@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Fix MacOS build badge (llvm#1092)

Signed-off-by: Gong Su <gong_su@hotmail.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* onnx-mlir.py warning about binary output (.so and .jar) (llvm#1090)

not directly usable if host is not Linux

Signed-off-by: Gong Su <gong_su@hotmail.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Make the doc example obey ONNX_MLIR_BUILD_TESTS (llvm#1083)

* Make the doc example obey ONNX_MLIR_BUILD_TESTS

Currently, ONNX_MLIR_BUILD_TESTS controls EXCLUDE_FROM_ALL, however, the targets added through add_executable will always build. We follow the llvm pattern and explicitly set EXCLUDE_FROM_ALL in the add_onnx_mlir_executable function if it is set for the directory, so that add_executable targets don't always build.

Signed-off-by: Stella Stamenova <stilis@microsoft.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Explicitly install into lib on all systems (llvm#1088)

Signed-off-by: Gong Su <gong_su@hotmail.com>

Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* add check (llvm#1098)

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

Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* fix typos and add ssh-client to dockerfile (llvm#1096)

* fix typos and add ssh-client to dockerfile

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* sync doc and script

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Emit print statement only when the verbose option is in effect. (llvm#1097)

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>

Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* format & refine code by request

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Support older versions 6, 11, 12 for Clip Op (llvm#1100)

Signed-off-by: Tung D. Le <tung@jp.ibm.com>

Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* using front to get first input

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* add 3 lit test for concat  verifier

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* add newline

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Add check-onnx-backend to Mac CI. (llvm#1069)

* Add check-onnx-backend to Mac CI.

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Additional Docker help and split README for easier reading (llvm#1084)

* initial docker documentation

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* split README with no redundant place for info

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* update

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* respond to suggestions

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* specify that onnx-mlir.py script generates only code suitable to be exec in Linux and/or Docker env

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* fix checkdocs

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* responded to review suggestion on onnx-mlir --help

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>

* use ONNX-MLIR everywhere

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Switch URLs to use main instead of master (llvm#1094)

Signed-off-by: Charles Volzka <cjvolzka@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Fix MacOS build badge (llvm#1092)

Signed-off-by: Gong Su <gong_su@hotmail.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* fix typos and add ssh-client to dockerfile (llvm#1096)

* fix typos and add ssh-client to dockerfile

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* sync doc and script

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Update document (llvm#1077)

* create

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

* delete HowTOAddAnOperation.md

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

* modify testing

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

* create

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

* delete HowTOAddAnOperation.md

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

* modify testing

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

* fix

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

* create

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

* add comment

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

* delete HowTOAddAnOperation.md

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

* modify testing

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

* fix

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

* create

Signed-off-by: Tong Chen <chentong@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Update LLVM level (llvm#1095)

* Update LLVM level to 700997aef8c1f2f08c9ac5fca61650b57a01e8b1

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Pass a type converter to all ONNX operations. (llvm#1102)

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Nuke KrnlDummyCastOp now that we use MLIR's UnrealizedConversionCastOp (llvm#1103)

* Nuke KrnlDummyCastOp now that we use MLIR's UnrealizedConversionCastOp

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>

* Remove a dependency in src/Dialect/Krnl/CMakeList.txt.  Regenerate docs via 'ninja onnx-mlir-docs'.

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Add --emitObj option to onnx-mlir (llvm#1104)

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* fix warnings (llvm#1093)

Signed-off-by: Ian Bearman <ianb@microsoft.com>

Co-authored-by: Stella Stamenova <stilis@microsoft.com>
Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Add -march option to onnx-mlir (llvm#1107)

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Fix Doc spelling and broken links, removed warnings about using main (llvm#1106)

* removed warning about main vs master in CONTRIBUTING, fixed links and spelling mistakes

Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

* Update BuildONNX.md

Signed-off-by: Ethan Wang <ywan2928@uwo.ca>

Co-authored-by: Ettore Tiotto <etiotto@ca.ibm.com>
Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Co-authored-by: Stella Stamenova <stilis@microsoft.com>
Co-authored-by: Charles Volzka <42243335+cjvolzka@users.noreply.github.com>
Co-authored-by: gongsu832 <gong_su@hotmail.com>
Co-authored-by: chentong319 <chentong@us.ibm.com>
Co-authored-by: Tung D. Le <tung@jp.ibm.com>
Co-authored-by: Ian Bearman <ian.bearman@live.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