Skip to content

Commit a8cd5e0

Browse files
committed
Address comments.
1 parent 236343e commit a8cd5e0

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class CreateNdDescToXeVMPattern
152152
auto loc = op.getLoc();
153153
auto source = op.getSource();
154154
// Op is lowered to a code sequence that populates payload.
155-
// payload is a 8xi32 vector.
155+
// Payload is a 8xi32 vector.
156156
Type payloadElemTy = rewriter.getI32Type();
157157
Type i64Ty = rewriter.getI64Type();
158158
VectorType payloadTy = VectorType::get(8, payloadElemTy);
@@ -179,7 +179,7 @@ class CreateNdDescToXeVMPattern
179179
auto sourceTy = source.getType();
180180
auto sourceMemrefTy = dyn_cast<MemRefType>(sourceTy);
181181
// If source is a memref, we need to extract the aligned pointer as index.
182-
// pointer type is passed as i32 or i64 by type converter.
182+
// Pointer type is passed as i32 or i64 by type converter.
183183
if (sourceMemrefTy) {
184184
baseAddr =
185185
memref::ExtractAlignedPointerAsIndexOp::create(rewriter, loc, source);
@@ -190,7 +190,7 @@ class CreateNdDescToXeVMPattern
190190
} else {
191191
baseAddr = adaptor.getSource();
192192
}
193-
// utility for creating offset values from op fold result.
193+
// Utility for creating offset values from op fold result.
194194
auto createOffset = [&](SmallVector<OpFoldResult> &ofrVec,
195195
unsigned idx) -> Value {
196196
Value val = getValueOrCreateConstantIntOp(rewriter, loc, ofrVec[idx]);
@@ -212,10 +212,10 @@ class CreateNdDescToXeVMPattern
212212
baseShapeW = createOffset(mixedSizes, rank - 1);
213213
baseShapeH = createOffset(mixedSizes, rank - 2);
214214
if (sourceMemrefTy) {
215-
// cast index to i64.
215+
// Cast index to i64.
216216
baseAddr = arith::IndexCastUIOp::create(rewriter, loc, i64Ty, baseAddr);
217217
} else if (baseAddr.getType() != i64Ty) {
218-
// pointer type may be i32. Cast to i64 if needed.
218+
// Pointer type may be i32. Cast to i64 if needed.
219219
baseAddr = arith::ExtUIOp::create(rewriter, loc, i64Ty, baseAddr);
220220
}
221221
// Populate payload.
@@ -255,7 +255,7 @@ class UpdateNdOffsetToXeVMPattern
255255
if (mixedOffsets.size() != 2)
256256
return rewriter.notifyMatchFailure(op, "Expected 2D offsets.");
257257
auto tdesc = adaptor.getTensorDesc();
258-
// utility for updating payload offset values from op fold result.
258+
// Utility for updating payload offset values from op fold result.
259259
auto updateOffset = [&](unsigned idx, int payloadPos) -> Value {
260260
Value offset =
261261
getValueOrCreateConstantIntOp(rewriter, loc, mixedOffsets[idx]);
@@ -425,7 +425,7 @@ class CreateDescToXeVMPattern
425425
op, "Expected element type bit width to be multiple of 8.");
426426
}
427427
auto loc = op.getLoc();
428-
// offsets are provided as scalar i64 by type converter.
428+
// Offsets are provided as scalar i64 by type converter.
429429
auto offsets = adaptor.getOffsets();
430430
// Source type can be a 1D memref or pointer type (ui64, ui32, i64 or i32).
431431
// But type converter will convert them to integer types.
@@ -453,8 +453,8 @@ class UpdateOffsetToXeVMPattern
453453
op, "Expected element type bit width to be multiple of 8.");
454454
}
455455
auto loc = op.getLoc();
456-
// scatter descriptor is provided as scalar i64 by type converter.
457-
// offsets are provided as scalar i64 by type converter.
456+
// Scatter descriptor is provided as scalar i64 by type converter.
457+
// Offsets are provided as scalar i64 by type converter.
458458
Value newOffset = addOffset(rewriter, loc, adaptor.getTensorDesc(),
459459
adaptor.getOffsets(), eBw / 8);
460460
rewriter.replaceOp(op, newOffset);
@@ -583,7 +583,7 @@ class LoadStoreToXeVMPattern : public OpConversionPattern<OpType> {
583583
scf::YieldOp::create(rewriter, loc, ValueRange{loaded});
584584
rewriter.replaceOp(op, ifOp.getResult(0));
585585
} else {
586-
// if mask is true, perform the store.
586+
// If mask is true, perform the store.
587587
scf::IfOp ifOp = scf::IfOp::create(rewriter, loc, maskForLane, false);
588588
auto body = ifOp.getBody();
589589
rewriter.setInsertionPointToStart(body);
@@ -758,7 +758,7 @@ class DpasToXeVMPattern : public OpConversionPattern<xegpu::DpasOp> {
758758
VectorType::get(cvecty.getNumElements(), cvecty.getElementType());
759759
if (cvecty != cNty)
760760
c = vector::ShapeCastOp::create(rewriter, loc, cNty, c);
761-
// below are uArch dependent values, should move away from hardcoding
761+
// Below are uArch dependent values, should move away from hardcoding
762762
constexpr int32_t systolicDepth{8};
763763
constexpr int32_t executionSize{16};
764764
Value dpasRes = xevm::MMAOp::create(
@@ -818,7 +818,6 @@ matchSimpleAtomicOp(arith::AtomicRMWKind arithKind) {
818818
default:
819819
return std::nullopt;
820820
}
821-
llvm_unreachable("Invalid AtomicRMWKind");
822821
}
823822

824823
class AtomicRMWToXeVMPattern : public OpConversionPattern<xegpu::AtomicRMWOp> {

0 commit comments

Comments
 (0)