Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | bool allIndexingsAreProjectedPermutation(LinalgOp op) { | ||||
}); | }); | ||||
} | } | ||||
bool hasOnlyScalarElementwiseOp(Region &r) { | bool hasOnlyScalarElementwiseOp(Region &r) { | ||||
if (!llvm::hasSingleElement(r)) | if (!llvm::hasSingleElement(r)) | ||||
return false; | return false; | ||||
for (Operation &op : r.front()) { | for (Operation &op : r.front()) { | ||||
if (!(isa<arith::ConstantOp, func::ConstantOp, tensor::ExtractOp, | if (!(isa<arith::ConstantOp, func::ConstantOp, tensor::ExtractOp, | ||||
linalg::YieldOp, linalg::IndexOp>(op) || | linalg::YieldOp, linalg::IndexOp, AffineApplyOp>(op) || | ||||
OpTrait::hasElementwiseMappableTraits(&op)) || | OpTrait::hasElementwiseMappableTraits(&op)) || | ||||
llvm::any_of(op.getResultTypes(), | llvm::any_of(op.getResultTypes(), | ||||
[](Type type) { return !type.isIntOrIndexOrFloat(); })) | [](Type type) { return !type.isIntOrIndexOrFloat(); })) | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 921 Lines • Show Last 20 Lines |