Commit Graph

54 Commits

Author SHA1 Message Date
Krzysztof Drewniak
636f772871 [mlir][Arith] Make previous load-bearing assert into a real error
When I landed the EmulateUnsupportedFloats, I'd negligently included
an assert that needed to run for the pass to be correct. Previous
emergency fix commits removed the assert. This commit re-adds the
"can't happen" testing as an emitOpError() and aborting the rewrite,
thus allowing it to function in no-assertions builds.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D155088
2023-07-13 14:49:29 +00:00
Sterling Augustine
5f4d96ebef Don't to real work inside an assertion.
asserts get compiled to empty when built in opt mode, so that makes
certain tests fail, such as emulate-unsupported-floats.mlir.test.

This removes the assert altogether, which is also suboptimal, but
I have reported to the original author.
2023-07-11 17:44:58 -07:00
Sterling Augustine
5671f02304 Fix unused variable warning. 2023-07-11 14:54:29 -07:00
Krzysztof Drewniak
10b56e0210 [mlir][Arith] Add pass for emulating unsupported float ops (#1079)
To complement the bf16 expansion and truncation patterns added to
ExpandOps, define a pass that replaces, for any arithmetic operation
op,
%y = arith.op %v0, %v1, ... : T
with
%e0 = arith.expf %v0 : T to U
%e1 = arith.expf %v1 : T to U
...
%y.exp = arith.op %e0, %e1, ... : U
%y = arith.truncf %y.exp : U to T

This allows for "emulating" floating-point operations not supported on
a given target (such as bfloat operations or most arithmetic on 8-bit
floats) by extending those types to supported ones, performing the
arithmetic operation, and then truncating back to the original
type (which ensures appropriate rounding behavior).

The lowering of the extf and truncf ops introduced by this
transformation should be handled by subsequent passes.

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D154539
2023-07-11 20:32:35 +00:00
yzhang93
5a1cdcbd86 [mlir] Narrow bitwidth emulation for MemRef load
This patch adds support for narrow bitwidth storage emulation. The goal is to support sub-byte type
codegen for LLVM CPU. Specifically, a type converter is added to convert memref of narrow bitwidth
(e.g., i4) into supported wider bitwidth (e.g., i8). Another focus of this patch is to populate the
pattern for int4 memref.load. memref.store pattern should be added in a seperate patch.

Reviewed By: hanchung, mravishankar

Differential Revision: https://reviews.llvm.org/D151519
2023-06-26 14:18:30 -07:00
Tres Popp
68f58812e3 [mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This patch updates all remaining uses of the deprecated functionality in
mlir/. This was done with clang-tidy as described below and further
modifications to GPUBase.td and OpenMPOpsInterfaces.td.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```

Differential Revision: https://reviews.llvm.org/D151542
2023-05-26 10:29:55 +02:00
Tres Popp
5550c82189 [mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Caveats include:
- This clang-tidy script probably has more problems.
- This only touches C++ code, so nothing that is being generated.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This first patch was created with the following steps. The intention is
to only do automated changes at first, so I waste less time if it's
reverted, and so the first mass change is more clear as an example to
other teams that will need to follow similar steps.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.
4. Some changes have been deleted for the following reasons:
   - Some files had a variable also named cast
   - Some files had not included a header file that defines the cast
     functions
   - Some files are definitions of the classes that have the casting
     methods, so the code still refers to the method instead of the
     function without adding a prefix or removing the method declaration
     at the same time.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc

git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\
            mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\
            mlir/lib/**/IR/\
            mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\
            mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\
            mlir/test/lib/Dialect/Test/TestTypes.cpp\
            mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\
            mlir/test/lib/Dialect/Test/TestAttributes.cpp\
            mlir/unittests/TableGen/EnumsGenTest.cpp\
            mlir/test/python/lib/PythonTestCAPI.cpp\
            mlir/include/mlir/IR/
```

Differential Revision: https://reviews.llvm.org/D150123
2023-05-12 11:21:25 +02:00
Jakub Kuderski
fc19204918 [mlir][arith] Add narrowing patterns for index casts
These rely on the `ValueBounds` interace and its utility function to
compute constant bounds. This allows us to optimize `linalg.index`
values cast to integer types.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149538
2023-05-03 13:55:02 -04:00
Jakub Kuderski
9701c5abd6 [mlir][arith] Add narrowing patterns for max*i and min*i
Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149583
2023-05-02 10:50:07 -04:00
Jakub Kuderski
46740dd02b [mlir][arith] Add narrowing patterns for subi, divsi, and divui
Each of these ops is compatible with only one extension kind and
produces an extra result bit.

I checked these transformation in Alive2:
1. subi + extsi: https://alive2.llvm.org/ce/z/ipmZZA
2. divsi + extsi: https://alive2.llvm.org/ce/z/fAcqUv
3. divui + extui: https://alive2.llvm.org/ce/z/QZJpFp

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149531
2023-05-02 10:44:29 -04:00
Jakub Kuderski
e2f7563d7c [mlir][arith] Add narrowing patterns for addi and muli
These two ops are handled in a very similar way -- the only difference
in the number result bits produced.

I checked these transformation with Alive2:
1.  addi + sext: https://alive2.llvm.org/ce/z/3NSs9T
2.  addi + zext: https://alive2.llvm.org/ce/z/t7XHOT
3.  muli + sext: https://alive2.llvm.org/ce/z/-7sfW9
4.  muli + zext: https://alive2.llvm.org/ce/z/h4yntF

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149530
2023-05-02 10:10:10 -04:00
Jakub Kuderski
7f3b0e5845 [mlir][arith] Add narrowing patterns to commute more vector ops
This commutes the extension (`arith.extsi`, `arith.extui`) over the
following vector ops: `vector.broadcast`, `vector.shape_cast`,
`vector.transpose`, `vector.flat_transpose`.

I focused on these as I saw them getting created by vector unroll
patterns. Maybe except `vector.flat_transpose`.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149534
2023-05-01 14:32:57 -04:00
Jakub Kuderski
3ff870881f [mlir][arith] Add narrowing patterns for other insertion ops
Allow to commute extension ops over `vector.insertelement` and
`vector.insert_strided_slice`.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149509
2023-05-01 14:29:02 -04:00
Jakub Kuderski
49df068836 [mlir][arith][NFC] Simplify narrowing patterns with a wrapper type
Add a new wraper type that represents either of `ExtSIOp` or `ExtUIOp`.
This is to simplify the code by using a single type, so that we do not
have to use templates or branching to handle both extension kinds.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149485
2023-05-01 13:31:31 -04:00
Jakub Kuderski
33017e5a3f [mlir][arith] Add narrowing pattern to commute extension over insertion
This enabled more optimization opportunities by moving
zero/sign-extension closer to the use.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149282
2023-04-28 16:17:44 -04:00
Jakub Kuderski
09043a26c8 [mlir][arith] Add patterns to commute extension over vector extraction
This moves zero/sign-extension ops closer to their use and exposes more
narrowing optimization opportunities.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149233
2023-04-28 13:48:50 -04:00
Jakub Kuderski
da0730b908 [mlir][arith] Add initial integer bitwidth narrowing pass
This pass reduces the logical complexity of arith ops by choosing
narrowest supported operand bitwidth. On some targets like mobile GPUs,
narrower bitwidths also bring better runtime performance.

The first batch of rewrites handles a simple case of `arith.sitofp`
and `arith.uitofp` with zero/sign-extended inputs. In future revisions,
I plan to extend it with the following:
-  Propagating sign/zero-extensions through bit-pattern-preserving ops,
   e.g., vector transpose, broadcast, insertions/extractions.
-  Handling `linalg.index` using the `ValueBounds` interface.
-  Handling more arith ops.

Reviewed By: springerm, antiagainst

Differential Revision: https://reviews.llvm.org/D149118
2023-04-25 22:33:11 -04:00
Rahul Kayaith
6089d612a5 [mlir] Prevent implicit downcasting to interfaces
Currently conversions to interfaces may happen implicitly (e.g.
`Attribute -> TypedAttr`), failing a runtime assert if the interface
isn't actually implemented. This change marks the `Interface(ValueT)`
constructor as explicit so that a cast is required.

Where it was straightforward to I adjusted code to not require casts,
otherwise I just made them explicit.

Depends on D148491, D148492

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D148493
2023-04-20 16:31:54 -04:00
Robert Suderman
094689fe10 [mlir] Expose Arith::ExpandOps options in constructor
ExpandOpsPass could only be configured via command line flags. Updated
to allowed constructing using the specified Options structure.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D148820
2023-04-20 18:18:52 +00:00
Jakub Kuderski
0c7f3d6c39 [mlir] Allow to specify target type in convertType
Add a new helper function for the type converter that takes care of
casting to the target type.

This is to avoid bugs where an incorrect cast function is used after
type conversion, e.g., `dyn_cast` or `cast`. These are not guaranteed to
work when type conversion fails, or when type conversion succeeds but
the provided type converted returned a type that a conversion pattern
did not expect.

I saw this being an issue in some SPIR-V passes and in mlir-hlo.

Exercise the new function in a couple of passes. As a side-effect, this
also made the code more concise.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D148725
2023-04-19 13:51:13 -04:00
Matthias Springer
2b0552793b [mlir][Arith] Fix Windows build 2023-04-18 17:30:01 +09:00
Matthias Springer
d5b631240a [mlir][Arith] ValueBoundsOpInterface: Reify with Arith ops
This revision adds an additional `reifyValueBounds` helper that reifies the IR with Arith ops instead of Affine ops. This is needed to support value bounds for integer types different from `index` in a subsequent revision.

Differential Revision: https://reviews.llvm.org/D146524
2023-04-18 16:54:56 +09:00
Robert Suderman
8450bbf7f9 [mlir][arith] Add expansion pattern for ext/trunc of bf16
bf16 has a trivial truncation/extension behavior with F32 that
can be described in elementary arith operations. Include some
expansions to efficiently convert including rounding towards
infinity for f32 to bf16 truncation.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D147585
2023-04-06 18:24:02 +00:00
Benjamin Kramer
3bde144de3 Revert "[mlir][arith] Add expansion pattern for ext/trunc of bf16"
This reverts commit 5bff523793. The
bf16->f32 conversion is incorrect. This can't be on by default, if you
want this behavior make it a separate pass.
2023-04-04 15:58:38 +02:00
Robert Suderman
5bff523793 [mlir][arith] Add expansion pattern for ext/trunc of bf16
bf16 has a trivial truncation/extension behavior with F32 that
can be described in elementary arith operations. Include some
expansions to efficiently convert.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D147091
2023-03-30 00:51:06 +00:00
Andrzej Warzynski
cf60d3f1a6 [mlir][arith] Extend the floordivsi converter
This patch extends the `createConst` method so that it can generate
constant vectors (it can already generate scalars). This change is
required to be able to apply the converter for `arith.floordivsi`
(i.e. `FloorDivSIOpConverter`) to vectors.

While `arith.floordivsi` is my main motivation for this change, this
patch should also allow other Arith ops to be converted in vector cases.
In my example, the Linalg vectorizer updates `arith.floordivsi` to
operate on vectors and hence the need for this change.

Differential Revision: https://reviews.llvm.org/D146741
2023-03-24 08:48:55 +00:00
Jakub Kuderski
c81f14e589 [mlir][arith] Fix typos in WIE. NFC. 2023-03-22 19:15:12 -04:00
Jakub Kuderski
abfc358cff [mlir][arith] Add sitofp support to WIE
This depends on the handling of `uitofp` in D146606.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D146597
2023-03-22 19:12:16 -04:00
Jakub Kuderski
909e5ce47a [mlir][arith] Add uitofp support to WIE
This includes standard LIT tests and integration tests with the LLVM CPU
runner.

I plan to use this to implement `sitofp` in D146597.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D146606
2023-03-22 19:04:10 -04:00
Maya Amrami
8bb5ca5832 [mlir] Support bufferization of arith.constant to memref.global with memory space
Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D146381
2023-03-20 17:09:51 +02:00
Matthias Springer
9fa6b3504b [mlir][bufferization] Improve aliasing OpOperand/OpResult property
`getAliasingOpOperands`/`getAliasingOpResults` now encodes OpOperand/OpResult, buffer relation and a degree of certainty. E.g.:
```
// aliasingOpOperands(%r) = {(%t, EQUIV, DEFINITE)}
// aliasingOpResults(%t) = {(%r, EQUIV, DEFINITE)}
%r = tensor.insert %f into %t[%idx] : tensor<?xf32>

// aliasingOpOperands(%r) = {(%t0, EQUIV, MAYBE), (%t1, EQUIV, MAYBE)}
// aliasingOpResults(%t0) = {(%r, EQUIV, MAYBE)}
// aliasingOpResults(%t1) = {(%r, EQUIV, MAYBE)}
%r = arith.select %c, %t0, %t1 : tensor<?xf32>
```

`BufferizableOpInterface::bufferRelation` is removed, as it is now part of `getAliasingOpOperands`/`getAliasingOpResults`.

This change allows for better analysis, in particular wrt. equivalence. This allows additional optimizations and better error checking (which is sometimes overly conservative). Examples:

* EmptyTensorElimination can eliminate `tensor.empty` inside `scf.if` blocks. This requires a modeling of equivalence: It is not a per-OpResult property anymore. Instead, it can be specified for each OpOperand and OpResult. This is important because `tensor.empty` may be eliminated only if all values on the SSA use-def chain to the final consumer (`tensor.insert_slice`) are equivalent.
* The detection of "returning allocs from a block" can be improved. (Addresses a TODO in `assertNoAllocsReturned`.) This allows us to bufferize IR such as "yielding a `tensor.extract_slice` result from an `scf.if` branch", which currently fails to bufferize because the alloc detection is too conservative.
* Better bufferization of loops. Aliases of the iter_arg can be yielded (even if they are not equivalent) without having to realloc and copy the entire buffer on each iteration.

The above-mentioned examples are not yet implemented with this change. This change just improves the BufferizableOpInterface, its implementations and related helper functions, so that better aliasing information is available for each op.

Differential Revision: https://reviews.llvm.org/D142129
2023-02-09 11:35:03 +01:00
Matthias Springer
1ac248e485 [mlir][bufferization][NFC] Rename getAliasingOpOperand/getAliasingOpResult
* `getAliasingOpOperand` => `getAliasingOpOperands`
* `getAliasingOpResult` => `getAliasingOpResults`

Also a few minor code cleanups and better documentation.

Differential Revision: https://reviews.llvm.org/D142979
2023-02-01 10:07:41 +01:00
Matthias Springer
148432ea84 [mlir][bufferization][NFC] Rename BufferRelation::None to BufferRelation::Unknown
The previous name was incorrect. `None` does not mean that there is no buffer relation between two buffers (seems to imply that they do not alias for sure); instead it means that there is no further information available.

Differential Revision: https://reviews.llvm.org/D142870
2023-01-30 11:09:28 +01:00
Mehdi Amini
51911a62e4 Apply clang-tidy fixes for performance-unnecessary-value-param in IntRangeOptimizations.cpp (NFC) 2023-01-14 13:01:30 +00:00
Ivan Butygin
1a867bf1c7 [mlir][arith] Optimize arith.cmpi based on integer range analysis.
Add a pass which do arith dialect ops optimization based on integer range analysis (only cmpi for now).

Differential Revision: https://reviews.llvm.org/D140629
2023-01-11 12:15:58 +01:00
Krzysztof Drewniak
e502f4fc2e [mlir][Arith] Remove expansions of integer min and max ops
As of several months ago, both ArithToLLVM and ArithToSPIRV have
native support for integer min and max operations. Since these are all
the targets available in MLIR core, the need to "expand" arith.minui,
arith.minsi, arith,maxsi, and arith.manxui to more primitive
operations is to longer present.

Therefore, the expanding of integer min and max operations in Arith,
while correct, is likely to lead to performance loss by way of
misoptimization further down the line, and is no longer needed for
anyone's correctness.

This change may break downstream tests, but will not affect the
semantics of MLIR programs.

arith.minf and arith.maxf have a lot of underlying complexity due to
the many different possible NaN and signed zero semantics available on
various platforms, and so removing their expansion is left to a future
commit.

Reviewed By: ThomasRaoux, Mogball

Differential Revision: https://reviews.llvm.org/D140856
2023-01-06 20:32:29 +00: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
3f36d2d579 [mlir][arith] Simplify muli emulation with mului_extended
Using `arith.mului_extended` makes it much simpler to emulate wide
integer multiplication.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D139776
2022-12-12 10:58:07 -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
Jeff Niu
34535801d6 [mlir] UnsignedWhenEquivalent ignore dead code
The pass was not checking for uninitialized states due to dead code.
This patch also makes LLVMFuncOp correctly return a null body when it is
external.

Fixes #58807

Depends on D139388

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D139389
2022-12-05 20:38:44 -08:00
Kazu Hirata
1a36588ec6 [mlir] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-03 18:50:27 -08:00
Lei Zhang
9bb633741a [mlir][bufferization] Support general Attribute as memory space
MemRef has been accepting a general Attribute as memory space for
a long time. This commits updates bufferization side to catch up,
which allows downstream users to plugin customized symbolic memory
space. This also eliminates quite a few `getMemorySpaceAsInt`
calls, which is deprecated.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D138330
2022-11-21 09:40:50 -05:00
Jakub Kuderski
92bcb8ccbb [mlir][arith] Add index_cast and index_castui support to WIE
Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D138225
2022-11-17 14:04:17 -05:00
Jakub Kuderski
0436214b6d [mlir][arith] Add Max*I and Min*I support to WIE
This includes LIT IR tests and runtime tests.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D138184
2022-11-17 13:36:15 -05:00
Jakub Kuderski
64333332db [mlir][arith] Add arith.shrsi support to WIE
This includes LIT tests over the generated ops and runtime tests.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D137965
2022-11-14 20:52:10 -05:00
Jakub Kuderski
7e835ae57c [mlir][arith] Add arith.cmpi support to WIE
This inludes both LIT tests over IR and runtime checks.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D137846
2022-11-11 15:14:02 -05:00
Jakub Kuderski
38b63c900f [mlir][arith] Add select support to WIE
Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D137589
2022-11-08 20:34:51 -05:00
Jakub Kuderski
fae258e6c6 [mlir][memref] Add initial Wide Int Emulation pass and patterns
Add a new pass and conversions to emulate wide integer operations over memrefs.
The emulation is implemented on top of the existing pass to emulate wide integer arith ops.

Improve naming in the arith pass to avoid potential name clashes.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D135722
2022-10-14 11:37:52 -04:00
Jakub Kuderski
a73846ebe9 [mlir][arith] Improve EmulateWideInt diagnostics
Print unsupported types on match failures.

Suggested by @Mogball and @jpienaar in D135204.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D135673
2022-10-11 14:24:54 -04:00
Lei Zhang
d32df0f63d [mlir][arith] Expose dedicated API for expanding ceil/floor division
This allows more precise control over which patterns to pick to
expand arithmetic ops. Previously ceil/floor division epxansion
is only available together with various min/max op expansion.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D135479
2022-10-07 19:51:59 +00:00