Community,
I have faced this situation where I would like to add a new result (similar to an input operand) to an operation without creating a new operation using builder? For, e.g., consider the following loop.
%final = affine.for %i1 = 0 to 100 iter_arg(%sum=%initial) β (i32) {
%sum_updated = std.add %sum, 1 : i32
affine.yield %sum_updated
}
Let us say that I have a handler to the above for-loop, and now I would like to add a new result (e.g., multiply) to the for-loop without creating the for-op again.
%final,%mul_final = affine.for %i1 = 0 to 100 iter_arg(%sum=%initial, %mul=%initial) β (i32, i32) {
%sum_updated = std.add %sum, 1 : i32
%mul_updated = std.mul %mul, 2 : i32
affine.yield %sum_updated, %mul_updated
}
I looked at the AffineFor op, base class Operation β I see methods to insertOperands, but I donβt see methods to add results to the operation. Is it fundamentally prohibited as per the design principles, or is there a workaround without creating the for-op, adding new result, and then cloning the entire loop body?
Thanks,
Prasanth