-
Notifications
You must be signed in to change notification settings - Fork 1
[MLIR][Affine] Fixed crash with invalid reduction op (Issue #64073) #8
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
base: issue_64073
Are you sure you want to change the base?
[MLIR][Affine] Fixed crash with invalid reduction op (Issue #64073) #8
Conversation
|
This crash occurred when getIdentityValue tries to build a value based on the 'attr' recieved, which is a nullptr if the op is not a valid reduction op. In llvm#64073 the reduction op being passed is 'assign' which although is atomicRMW but not reduction op. In the current fix, the getIdentityValue returns a nullptr instead of building a value if the op is invalid. Another proposed fix could be to have a separate enum like 'AtomicRMWReductionKind' to hold only reduction ops of atomicRMW kind. It would be easier to work with reduction ops using this enum. |
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.
Why is this deleted?
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.
Both maxnumf and minnumf are invalid reduction ops and should not be a valid case in getReductionOps.
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.
I see.
5224420 to
a353dc8
Compare
Updated AffineParallelLowering to check if reduction op value being returned is valid else return failure in matchAndRewrite Updated ArithOps.cpp getIdentityValue method to return nullptr if op is not a valid reduction op Code cleanup in ArithOps.cpp getReductionOp method; removed cases maxnumf and minnumf as not valid reduction ops Reporting Issue is llvm#64073
a353dc8 to
0dc71be
Compare
|
Changes addressed :
|
| OpBuilder &builder, Location loc, | ||
| bool useOnlyFiniteValue) { | ||
| auto attr = | ||
| getIdentityValueAttr(op, resultType, builder, loc, useOnlyFiniteValue); |
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.
Addressing comment on lines 2528 to 2530 regarding deletion of maxnumf and minnumf as reduction op cases:
The 'getIdentityAttr()' method called here returns valid attr iff the op passed is a valid reductionOp else returns nullptr.
This method does not consider 'maxnumf' and 'minnumf' as valid reduction ops. If this is correct, then consequently maxnumf and minnumf cases should be safely removable from the "getReductionOp()", as done in this commit.
Updated AffineParallelLowering to check if reduction op value being returned is valid else return failure in matchAndRewrite Updated ArithOps.cpp getIdentityValue method to return nullptr if op is not a valid reduction op Code cleanup in ArithOps.cpp getReductionOp method; removed cases maxnumf and minnumf as not valid reduction ops
Reporting Issue is llvm#64073