-
Notifications
You must be signed in to change notification settings - Fork 315
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
Fix GroupNorm to support Opset21 #2928
Conversation
…onm1/onnx-mlir into hamptonm/feature/groupnorm
…onm1/onnx-mlir into hamptonm/feature/groupnorm
Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com>
Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com>
@jenkins-droid test this please |
Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com>
…onm1/onnx-mlir into hamptonm/feature/groupnorm
…onm1/onnx-mlir into hamptonm/feature/groupnorm
Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com>
Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com>
Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com>
Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com>
@AlexandreEichenberger @chentong319 Okay, I took the feedback from you both and made some changes. Let me know what else needs to be fixed and if I got the reshape for |
@@ -149,6 +149,21 @@ LogicalResult ONNXInstanceNormalizationOp::verify() { | |||
return success(); | |||
} | |||
|
|||
//===----------------------------------------------------------------------===// | |||
// GroupNormalizationV18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexandreEichenberger Is this what you were thinking of? I added a print because if I add emitWarning
it seems like all opset 18 tests fail and I figure we can still enable support for the meantime. I am fine with removing support in the near future but was not sure if any model still uses GroupNorm Opset 18.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, in general, we can also test other properties, but since this op is not going to be used, its fine.
FYI- @Sunny-Anand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice use of templates. Indicated 2 small nits, otherwise good to go
@@ -149,6 +149,21 @@ LogicalResult ONNXInstanceNormalizationOp::verify() { | |||
return success(); | |||
} | |||
|
|||
//===----------------------------------------------------------------------===// | |||
// GroupNormalizationV18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, in general, we can also test other properties, but since this op is not going to be used, its fine.
: public OpRewritePattern<ONNXGroupNormalizationOp> { | ||
using OpRewritePattern<ONNXGroupNormalizationOp>::OpRewritePattern; | ||
template <typename OP> | ||
constexpr bool isNumGroup = std::is_same_v<OP, ONNXGroupNormalizationV18Op>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice C++ construct, did not know we can do something like this without a function.
I would recommend a more explicit name ScaleAndBiasWithNumGroupShape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I can change it!
rewriter.replaceOp(groupNormOp, Y); | ||
return success(); | ||
Value biasScaleShape = create.onnx.concat(biasScaleShapeType, | ||
{NGShape, NGShape, oneDimShape}, /*axis*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: format 0
should be on the previous line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Jenkins Linux s390x Build #15627 [push] Fix GroupNorm to support... started at 16:50 |
Jenkins Linux amd64 Build #15624 [push] Fix GroupNorm to support... started at 15:50 |
Jenkins Linux ppc64le Build #14654 [push] Fix GroupNorm to support... started at 17:01 |
Jenkins Linux amd64 Build #15624 [push] Fix GroupNorm to support... passed after 1 hr 8 min |
Jenkins Linux s390x Build #15627 [push] Fix GroupNorm to support... passed after 1 hr 29 min |
Jenkins Linux ppc64le Build #14654 [push] Fix GroupNorm to support... passed after 2 hr 1 min |
* Group norm for opset 21 * Testing phase * Fix GroupNorm to support Opset21 --------- Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com> Co-authored-by: Megan Hampton <hamptonm@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com>
* Change lowering of onnx.IF to Krnl (#2932) * implementation Signed-off-by: chentong319 <chentong@us.ibm.com> * test case change Signed-off-by: chentong319 <chentong@us.ibm.com> * format Signed-off-by: chentong319 <chentong@us.ibm.com> * add test for If back Signed-off-by: chentong319 <chentong@us.ibm.com> * format Signed-off-by: chentong319 <chentong@us.ibm.com> --------- Signed-off-by: chentong319 <chentong@us.ibm.com> Co-authored-by: Tung D. Le <tung@jp.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * Update c style cast to c++ style cast (#2934) Signed-off-by: Mike Essenmacher <essen@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * Change c style cast to c++ style cast (#2936) Signed-off-by: Mike Essenmacher <essen@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * Add coding practices for onnx-mlir (#2935) Signed-off-by: Mike Essenmacher <essen@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * try to use new buffer deallocation (#2919) * implementation Signed-off-by: Chen Tong <chentong@us.ibm.com> * comments Signed-off-by: Chen Tong <chentong@us.ibm.com> * format Signed-off-by: Chen Tong <chentong@us.ibm.com> --------- Signed-off-by: Chen Tong <chentong@us.ibm.com> Co-authored-by: Tung D. Le <tung@jp.ibm.com> Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * fix requirements.txt link Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * Reuse input buffer in lowering to krnl (#2939) * first step Signed-off-by: chentong319 <chentong@us.ibm.com> * cpu Signed-off-by: chentong319 <chentong@us.ibm.com> * options Signed-off-by: chentong319 <chentong@us.ibm.com> * unify Signed-off-by: chentong319 <chentong@us.ibm.com> * simd Signed-off-by: chentong319 <chentong@us.ibm.com> * comments Signed-off-by: chentong319 <chentong@us.ibm.com> * lit test Signed-off-by: chentong319 <chentong@us.ibm.com> * fix test Signed-off-by: chentong319 <chentong@us.ibm.com> * format Signed-off-by: chentong319 <chentong@us.ibm.com> * response Signed-off-by: chentong319 <chentong@us.ibm.com> --------- Signed-off-by: chentong319 <chentong@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * Fix GroupNorm to support Opset21 (#2928) * Group norm for opset 21 * Testing phase * Fix GroupNorm to support Opset21 --------- Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com> Co-authored-by: Megan Hampton <hamptonm@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * Update Ops documentation for ONNX 1.16.2 (#2942) * Update Ops documentation for ONNX 1.16.2 * Fix format --------- Co-authored-by: Megan Hampton <hamptonm@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * LLVM/StableHLO Upgrade eaa95a1 (#2943) Co-authored-by: Megan Hampton <hamptonm@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * added support for no-zero-point quantization (#2938) Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com> Co-authored-by: Tung D. Le <tung@jp.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> * update with main Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> --------- Signed-off-by: chentong319 <chentong@us.ibm.com> Signed-off-by: Sunny-Anand <sunnyanand.979@gmail.com> Signed-off-by: Mike Essenmacher <essen@us.ibm.com> Signed-off-by: Chen Tong <chentong@us.ibm.com> Signed-off-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com> Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com> Signed-off-by: Sunny Anand <164108690+Sunny-Anand@users.noreply.github.com> Co-authored-by: Tong Chen <chentong@us.ibm.com> Co-authored-by: Tung D. Le <tung@jp.ibm.com> Co-authored-by: Mike Essenmacher <112431871+mikeessen@users.noreply.github.com> Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com> Co-authored-by: hamptonm1 <79232909+hamptonm1@users.noreply.github.com> Co-authored-by: Megan Hampton <hamptonm@us.ibm.com>
Updating GroupNorm to create a bias tensor and scale tensor using (C) Channel instead of (G) numGroups. The previous understanding was incorrect, I changed the code to reflect the updates made in ONNX.
Right now I included support for Opset18 as well as Opset21.
Here is more information on why the changes were made:
onnx/onnx#5466