[Mlir-commits] [mlir] [mlir][gpu] Add gpu.rotate operation (PR #142796)

Jakub Kuderski llvmlistbot at llvm.org
Thu Jun 26 07:17:24 PDT 2025


================
@@ -458,6 +468,39 @@ LogicalResult GPUShuffleConversion::matchAndRewrite(
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// Rotate
+//===----------------------------------------------------------------------===//
+
+LogicalResult GPURotateConversion::matchAndRewrite(
+    gpu::RotateOp rotateOp, OpAdaptor adaptor,
+    ConversionPatternRewriter &rewriter) const {
+  auto targetEnv = getTypeConverter<SPIRVTypeConverter>()->getTargetEnv();
+  unsigned subgroupSize =
+      targetEnv.getAttr().getResourceLimits().getSubgroupSize();
+  IntegerAttr widthAttr;
+  if (!matchPattern(rotateOp.getWidth(), m_Constant(&widthAttr)) ||
+      widthAttr.getValue().getZExtValue() > subgroupSize)
+    return rewriter.notifyMatchFailure(
+        rotateOp, "rotate width is larger than target subgroup size");
----------------
kuhar wrote:

This can also fail when `width` is not a constant, no? The error message would be misleading in that case. Can we have a test for this?

https://github.com/llvm/llvm-project/pull/142796


More information about the Mlir-commits mailing list