llvm-project/mlir/unittests/Dialect
River Riddle ae40d62541 [mlir] Refactor ElementsAttr's value access API
There are several aspects of the API that either aren't easy to use, or are
deceptively easy to do the wrong thing. The main change of this commit
is to remove all of the `getValue<T>`/`getFlatValue<T>` from ElementsAttr
and instead provide operator[] methods on the ranges returned by
`getValues<T>`. This provides a much more convenient API for the value
ranges. It also removes the easy-to-be-inefficient nature of
getValue/getFlatValue, which under the hood would construct a new range for
the type `T`. Constructing a range is not necessarily cheap in all cases, and
could lead to very poor performance if used within a loop; i.e. if you were to
naively write something like:

```
DenseElementsAttr attr = ...;
for (int i = 0; i < size; ++i) {
  // We are internally rebuilding the APFloat value range on each iteration!!
  APFloat it = attr.getFlatValue<APFloat>(i);
}
```

Differential Revision: https://reviews.llvm.org/D113229
2021-11-09 00:15:08 +00:00
..
Quant [mlir] Refactor ElementsAttr's value access API 2021-11-09 00:15:08 +00:00
SPIRV [mlir][spirv] Use SingleBlock + NoTerminator for spv.module 2021-06-09 14:00:06 -04:00
SparseTensor [mlir][sparse] add support for std unary operations 2021-07-13 14:51:13 -07:00
Utils Reland "[MLIR] Make structured op tests permutation invariant" 2021-02-18 18:09:49 -08:00
BroadcastShapeTest.cpp Mass update the MLIR license header to mention "Part of the LLVM project" 2020-01-26 03:58:30 +00:00
CMakeLists.txt [mlir][sparse] Add Merger unit tests (with gcc5 build fix) 2021-07-12 20:36:10 +00:00