llvm/torch-mlir

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

Offen

#456 geöffnet am 02.12.2021

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C++ (724 Forks)github user discovery
help wanted

Repository-Metriken

Stars
 (1.888 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 11T 19h) (18 gemergte PRs in 30 T)

Beschreibung

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.

Contributor Guide