[Mlir-commits] [mlir] [mlir][gpu][spirv] Add patterns for gpu.shuffle up/down (PR #139105)
Lei Zhang
llvmlistbot at llvm.org
Sun May 25 08:52:13 PDT 2025
================
@@ -450,8 +452,19 @@ LogicalResult GPUShuffleConversion::matchAndRewrite(
result = rewriter.create<spirv::GroupNonUniformShuffleOp>(
loc, scope, adaptor.getValue(), adaptor.getOffset());
break;
- default:
- return rewriter.notifyMatchFailure(shuffleOp, "unimplemented shuffle mode");
+ case gpu::ShuffleMode::DOWN:
+ result = rewriter.create<spirv::GroupNonUniformRotateKHROp>(
+ loc, scope, adaptor.getValue(), adaptor.getOffset(),
+ shuffleOp.getWidth());
+ break;
+ case gpu::ShuffleMode::UP: {
+ Value offsetForShuffleDown = rewriter.create<arith::SubIOp>(
+ loc, shuffleOp.getWidth(), adaptor.getOffset());
----------------
antiagainst wrote:
Is this correct? Shouldn't we use subgroup size instead of width here? Width is just the cluster size which can be smaller than the subgroup size?
https://github.com/llvm/llvm-project/pull/139105
More information about the Mlir-commits
mailing list