Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -921,17 +921,17 @@ struct ScatterMaterializeInsertedDim final
}
}

llvm::ArrayRef<bool> toInsertDims =
auto toInsertDims =
llvm::ArrayRef<bool>(isInsertDims).drop_front(frontInsertedDims);
if (!llvm::any_of(toInsertDims, [](auto d) { return d; })) {
if (llvm::none_of(toInsertDims, [](bool d) { return d; })) {
return rewriter.notifyMatchFailure(op, "no dimensions to insert");
}

// Create a reassociation map that starts with the batch dims.
SmallVector<ReassociationExprs> reassociationMap;
reassociationMap.push_back({rewriter.getAffineDimExpr(0)});

for (auto it : llvm::enumerate(llvm::ArrayRef<bool>(toInsertDims))) {
for (auto it : llvm::enumerate(toInsertDims)) {
if (!it.value()) {
reassociationMap.push_back({});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static void formatIOAttr(DictionaryAttr attrs, llvm::raw_ostream &os) {
auto shouldIncludeAttr = [](const NamedAttribute &attr) {
return attr.getName().getValue() != "iree.abi.name";
};
if (!llvm::any_of(attrs, shouldIncludeAttr)) {
if (llvm::none_of(attrs, shouldIncludeAttr)) {
return;
}
os << " {";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,8 @@ static LogicalResult isUnpaddedAndAtBoundary(Operation *op) {
// If all consumers are dispatch tensor stores, then the `op` is decomposable
// if it is an UnPackOp.
if (isa<linalg::UnPackOp>(op) &&
llvm::all_of(op->getUsers(), [&](Operation *user) {
return isa<IREE::TensorExt::DispatchTensorStoreOp>(user);
})) {
llvm::all_of(op->getUsers(),
llvm::IsaPred<IREE::TensorExt::DispatchTensorStoreOp>)) {
return success();
}
return failure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ void populateMaterializeEncodingPatterns(
return resultType == typeConverter.convertType(resultType);
});
target.addDynamicallyLegalOp<func::ReturnOp>([](func::ReturnOp returnOp) {
return !llvm::any_of(returnOp.getOperandTypes(),
return llvm::none_of(returnOp.getOperandTypes(),
isRankedTensorTypeWithEncoding);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,7 @@ static LogicalResult rewriteForallToWorkgroup(RewriterBase &rewriter,
}
SmallVector<Attribute> blockMapping =
llvm::to_vector(forallOp.getMapping()->getValue());
if (llvm::any_of(blockMapping, [](Attribute map) {
return !isa<gpu::GPUBlockMappingAttr>(map);
})) {
if (!llvm::all_of(blockMapping, llvm::IsaPred<gpu::GPUBlockMappingAttr>)) {
return forallOp->emitError("mapping must be #gpu.block<x/y/z/>");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,8 @@ fuseNestedLaneAndWarpForalls(RewriterBase &rewriter, scf::ForallOp warpForallOp,
scf::ForallOp laneForallOp) {
// Verify mappings.
if (!warpForallOp.getMapping() ||
!llvm::all_of(*warpForallOp.getMapping(), [](Attribute mappingAttr) {
return isa<gpu::GPUWarpMappingAttr>(mappingAttr);
})) {
!llvm::all_of(*warpForallOp.getMapping(),
llvm::IsaPred<gpu::GPUWarpMappingAttr>)) {
return rewriter.notifyMatchFailure(warpForallOp, "not a warp forall op");
}
if (!laneForallOp.getMapping() || laneForallOp.getMapping()->size() != 1 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@ NestedLayoutAttr::getRecombinedLayout(ArrayRef<VectorLayoutInterface> layouts,
ArrayRef<AffineMap> maps,
AffineMap resultMap) {
constexpr int64_t kInvalid = -1;
if (llvm::any_of(layouts, [](VectorLayoutInterface layout) {
return !isa<NestedLayoutAttr>(layout);
})) {
if (!llvm::all_of(layouts, llvm::IsaPred<NestedLayoutAttr>)) {
return NestedLayoutAttr();
}
MLIRContext *context = resultMap.getContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ MemRefDescriptor HALDispatchABI::loadBinding(Operation *forOp, int64_t ordinal,
// requested range is valid.
auto [strides, offset] = memRefType.getStridesAndOffset();
if (memRefType.hasStaticShape() &&
!llvm::any_of(strides, ShapedType::isDynamic) &&
llvm::none_of(strides, ShapedType::isDynamic) &&
ShapedType::isStatic(offset)) {
return MemRefDescriptor::fromStaticShape(builder, loc, *typeConverter,
memRefType, basePtrValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ struct ConvertIREEBindingSubspanOp final

auto [strides, offset] = memrefType.getStridesAndOffset();
if (memrefType.hasStaticShape() &&
!llvm::any_of(strides, ShapedType::isDynamic) &&
llvm::none_of(strides, ShapedType::isDynamic) &&
ShapedType::isStatic(offset)) {
auto desc = MemRefDescriptor::fromStaticShape(
rewriter, loc, *getTypeConverter(), memrefType, llvmBufferBasePtr);
Expand Down
5 changes: 2 additions & 3 deletions compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,8 @@ LogicalResult isAtBoundary(Operation *op) {
return success();
}
} else if (isa<linalg::UnPackOp>(op)) {
if (llvm::all_of(op->getUsers(), [](Operation *user) {
return isa<IREE::TensorExt::DispatchTensorStoreOp>(user);
})) {
if (llvm::all_of(op->getUsers(),
llvm::IsaPred<IREE::TensorExt::DispatchTensorStoreOp>)) {
return success();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,8 @@ struct FoldSplitReductionForallWithWorkgroupForall
}
std::optional<ArrayAttr> workgroupMapping = workgroupLoop.getMapping();
if (!workgroupMapping ||
llvm::any_of(workgroupMapping->getValue(), [](Attribute attr) {
return !isa<IREE::Codegen::WorkgroupMappingAttr>(attr);
})) {
!llvm::all_of(workgroupMapping->getValue(),
llvm::IsaPred<IREE::Codegen::WorkgroupMappingAttr>)) {
return rewriter.notifyMatchFailure(
workgroupLoop, "nested loop is not a workgroup mapping loop");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,7 @@ static FailureOr<AffineMap> getComposedAffineMap(Attribute attr) {
return AffineMap();
}
// All entries should have type `AffineMapAttr`.
if (!llvm::all_of(mapsAttr, [](Attribute attr) {
return isa<AffineMapAttr>(attr);
})) {
if (!llvm::all_of(mapsAttr, llvm::IsaPred<AffineMapAttr>)) {
return failure();
}
AffineMap map =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ rewriteFlowDispatchRegionToFlowDispatchWorkgroups(
llvm::SetVector<Value> argumentsSet;
mlir::getUsedValuesDefinedAbove(region, argumentsSet);
// Unranked tensors are not supported.
assert(!llvm::any_of(argumentsSet, [](Value v) {
return isa<UnrankedTensorType>(v.getType());
}) && "unranked tensors are not supported");
assert(llvm::none_of(
argumentsSet,
[](Value v) { return isa<UnrankedTensorType>(v.getType()); }) &&
"unranked tensors are not supported");

// Compute dimensions of tensor args.
SmallVector<Value> argumentDims;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,8 @@ FailureOr<Operation *> hoistOutOfDispatch(RewriterBase &rewriter,
return producer && producer->getParentOfType<DispatchRegionOp>();
})) {
rewriter.setInsertionPoint(dispatchRegionOp);
} else if (llvm::all_of(op->getUsers(), [&](Operation *user) {
return isa<IREE::Flow::ReturnOp>(user);
})) {
} else if (llvm::all_of(op->getUsers(),
llvm::IsaPred<IREE::Flow::ReturnOp>)) {
rewriter.setInsertionPointAfter(dispatchRegionOp);
} else {
return rewriter.notifyMatchFailure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static void expandRegion(Region &region, bool canModifyEntryBlock,
// Update all block arguments.
auto timepointType = IREE::Stream::TimepointType::get(region.getContext());
for (auto &block : region.getBlocks()) {
if (!llvm::any_of(block.getArgumentTypes(), isResourceType)) {
if (llvm::none_of(block.getArgumentTypes(), isResourceType)) {
continue;
}
if (block.isEntryBlock() && !canModifyEntryBlock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static void expandRegion(Region &region, bool canModifyEntryBlock,
// Update all block arguments.
auto indexType = IndexType::get(region.getContext());
for (auto &block : region.getBlocks()) {
if (!llvm::any_of(block.getArgumentTypes(), isResourceType)) {
if (llvm::none_of(block.getArgumentTypes(), isResourceType)) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ isFusableWithConsumer(OpOperand &fusedOperand, const FusionTracker &tracker,
continue;
}
if (isa<linalg::ConvolutionOpInterface>(producer) &&
!llvm::any_of(
llvm::none_of(
consumerDstOp.getDpsInitsMutable(), [&](OpOperand &initOperand) {
return canUseInOperandAsInitOperand(inputOperand, &initOperand);
})) {
Expand Down Expand Up @@ -979,9 +979,8 @@ decideFusableLinalgOps(Region &region, DominanceInfo const &dominanceInfo,
// by the `isClonableIntoDispatchOp` call above, but for now this is done
// as a point fix.
if (IREE::LinalgExt::isGatherlikeOp(&op) &&
llvm::all_of(op.getUsers(), [](Operation *op) {
return isa<IREE::LinalgExt::AttentionOp>(op);
})) {
llvm::all_of(op.getUsers(),
llvm::IsaPred<IREE::LinalgExt::AttentionOp>)) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static bool isHorizontalToGroup(Operation *op,
llvm::SetVector<Operation *> slice;
[[maybe_unused]] LogicalResult result = getBackwardSlice(op, &slice, options);
assert(result.succeeded());
return !llvm::any_of(currGroup, [&](Operation *groupedOp) {
return llvm::none_of(currGroup, [&](Operation *groupedOp) {
return slice.contains(groupedOp);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static void expandRegion(Region &region, SymbolTable &symbolTable,
// Update all block arguments.
auto indexType = IndexType::get(region.getContext());
for (auto &block : region.getBlocks()) {
if (!llvm::any_of(block.getArgumentTypes(), isDynamicTensor)) {
if (llvm::none_of(block.getArgumentTypes(), isDynamicTensor)) {
continue;
}

Expand Down
Loading