26 struct PromoteShuffleToSwizzlePattern
30 LogicalResult matchAndRewrite(gpu::ShuffleOp op,
32 if (op.getMode() != gpu::ShuffleMode::XOR)
34 "only xor shuffle mode is supported");
38 "only 64 width shuffle is supported");
43 "offset must be a constant integer");
45 int64_t offsetValue = *offset;
46 if (offsetValue < 0 || offsetValue >= 32)
48 "offset must be in the range [0, 31]");
51 Value res = rewriter.
create<amdgpu::SwizzleBitModeOp>(
52 loc, op.getResult(0).getType(), op.getValue(), 31,
54 Value valid = rewriter.
create<arith::ConstantIntOp>(loc, 1, 1);
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
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...
std::enable_if_t<!std::is_convertible< CallbackT, Twine >::value, LogicalResult > notifyMatchFailure(Location loc, CallbackT &&reasonCallback)
Used to notify the listener that the IR failed to be rewritten because of a match failure,...
virtual void replaceOp(Operation *op, ValueRange newValues)
Replace the results of the given (original) operation with the specified list of values (replacements...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Include the generated interface declarations.
bool isConstantIntValue(OpFoldResult ofr, int64_t value)
Return true if ofr is constant integer equal to value.
std::optional< int64_t > getConstantIntValue(OpFoldResult ofr)
If ofr is a constant integer or an IntegerAttr, return the integer.
const FrozenRewritePatternSet & patterns
void populateGpuPromoteShuffleToAMDGPUPatterns(RewritePatternSet &patterns)
Tries to promote gpu.shuffles to specialized AMDGPU intrinsics.
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...
OpRewritePattern(MLIRContext *context, PatternBenefit benefit=1, ArrayRef< StringRef > generatedNames={})
Patterns must specify the root operation name they match against, and can also specify the benefit of...