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

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Fri Dec 1 09:14:23 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]);
+      for (Attribute param : paramsArray.getValue()) {
+        if (!isa<IntegerAttr>(param))
+          return transformOp.emitDefiniteFailure() << "expected IntegerAttr";
+        result.push_back(param);
----------------
ftynse wrote:

As far as I recall, there are currently two modes of functioning here:
- there are N unpacked handles, where each handle corresponds to one dimension; each handle points to the same number of operations as the "target" handle;
- there is 1 packed handle, which points to as many operations as dimensions; same dimensions are used for tiling all operations associated with the "target" handle.

Parameters should behave similarly. Since parameters are associated with a _list_ of attributes, we would treat that list identically to how we treat the list of operations for operation handle. Consequently, we should never expect an array attribute in parameters. There is already the implicit list and we must use that instead.

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


More information about the Mlir-commits mailing list