index_add decomposed into index_put through TM Tensor
Combined all the commits from the index-add-to-put_TMTensor branch and moved it to a new branch that's rebased
@ramiro050 and @pashu123 I moved it to a fresh branch and the CI went through!
You can run the lit tests locally by doing cmake --build build --target check-torch-mlir
@ramiro050 not sure why but the actual python unit test is failing. What could cause a "failed to legalize operation 'torch.aten.index_add' that was explicitly marked illegal" error?
@ramiro050 not sure why but the actual python unit test is failing. What could cause a "failed to legalize operation 'torch.aten.index_add' that was explicitly marked illegal" error?
That error means that your conversion pattern failed, so the op torch.aten.index_add stayed in the IR.
From the error message, you can tell that the input does have a rank, so the failure has to be in the getTensorRank(updates) != inputRank check. I think this is because the unit test is not right. In your unit test, the input has rank 3 and the source tensor has rank 2 according to the annotation.
The op is still marked as illegal despite the changes even though now the annotations match the types and shapes of the arguments
The op is still marked as illegal despite the changes even though now the annotations match the types and shapes of the arguments
The test has inputs that are invalid in the decomposition. Here,
https://github.com/llvm/torch-mlir/blob/0c9084f7e14bb1479c7d20088d076b5eae3827a1/lib/Dialect/Torch/Transforms/DecomposeComplexOps.cpp#L1659
there is an expectation for the source tensor to have the same rank as the input tensor, but in your test the source tensor has rank 1, while the input tensor has rank 3
https://github.com/llvm/torch-mlir/blob/0c9084f7e14bb1479c7d20088d076b5eae3827a1/python/torch_mlir_e2e_test/test_suite/index_put.py#L830-L833
For the record, I plan to resurrect https://github.com/llvm/torch-mlir/pull/1063 since this effort / PR seems to be stale now. Please feel free to push back if that's not true..
Yes, I think we can consider this stale, since there hasn't been an update in a year and a half.