[mlir][linalg] Set result types in all builders.

Add code to set the result types in all yaml op builders.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D108273
This commit is contained in:
Tobias Gysi 2021-08-19 06:17:41 +00:00
parent eca03d2768
commit 234c4d2362
2 changed files with 11 additions and 0 deletions

View File

@ -62,8 +62,14 @@ structured_op: !LinalgStructuredOpConfig
# ODS-NEXT: Variadic<AnyShaped>:$outputs
# ODS: let builders =
# ODS: (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
# ODS-NEXT: "ValueRange":$outputs,
# ODS-NEXT: CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
# ODS: $_state.addOperands(inputs);
# ODS-NEXT: $_state.addOperands(outputs);
# ODS-NEXT: $_state.addTypes(resultTensorTypes);
# ODS-NEXT: $_state.addAttributes(attributes);
# ODS-NEXT: $_state.addAttribute(
# ODS-NEXT: "operand_segment_sizes",
# ODS-NEXT: $_builder.getI32VectorAttr({

View File

@ -461,6 +461,11 @@ def {0} : LinalgStructuredBase_Op<"{1}", !listconcat([
[{{
$_state.addOperands(inputs);
$_state.addOperands(outputs);
SmallVector<Type> resultTensorTypes;
copy_if(outputs.getTypes(),
std::back_inserter(resultTensorTypes),
[](Type type) {{ return type.isa<RankedTensorType>(); });
$_state.addTypes(resultTensorTypes);
$_state.addAttribute(
"operand_segment_sizes",
$_builder.getI32VectorAttr({{