@@ -91,7 +91,8 @@ genOffsetsList(ConversionPatternRewriter &rewriter, OpType op,
91
91
if (!layout || !layout.isForWorkgroup ())
92
92
return failure ();
93
93
94
- Value sgId = rewriter.create <gpu::SubgroupIdOp>(loc, /* upper_bound=*/ nullptr );
94
+ Value sgId =
95
+ gpu::SubgroupIdOp::create (rewriter, loc, /* upper_bound=*/ nullptr );
95
96
96
97
// verify and adjust the sgId if the range specifier is present
97
98
xegpu::RangeAttr sgIdRange = getRangeSpecAttr (op);
@@ -105,8 +106,8 @@ genOffsetsList(ConversionPatternRewriter &rewriter, OpType op,
105
106
// adjust the sgId if necessary
106
107
if (startOfRange > 0 ) {
107
108
Value startOfRangeVal =
108
- rewriter. create < arith::ConstantIndexOp>( loc, startOfRange);
109
- sgId = rewriter. create < index::SubOp>( loc, sgId, startOfRangeVal);
109
+ arith::ConstantIndexOp::create (rewriter, loc, startOfRange);
110
+ sgId = index::SubOp::create (rewriter, loc, sgId, startOfRangeVal);
110
111
}
111
112
}
112
113
@@ -339,9 +340,9 @@ struct WgToSgStoreNdOpWithOffset
339
340
340
341
for (auto [v, tdesc, offsets] :
341
342
llvm::zip (adaptor.getValue (), adaptor.getTensorDesc (), offsetsList)) {
342
- rewriter. create < xegpu::StoreNdOp>( op.getLoc (), v, tdesc, offsets,
343
- op.getL1HintAttr (), op.getL2HintAttr (),
344
- op.getL3HintAttr ());
343
+ xegpu::StoreNdOp::create (rewriter, op.getLoc (), v, tdesc, offsets,
344
+ op.getL1HintAttr (), op.getL2HintAttr (),
345
+ op.getL3HintAttr ());
345
346
}
346
347
rewriter.eraseOp (op);
347
348
@@ -363,9 +364,9 @@ struct WgToSgPrefetchNdOpWithOffset
363
364
364
365
for (auto [tdesc, offsets] :
365
366
llvm::zip (adaptor.getTensorDesc (), offsetsList)) {
366
- rewriter. create < xegpu::PrefetchNdOp>(
367
- op. getLoc (), tdesc, offsets, op.getL1HintAttr (), op.getL2HintAttr (),
368
- op.getL3HintAttr ());
367
+ xegpu::PrefetchNdOp::create (rewriter, op. getLoc (), tdesc, offsets,
368
+ op.getL1HintAttr (), op.getL2HintAttr (),
369
+ op.getL3HintAttr ());
369
370
}
370
371
rewriter.eraseOp (op);
371
372
@@ -807,8 +808,8 @@ struct WgToSgLoadGatherOpWithOffset
807
808
VectorType newTy = VectorType::get (sgShape, resultType.getElementType ());
808
809
for (auto [offsets, mask] :
809
810
llvm::zip (adaptor.getOffsets (), adaptor.getMask ())) {
810
- auto newLoadOp = rewriter. create < xegpu::LoadGatherOp> (
811
- loc, newTy, op.getSource (), offsets, mask, chunkSizeAttr,
811
+ auto newLoadOp = xegpu::LoadGatherOp::create (
812
+ rewriter, loc, newTy, op.getSource (), offsets, mask, chunkSizeAttr,
812
813
op.getL1HintAttr (), op.getL2HintAttr (), op.getL3HintAttr ());
813
814
xegpu::setDistributeLayoutAttr (newLoadOp->getResult (0 ),
814
815
layout.dropSgLayoutAndData ());
@@ -857,9 +858,9 @@ struct WgToSgStoreScatterOpWithOffset
857
858
auto chunkSizeAttr = rewriter.getI64IntegerAttr (chunkSize);
858
859
for (auto [val, offs, mask] : llvm::zip (
859
860
adaptor.getValue (), adaptor.getOffsets (), adaptor.getMask ())) {
860
- rewriter. create < xegpu::StoreScatterOp>(
861
- loc, val, op. getDest (), offs, mask, chunkSizeAttr, op.getL1HintAttr (),
862
- op.getL2HintAttr (), op.getL3HintAttr ());
861
+ xegpu::StoreScatterOp::create (rewriter, loc, val, op. getDest (), offs,
862
+ mask, chunkSizeAttr, op.getL1HintAttr (),
863
+ op.getL2HintAttr (), op.getL3HintAttr ());
863
864
// Update the layout attribute to drop sg_layout and sg_data.
864
865
if (auto newLayout = layout.dropSgLayoutAndData ())
865
866
op->setAttr (" layout" , newLayout);
@@ -888,9 +889,9 @@ struct WgToSgLoadMatrixOp : public OpConversionPattern<xegpu::LoadMatrixOp> {
888
889
VectorType newResTy = VectorType::get (sgShape, elemTy);
889
890
SmallVector<Value> newOps;
890
891
for (auto offsets : offsetsList) {
891
- auto newOp = rewriter. create < xegpu::LoadMatrixOp>(
892
- op. getLoc (), newResTy, op.getMemDesc (), offsets,
893
- layout.dropSgLayoutAndData ());
892
+ auto newOp = xegpu::LoadMatrixOp::create (rewriter, op. getLoc (), newResTy,
893
+ op.getMemDesc (), offsets,
894
+ layout.dropSgLayoutAndData ());
894
895
newOps.push_back (newOp);
895
896
}
896
897
rewriter.replaceOpWithMultiple (op, {newOps});
@@ -911,9 +912,8 @@ struct WgToSgStoreMatrixOp : public OpConversionPattern<xegpu::StoreMatrixOp> {
911
912
912
913
xegpu::DistributeLayoutAttr layout = op.getLayoutAttr ();
913
914
for (auto [v, offsets] : llvm::zip (adaptor.getData (), offsetsList))
914
- rewriter.create <xegpu::StoreMatrixOp>(op.getLoc (), v, op.getMemDesc (),
915
- offsets,
916
- layout.dropSgLayoutAndData ());
915
+ xegpu::StoreMatrixOp::create (rewriter, op.getLoc (), v, op.getMemDesc (),
916
+ offsets, layout.dropSgLayoutAndData ());
917
917
rewriter.eraseOp (op);
918
918
return success ();
919
919
}
0 commit comments