-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[mlir] ArithToLLVM: fix memref bitcast lowering #125148
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,6 +103,14 @@ LogicalResult LLVM::detail::handleMultidimensionalVectors( | |
| return success(); | ||
| } | ||
|
|
||
| static bool isVectorCompatibleType(Type type) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can just
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was using
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of fiddling, can you just set
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While |
||
| // Limit `vectorOneToOneRewrite` to scalar and vector types (and to | ||
| // `LLVM::LLVMArrayType` which have a special handling). | ||
| return isa<LLVM::LLVMArrayType, LLVM::LLVMPointerType, VectorType, | ||
| IntegerType, FloatType>(type) && | ||
| LLVM::isCompatibleType(type); | ||
| } | ||
|
|
||
| LogicalResult LLVM::detail::vectorOneToOneRewrite( | ||
| Operation *op, StringRef targetOp, ValueRange operands, | ||
| ArrayRef<NamedAttribute> targetAttrs, | ||
|
|
@@ -111,7 +119,7 @@ LogicalResult LLVM::detail::vectorOneToOneRewrite( | |
| assert(!operands.empty()); | ||
|
|
||
| // Cannot convert ops if their operands are not of LLVM type. | ||
| if (!llvm::all_of(operands.getTypes(), isCompatibleType)) | ||
| if (!llvm::all_of(operands.getTypes(), isVectorCompatibleType)) | ||
| return failure(); | ||
|
|
||
| auto llvmNDVectorTy = operands[0].getType(); | ||
|
|
||
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 think, to get the behavior you want here where identity bitcast on memref gets folded away before the general pattern for
arith.bitcastkicks in, you want to set aPatternBenefit