[Mlir-commits] [mlir] Add support of param type for transform.structured.tile_using_forall (PR #72097)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Nov 13 04:13:30 PST 2023


================
@@ -98,12 +98,34 @@ static DiagnosedSilenceableFailure unpackSingleIndexResultPayloadOperations(
       result.push_back(ofr);
       continue;
     }
-    auto payloadOps = state.getPayloadOps(ofr.get<Value>());
+
+    Value transformValue = ofr.get<Value>();
+    if (isa<ParamType>(transformValue.getType())) {
+      ArrayRef<Attribute> params = state.getParams(transformValue);
+      if (!isa<IntegerAttr>(params[0]))
+        return transformOp.emitDefiniteFailure() << "expected IntegerAttr";
+      result.push_back(params[0]);
+      continue;
+    }
+    if (isa<AnyParamType>(transformValue.getType())) {
+      ArrayRef<Attribute> params = state.getParams(transformValue);
+      if (!isa<ArrayAttr>(params[0]))
+        return transformOp.emitDefiniteFailure() << "expected ArrayAttr";
+      ArrayAttr paramsArray = cast<ArrayAttr>(params[0]);
----------------
ftynse wrote:

`isa` followed by `cast` is an anti-pattern. Use `dyn_cast` and check for null instead.

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


More information about the Mlir-commits mailing list