[Mlir-commits] [mlir] [mlir][transform] Add support for transform.param pad multiples in `PadOp` (PR #90755)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Fri May 3 01:24:33 PDT 2024
================
@@ -171,6 +171,50 @@ static DiagnosedSilenceableFailure unpackSingleIndexResultPayloadOperations(
return DiagnosedSilenceableFailure::success();
}
+static DiagnosedSilenceableFailure reifyMixedParamAndHandleResults(
+ TransformState &state, TransformOpInterface &transformOp,
+ const SmallVectorImpl<OpFoldResult> &mixedResults,
+ SmallVectorImpl<int64_t> &reified) {
+ for (OpFoldResult paramOrHandle : mixedResults) {
+ if (isa<Attribute>(paramOrHandle)) {
+ reified.push_back(
+ cast<IntegerAttr>(paramOrHandle.get<Attribute>()).getInt());
+ continue;
+ } else if (isa<Value>(paramOrHandle) &&
+ isa<ParamType>(paramOrHandle.get<Value>().getType())) {
+ ArrayRef<Attribute> params = state.getParams(paramOrHandle.get<Value>());
+ if (params.size() != 1)
+ return transformOp.emitDefiniteFailure() << "expected a single param";
+ reified.push_back(
+ cast<IntegerAttr>(params.front()).getValue().getSExtValue());
+ continue;
+ }
+
+ auto paramOrHandlePayloads =
+ state.getPayloadOps(paramOrHandle.get<Value>());
----------------
ftynse wrote:
We have (operation) handles and value handles. The fact the something is not a parameter doesn't necessarily make it an operation handle that `getPayloadOps` expects, it may be a value handle. So this will have to check, and react accordingly, if `paramOrHandle` is a value handle. Or we can disallow value handles in the type constraint of the op that uses this and add an assertion here.
https://github.com/llvm/llvm-project/pull/90755
More information about the Mlir-commits
mailing list