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

Hsiangkai Wang llvmlistbot at llvm.org
Fri Jun 27 03:51:55 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");
----------------
Hsiangkai wrote:

Update the error message and add tests for failed cases.

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


More information about the Mlir-commits mailing list