Skip to content

Change lowering of onnx.IF to Krnl #2932

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 10 commits into from
Sep 6, 2024
Merged

Conversation

chentong319
Copy link
Collaborator

@chentong319 chentong319 commented Sep 4, 2024

The previous implementation lowers onnx.Yield inside the code of lowering onnx.If. The type conversions are not systematically added through the conversion infrastructure. It caused an error with the new version of llvm in PR #2916 . Even with older version of llvm, the lowering of If_with_canonicalize.mlir generated an unused unrealized_cast before canonicalization.

This PR adds a lowering of onnx.Yield with a separate rule. It works with the old and new version of llvm in my test.

Be aware that onnx.Yield is also used by onnx.Loop. The lowering of onnx.Loop still lowers the onnx.Yield with the Loop. Need lots of work to break up the transformation code for Loop lowering. Will do that only if running into an error.

Signed-off-by: chentong319 <[email protected]>
Signed-off-by: chentong319 <[email protected]>
@chentong319 chentong319 marked this pull request as draft September 4, 2024 18:52
@chentong319 chentong319 marked this pull request as ready for review September 5, 2024 16:08
@chentong319 chentong319 requested a review from tungld September 5, 2024 16:09
Copy link
Collaborator

@tungld tungld left a comment

Choose a reason for hiding this comment

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

LGTM. Yes, it is the correct way lowering onnx.Yeild separately. Thanks!

*/

//===--------------------- Yield.cpp - Lowering Yield Op
//--------------------===//
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix the format.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@chentong319 chentong319 merged commit c5d3e72 into onnx:main Sep 6, 2024
7 checks passed
@chentong319 chentong319 deleted the lower-if branch September 6, 2024 16:55
@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #15554 [push] Change lowering of onnx.... started at 12:56

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #14578 [push] Change lowering of onnx.... started at 13:07

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #15548 [push] Change lowering of onnx.... started at 11:56

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #15548 [push] Change lowering of onnx.... passed after 1 hr 6 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #15554 [push] Change lowering of onnx.... passed after 1 hr 26 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #14578 [push] Change lowering of onnx.... passed after 2 hr 1 min

Sunny-Anand pushed a commit to Sunny-Anand/onnx-mlir that referenced this pull request Sep 17, 2024
* implementation

Signed-off-by: chentong319 <[email protected]>

* test case change

Signed-off-by: chentong319 <[email protected]>

* format

Signed-off-by: chentong319 <[email protected]>

* add test for If back

Signed-off-by: chentong319 <[email protected]>

* format

Signed-off-by: chentong319 <[email protected]>

---------

Signed-off-by: chentong319 <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>
Sunny-Anand added a commit that referenced this pull request Sep 17, 2024
* Change lowering of onnx.IF to Krnl (#2932)

* implementation

Signed-off-by: chentong319 <[email protected]>

* test case change

Signed-off-by: chentong319 <[email protected]>

* format

Signed-off-by: chentong319 <[email protected]>

* add test for If back

Signed-off-by: chentong319 <[email protected]>

* format

Signed-off-by: chentong319 <[email protected]>

---------

Signed-off-by: chentong319 <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* Update c style cast to c++ style cast (#2934)

Signed-off-by: Mike Essenmacher <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* Change c style cast to c++ style cast (#2936)

Signed-off-by: Mike Essenmacher <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* Add coding practices for onnx-mlir (#2935)

Signed-off-by: Mike Essenmacher <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* try to use new buffer deallocation (#2919)

* implementation

Signed-off-by: Chen Tong <[email protected]>

* comments

Signed-off-by: Chen Tong <[email protected]>

* format

Signed-off-by: Chen Tong <[email protected]>

---------

Signed-off-by: Chen Tong <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
Co-authored-by: Alexandre Eichenberger <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* fix requirements.txt link

Signed-off-by: Sunny-Anand <[email protected]>

* Reuse input buffer in lowering to krnl (#2939)

* first step

Signed-off-by: chentong319 <[email protected]>

* cpu

Signed-off-by: chentong319 <[email protected]>

* options

Signed-off-by: chentong319 <[email protected]>

* unify

Signed-off-by: chentong319 <[email protected]>

* simd

Signed-off-by: chentong319 <[email protected]>

* comments

Signed-off-by: chentong319 <[email protected]>

* lit test

Signed-off-by: chentong319 <[email protected]>

* fix test

Signed-off-by: chentong319 <[email protected]>

* format

Signed-off-by: chentong319 <[email protected]>

* response

Signed-off-by: chentong319 <[email protected]>

---------

Signed-off-by: chentong319 <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* Fix GroupNorm to support Opset21 (#2928)

* Group norm for opset 21

* Testing phase

* Fix GroupNorm to support Opset21

---------

Signed-off-by: hamptonm1 <[email protected]>
Co-authored-by: Megan Hampton <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* Update Ops documentation for ONNX 1.16.2 (#2942)

* Update Ops documentation for ONNX 1.16.2

* Fix format

---------

Co-authored-by: Megan Hampton <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* LLVM/StableHLO Upgrade eaa95a1 (#2943)

Co-authored-by: Megan Hampton <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* added support for no-zero-point quantization (#2938)

Signed-off-by: Alexandre Eichenberger <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>

* update with main

Signed-off-by: Sunny-Anand <[email protected]>

---------

Signed-off-by: chentong319 <[email protected]>
Signed-off-by: Sunny-Anand <[email protected]>
Signed-off-by: Mike Essenmacher <[email protected]>
Signed-off-by: Chen Tong <[email protected]>
Signed-off-by: hamptonm1 <[email protected]>
Signed-off-by: Alexandre Eichenberger <[email protected]>
Signed-off-by: Sunny Anand <[email protected]>
Co-authored-by: Tong Chen <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
Co-authored-by: Mike Essenmacher <[email protected]>
Co-authored-by: Alexandre Eichenberger <[email protected]>
Co-authored-by: hamptonm1 <[email protected]>
Co-authored-by: Megan Hampton <[email protected]>
jorickert pushed a commit to Xilinx/onnx-mlir that referenced this pull request Dec 3, 2024
* implementation

Signed-off-by: chentong319 <[email protected]>

* test case change

Signed-off-by: chentong319 <[email protected]>

* format

Signed-off-by: chentong319 <[email protected]>

* add test for If back

Signed-off-by: chentong319 <[email protected]>

* format

Signed-off-by: chentong319 <[email protected]>

---------

Signed-off-by: chentong319 <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
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