25 LogicalResult matchAndRewrite(gpu::GlobalIdOp op,
28 auto dim = op.getDimension();
29 auto blockId = gpu::BlockIdOp::create(rewriter, loc, dim);
30 auto blockDim = gpu::BlockDimOp::create(rewriter, loc, dim);
32 auto tmp = index::MulOp::create(rewriter, op.getLoc(), blockId, blockDim);
33 auto threadId = gpu::ThreadIdOp::create(rewriter, loc, dim);
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
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...