Skip to content

Commit 1c158c1

Browse files
author
Shay Kleiman
committed
Modified assume_alignment description
Changed assertion to assumption and improved description of poison
1 parent 1177df6 commit 1c158c1

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,21 @@ class AllocLikeOp<string mnemonic,
144144

145145
def AssumeAlignmentOp : MemRef_Op<"assume_alignment", [
146146
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>,
147-
Pure,
147+
Pure,
148148
ViewLikeOpInterface,
149149
SameOperandsAndResultType
150150
]> {
151151
let summary =
152-
"assertion that gives alignment information to the input memref";
152+
"assumption that gives alignment information to the input memref";
153153
let description = [{
154-
The `assume_alignment` operation takes a memref and an integer of alignment
154+
The `assume_alignment` operation takes a memref and an integer alignment
155155
value. It returns a new SSA value of the same memref type, but associated
156-
with the assertion that the underlying buffer is aligned to the given
156+
with the assumption that the underlying buffer is aligned to the given
157157
alignment.
158158

159-
If the buffer isn't aligned to the given alignment, this operation
160-
itself does not cause undefined behavior. However, subsequent operations
161-
that consume the resulting memref and rely on this asserted alignment for
162-
correctness will produce a poison value if the assertion is false.
163-
159+
If the buffer isn't aligned to the given alignment, its result is poison.
164160
This operation doesn't affect the semantics of a program where the
165-
alignment assertion holds true. It is intended for optimization purposes,
161+
alignment assumption holds true. It is intended for optimization purposes,
166162
allowing the compiler to generate more efficient code based on the
167163
alignment assumption. The optimization is best-effort.
168164
}];

mlir/lib/Dialect/GPU/Transforms/EliminateBarriers.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ using namespace mlir::gpu;
4444
// The functions below provide interface-like verification, but are too specific
4545
// to barrier elimination to become interfaces.
4646

47-
48-
4947
/// Returns `true` if the op is defines the parallel region that is subject to
5048
/// barrier synchronization.
5149
static bool isParallelRegionBoundary(Operation *op) {
@@ -96,7 +94,6 @@ collectEffects(Operation *op,
9694
if (ignoreBarriers && isa<BarrierOp>(op))
9795
return true;
9896

99-
10097
// Collect effect instances the operation. Note that the implementation of
10198
// getEffects erases all effect instances that have the type other than the
10299
// template parameter so we collect them first in a local buffer and then

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,8 @@ LogicalResult AssumeAlignmentOp::verify() {
527527
return success();
528528
}
529529

530-
void AssumeAlignmentOp::getAsmResultNames(function_ref<void(Value, StringRef)> setNameFn) {
530+
void AssumeAlignmentOp::getAsmResultNames(
531+
function_ref<void(Value, StringRef)> setNameFn) {
531532
setNameFn(getResult(), "assume_align");
532533
}
533534

mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,12 +937,13 @@ struct ExtractStridedMetadataOpAssumeAlignmentFolder
937937

938938
LogicalResult matchAndRewrite(memref::ExtractStridedMetadataOp op,
939939
PatternRewriter &rewriter) const override {
940-
auto assumeAlignmentOp =
940+
auto assumeAlignmentOp =
941941
op.getSource().getDefiningOp<memref::AssumeAlignmentOp>();
942942
if (!assumeAlignmentOp)
943943
return failure();
944944

945-
rewriter.replaceOpWithNewOp<memref::ExtractStridedMetadataOp>(op, assumeAlignmentOp.getViewSource());
945+
rewriter.replaceOpWithNewOp<memref::ExtractStridedMetadataOp>(
946+
op, assumeAlignmentOp.getViewSource());
946947
return success();
947948
}
948949
};

0 commit comments

Comments
 (0)