@@ -53,23 +53,25 @@ struct GpuSubgroupIdRewriter final : OpRewritePattern<gpu::SubgroupIdOp> {
53
53
// subgroup_size
54
54
55
55
Location loc = op->getLoc ();
56
+ Type indexType = rewriter.getIndexType ();
56
57
57
58
Value dimX = rewriter.create <gpu::BlockDimOp>(loc, gpu::Dimension::x);
58
59
Value dimY = rewriter.create <gpu::BlockDimOp>(loc, gpu::Dimension::y);
59
60
Value tidX = rewriter.create <gpu::ThreadIdOp>(loc, gpu::Dimension::x);
60
61
Value tidY = rewriter.create <gpu::ThreadIdOp>(loc, gpu::Dimension::y);
61
62
Value tidZ = rewriter.create <gpu::ThreadIdOp>(loc, gpu::Dimension::z);
62
63
63
- Value dimYxIdZ = rewriter.create <index::MulOp>(loc, dimY, tidZ);
64
- Value dimYxIdZPlusIdY = rewriter.create <index::AddOp>(loc, dimYxIdZ, tidY);
64
+ Value dimYxIdZ = rewriter.create <arith::MulIOp>(loc, indexType, dimY, tidZ);
65
+ Value dimYxIdZPlusIdY =
66
+ rewriter.create <arith::AddIOp>(loc, indexType, dimYxIdZ, tidY);
65
67
Value dimYxIdZPlusIdYTimesDimX =
66
- rewriter.create <index::MulOp >(loc, dimX, dimYxIdZPlusIdY);
67
- Value IdXPlusDimYxIdZPlusIdYTimesDimX =
68
- rewriter. create <index::AddOp>( loc, tidX, dimYxIdZPlusIdYTimesDimX);
68
+ rewriter.create <arith::MulIOp >(loc, indexType , dimX, dimYxIdZPlusIdY);
69
+ Value IdXPlusDimYxIdZPlusIdYTimesDimX = rewriter. create <arith::AddIOp>(
70
+ loc, indexType , tidX, dimYxIdZPlusIdYTimesDimX);
69
71
Value subgroupSize = rewriter.create <gpu::SubgroupSizeOp>(
70
72
loc, rewriter.getIndexType (), /* upper_bound = */ nullptr );
71
- Value subgroupIdOp = rewriter.create <index::DivUOp >(
72
- loc, IdXPlusDimYxIdZPlusIdYTimesDimX, subgroupSize);
73
+ Value subgroupIdOp = rewriter.create <arith::DivUIOp >(
74
+ loc, indexType, IdXPlusDimYxIdZPlusIdYTimesDimX, subgroupSize);
73
75
rewriter.replaceOp (op, {subgroupIdOp});
74
76
return success ();
75
77
}
0 commit comments