Steve Suzuki
e866fb8606
[mlir][spirv] Add support for fptoui conversion in ArithToSPIRV
...
To enable the conversion of arith.fptoui to SPIRV OpConvertFToU
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D141582
2023-01-12 16:35:50 +00:00
serge-sans-paille
984b800a03
Move from llvm::makeArrayRef to ArrayRef deduction guides - last part
...
This is a follow-up to https://reviews.llvm.org/D140896 , split into
several parts as it touches a lot of files.
Differential Revision: https://reviews.llvm.org/D141298
2023-01-10 11:47:43 +01:00
Ramkumar Ramachandra
0de16fafa5
mlir/DialectConversion: use std::optional (NFC)
...
This is part of an effort to migrate from llvm::Optional to
std::optional. This patch touches DialectConversion, and modifies
existing conversions and tests appropriately.
See also: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Differential Revision: https://reviews.llvm.org/D140303
2022-12-19 18:48:59 +01:00
Jakub Kuderski
4f47677dee
[mlir][arith][spirv] Account for possible type conversion failures
...
Check results of all type conversions in `--convert-arith-to-spirv`.
Fixes: https://github.com/llvm/llvm-project/issues/59496
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D140033
2022-12-14 19:32:40 -05:00
Jakub Kuderski
285d321a85
[mlir][arith] Define mulsi_extended op
...
Extend D139688 with the signed version of the extended multiplication
op. Add conversion to the SPIR-V and LLVM dialects.
This was originally proposed in:
https://discourse.llvm.org/t/rfc-arith-add-extended-multiplication-ops/66869 .
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D139743
2022-12-09 20:25:31 -05:00
Jakub Kuderski
b4bdcea214
[mlir][arith] Define mului_extended op
...
Add conversion to the SPIR-V and LLVM dialects.
This was originally proposed in:
https://discourse.llvm.org/t/rfc-arith-add-extended-multiplication-ops/66869 .
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D139688
2022-12-09 17:37:06 -05:00
Jakub Kuderski
28246b7e75
[mlir][arith] Rename addui_carry to addui_extended
...
The goal is to make the naming of the future `_extended` ops more
consistent. With unsigned addition, the carry value/flag and overflow
bit are the same, but this is not true when it comes to signed addition.
Also rename the second result from `carry` to `overflow`.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D139569
2022-12-07 17:15:56 -05:00
Jakub Kuderski
c50d0fe570
[mlir][arith][spirv] Clean up arith-to-spirv. NFC.
...
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D137978
2022-11-14 20:54:27 -05:00
Jakub Kuderski
afc159bbf1
[mlir][arith][spirv] Handle i1 sign extension in arith-to-spirv
...
Also fix some surrounding nits.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D137974
2022-11-14 15:07:27 -05:00
Jakub Kuderski
c064545403
[mlir][spirv] Do not truncate i/f64 -> i/f32 in SPIRVConversion
...
This truncation can be unexpected and break program behavior.
Dedicated emulation passes should be used instead.
Also rename pass options to "emulate-lt-32-bit-scalar-types".
Fixes: https://github.com/llvm/llvm-project/issues/57917
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D137115
2022-11-04 15:10:28 -04:00
Jakub Kuderski
179978d7b8
[mlir][arith][spirv] Hard fail in -convert-arith-to-spirv
...
Turn legalization failures into hard failures to make sure that we do
not miss conversion pattern application failures.
Add a message on type conversion failure.
Move unsupported cases into a separate test file.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D137102
2022-10-31 17:01:21 -04:00
Thomas Raoux
f8fafe99a4
[mlir] Add unsigned version of index_cast
...
This is required to be able to cast integer type to a potential larger index using zero-extend cast.
There is a larger change under discussion to move index ops in a separate dialect: https://discourse.llvm.org/t/rfc-index-dialect/65540/
Based on timing of this work this patch can be included as part of this effort but as a short term solution we may want to add this op to arithmetic dialect for now in order to fill the gap.
Reviewed By: Mogball, stellaraccident
Differential Revision: https://reviews.llvm.org/D135089
2022-10-03 18:51:15 +00:00
Jakub Kuderski
abc362a107
[mlir][arith] Change dialect name from Arithmetic to Arith
...
Suggested by @lattner in https://discourse.llvm.org/t/rfc-define-precise-arith-semantics/65507/22 .
Tested with:
`ninja check-mlir check-mlir-integration check-mlir-mlir-spirv-cpu-runner check-mlir-mlir-vulkan-runner check-mlir-examples`
and `bazel build --config=generic_clang @llvm-project//mlir:all`.
Reviewed By: lattner, Mogball, rriddle, jpienaar, mehdi_amini
Differential Revision: https://reviews.llvm.org/D134762
2022-09-29 11:23:28 -04:00