torch-mlir/test/Dialect/Torch
Yi Zhang 752abc8d01 Add type promotion code to refine types.
The types have different levels of categories: where
complex > floating > integral > boolean (> means left hand
side has higher category).

The operands have different levels of priorities where:
dimensioned tensor > 0-dim tensor > scalar == wrapped 0-dim tensor.
This is represented by the `ResultTypeState.dimResult`,
`ResultTypeState.zeroResult` and `ResultTypeState..wrappedResult` in
the source code.

For operands of the same priorities, the result type should be the
highest categories with sufficient width to hold all operands.

By default, only the highest priority operands participate in the type
promotion logic. Lower priority operands participate if they are in
a higher category than any higher priority operands.

For example, <[],f32> (lower priority) and <[1], si64> tensor would
result in <[?],f32> tensor because floating > integeral. Another example
<[],f64> (lower priority) and <[1], f32> tensor would result in
<[?], f32> tensor because f32 and f64 are the same category.

The ScalarType enum definition, type promotion table, ResultTypeState
struct definition and some helpers are copied from
aten/src/ATen/native/TypeProperties.*
Other references:
- https://pytorch.org/docs/stable/tensor_attributes.html#type-promotion-doc
- https://github.com/pytorch/pytorch/issues/9515

Other minor changes:
1. Fix `visitExpandLikeOp` to consider cases where the given sizes list
size is larger than the input rank.
2. Add back the somehow deleted `torch.aten.softmax.int` tests in
decompose-complex-ops.mlir.
2021-10-29 11:17:39 -04:00
..
GlobalizeObjectGraph Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
adjust-calling-conventions.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
canonicalize.mlir Add aten.ne.bool to make CI pass 2021-10-21 14:45:41 -04:00
decompose-complex-ops.mlir Add type promotion code to refine types. 2021-10-29 11:17:39 -04:00
inline-global-slots.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
invalid.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
maximize-value-semantics.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
ops.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
prepare-for-globalize-object-graph.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
promote-types.mlir Add type promotion code to refine types. 2021-10-29 11:17:39 -04:00
reduce-op-variants-error.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
reduce-op-variants.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
refine-public-return.mlir Update llvm-project to a54f4eae0e1d0ef5adccdcf9f6c2b518dc1101aa 2021-10-18 13:36:42 -04:00
refine-types-branch.mlir Move external/torch-mlir to the root of the repo. 2021-09-27 17:11:08 -07:00
refine-types.mlir Add type promotion code to refine types. 2021-10-29 11:17:39 -04:00