diff options
author | Mehdi Amini <joker.eph@gmail.com> | 2022-06-28 11:29:27 +0000 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2022-06-28 13:28:06 +0000 |
commit | 7faf75bb3e3af38fa599bacc888e51929d997b59 (patch) | |
tree | cf9c06b9254aeb424c328ec2386edb6393ed6b04 /llvm/lib/CodeGen/DFAPacketizer.cpp | |
parent | e2f313df8fc3c5bdc60de30ffa7c829191eea4f4 (diff) | |
download | llvm-7faf75bb3e3af38fa599bacc888e51929d997b59.zip llvm-7faf75bb3e3af38fa599bacc888e51929d997b59.tar.gz llvm-7faf75bb3e3af38fa599bacc888e51929d997b59.tar.bz2 |
Introduce a new Dense Array attribute
This attribute is similar to DenseElementsAttr but does not support
splat. As such it has a much simpler API and does not need any smart
iterator: it exposes direct ArrayRef access.
A new syntax is introduced so that the generic printing/parsing looks
like:
[:i64 1, -2, 3]
This attribute beings like an ArrayAttr but has a `:` token after the
opening square brace to introduce the element type (supported are I8,
I16, I32, I64, F32, F64) and the comma separated list for the data.
This is particularly convenient for attributes intended to be small,
like those referring to shapes.
For example a `transpose` operation with a `dims` attribute could be
defined as such:
let arguments = (ins AnyTensor:$input, DenseI64ArrayAttr:$dims);
let assemblyFormat = "$input `dims` `=` $dims attr-dict : type($input)";
And printed this way (the element type is elided in this case):
transpose %input dims = [0, 2, 1] : tensor<2x3x4xf32>
The C++ API for dims would just directly return an ArrayRef<int64>
RFC: https://discourse.llvm.org/t/rfc-introduce-a-new-dense-array-attribute/63279
Recommit with a custom DenseArrayBaseAttrStorage class to ensure
over-alignment of the storage to the largest type.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D123774
Diffstat (limited to 'llvm/lib/CodeGen/DFAPacketizer.cpp')
0 files changed, 0 insertions, 0 deletions