Skip to content

[MLIR][NFC] Expose computeProduct function. #135192

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

Merged
merged 1 commit into from
Apr 10, 2025
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
5 changes: 5 additions & 0 deletions mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ Region *getAffineScope(Operation *op);
/// analysis scope.
Region *getAffineAnalysisScope(Operation *op);

/// Return the product of `terms`, creating an `affine.apply` if any of them are
/// non-constant values. If any of `terms` is `nullptr`, return `nullptr`.
OpFoldResult computeProduct(Location loc, OpBuilder &builder,
ArrayRef<OpFoldResult> terms);

/// AffineDmaStartOp starts a non-blocking DMA operation that transfers data
/// from a source memref to a destination memref. The source and destination
/// memref need not be of the same dimensionality, but need to have the same
Expand Down
6 changes: 2 additions & 4 deletions mlir/lib/Dialect/Affine/IR/AffineOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5081,10 +5081,8 @@ struct DropLinearizeUnitComponentsIfDisjointOrZero final
}
};

/// Return the product of `terms`, creating an `affine.apply` if any of them are
/// non-constant values. If any of `terms` is `nullptr`, return `nullptr`.
static OpFoldResult computeProduct(Location loc, OpBuilder &builder,
ArrayRef<OpFoldResult> terms) {
OpFoldResult computeProduct(Location loc, OpBuilder &builder,
ArrayRef<OpFoldResult> terms) {
int64_t nDynamic = 0;
SmallVector<Value> dynamicPart;
AffineExpr result = builder.getAffineConstantExpr(1);
Expand Down