27 LogicalResult matchAndRewrite(gpu::GlobalIdOp op,
29 auto loc = op.getLoc();
30 auto dim = op.getDimension();
31 auto blockId = rewriter.
create<gpu::BlockIdOp>(loc, dim);
32 auto blockDim = rewriter.
create<gpu::BlockDimOp>(loc, dim);
34 auto tmp = rewriter.
create<index::MulOp>(op.getLoc(), blockId, blockDim);
35 auto threadId = rewriter.
create<gpu::ThreadIdOp>(loc, dim);
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
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...