torch-mlir icon indicating copy to clipboard operation
torch-mlir copied to clipboard

Add support for `AtenDivTensorOp` `AtenDivScalarOp` with integer operands

Open cathyzhyi opened this issue 4 years ago • 1 comments

The type promotion rule for div ops are different when both operands are integers (integer operands are promoted to default float type) see https://pytorch.org/docs/stable/generated/torch.div.html.

To support this, AtenDivTensorOp and AtenDivScalarOp need to have some customized logic in RefineTypes rather than using visitBinaryBroadcastingOp or visitBinaryTensorScalarOp directly as it is now https://github.com/llvm/mlir-npcomp/blob/5475d02a0d03b2bda7ef9cc240773041d22a926b/lib/Dialect/Torch/Transforms/RefineTypes.cpp#L305-L308.

Once the changes in RefineTypes are made, the TorchToLinalg lowering code can be updated as well.

cathyzhyi avatar Dec 02 '21 21:12 cathyzhyi

Hi @cathyzhyi,

Thanks for the clear problem statement! Even though this comment is a few years old, I’m interested in picking this up. I’m new to Torch-MLIR and wanted to ask if this work is still relevant to the current codebase?

If so, I’d love to work on it.

Please let me know if it’s okay to proceed! Thanks!

Megan0704-1 avatar Apr 29 '25 20:04 Megan0704-1