llvm-project/mlir/tools/mlir-linalg-ods-gen
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
..
CMakeLists.txt [mlir] Remove old "tc" linalg ods generator. 2021-09-30 16:30:06 +00:00
mlir-linalg-ods-yaml-gen.cpp [mlir] Refactor ElementsAttr's value access API 2021-11-09 00:15:08 +00:00
update_core_linalg_named_ops.sh.in [mlir][linalg] Add script to update the LinalgNamedStructuredOps.yaml. nfc 2021-08-22 16:54:51 -07:00