Skip to content

[MLIR][TableGen] Use arg index in InferredResultType constructor. #122717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/lib/TableGen/Operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ void Operator::populateTypeInferenceInfo(
for (int otherResultIndex : resultIndices) {
if (resultIndex == otherResultIndex)
continue;
inference[resultIndex].sources.emplace_back(otherResultIndex,
"$_self");
inference[resultIndex].sources.emplace_back(
InferredResultType::unmapResultIndex(otherResultIndex), "$_self");
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions mlir/test/mlir-tblgen/op-result.td
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,27 @@ def OpL4 : NS_Op<"two_inference_edges", [
// CHECK: inferredReturnTypes[1] = odsInferredType1
// CHECK: inferredReturnTypes[2] = odsInferredType2

def OpL5 : NS_Op<"op_with_same_but_unconstraint_results",
[AllTypesMatch<["result_a", "result_b"]>]> {
let results = (outs AnyType:$result_a, AnyType:$result_b);
}

// CHECK-NOT: LogicalResult OpL5::inferReturnTypes

def OpL6 : NS_Op<"op_with_same_and_constraint_results",
[AllTypesMatch<["result_a", "result_b", "result_c"]>]> {
let results = (outs AnyType:$result_a, AnyType:$result_b, I32:$result_c);
}

// CHECK-LABEL: LogicalResult OpL6::inferReturnTypes
// CHECK-NOT: }
// CHECK: odsInferredType0 = odsBuilder.getIntegerType(32);
// CHECK: odsInferredType1 = odsBuilder.getIntegerType(32);
// CHECK: odsInferredType2 = odsBuilder.getIntegerType(32);
// CHECK: inferredReturnTypes[0] = odsInferredType0;
// CHECK: inferredReturnTypes[1] = odsInferredType1;
// CHECK: inferredReturnTypes[2] = odsInferredType2;

def OpM : NS_Op<"mix_diff_size_variadic_and_normal_results_op", [AttrSizedResultSegments]> {
let results = (outs Variadic<AnyTensor>:$output1, AnyTensor:$output2, Optional<AnyTensor>:$output3);
}
Expand Down
Loading