23 using OpRewritePattern<gpu::GlobalIdOp>::OpRewritePattern;
25 LogicalResult matchAndRewrite(gpu::GlobalIdOp op,
26 PatternRewriter &rewriter)
const override {
27 Location loc = op.getLoc();
28 auto dim = op.getDimension();
29 Value blockId = gpu::BlockIdOp::create(rewriter, loc, dim);
30 Value blockDim = gpu::BlockDimOp::create(rewriter, loc, dim);
34 arith::MulIOp::create(rewriter, loc, indexType, blockId, blockDim);
35 Value threadId = gpu::ThreadIdOp::create(rewriter, loc, dim);
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
Include the generated interface declarations.
void populateGpuGlobalIdPatterns(RewritePatternSet &patterns)
Collect a set of patterns to rewrite GlobalIdOp op within the GPU dialect.
const FrozenRewritePatternSet & patterns
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...