[all-commits] [llvm/llvm-project] da2a6f: [mlir][DenseElementsAttr] Add support for ComplexT...

River Riddle via All-commits all-commits at lists.llvm.org
Tue May 5 12:46:53 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: da2a6f4e3b5235d871c2e81ae1b0577002733653
      https://github.com/llvm/llvm-project/commit/da2a6f4e3b5235d871c2e81ae1b0577002733653
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-05-05 (Tue, 05 May 2020)

  Changed paths:
    M mlir/include/mlir/IR/Attributes.h
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/AttributeDetail.h
    M mlir/lib/IR/Attributes.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/IR/dense-elements-hex.mlir
    M mlir/unittests/IR/AttributeTest.cpp

  Log Message:
  -----------
  [mlir][DenseElementsAttr] Add support for ComplexType elements

This revision adds support for storing ComplexType elements inside of a DenseElementsAttr. We store complex objects as an array of two elements, matching the  definition of std::complex. There is no current attribute storage for ComplexType, but DenseElementsAttr provides API for access/creation using std::complex<>. Given that the internal implementation of DenseElementsAttr is already fairly opaque, the only real complexity here is in the printing/parsing. This revision keeps it simple for now and always uses hex when printing complex elements. A followup will add prettier syntax for this.

Differential Revision: https://reviews.llvm.org/D79281


  Commit: 24ad3858842552a8052c12c44c7707dd822898bf
      https://github.com/llvm/llvm-project/commit/24ad3858842552a8052c12c44c7707dd822898bf
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-05-05 (Tue, 05 May 2020)

  Changed paths:
    M mlir/include/mlir/IR/Attributes.h
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/AttributeDetail.h
    M mlir/lib/IR/Attributes.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/IR/dense-elements-hex.mlir
    M mlir/test/IR/invalid.mlir
    M mlir/test/IR/parser.mlir
    M mlir/unittests/IR/AttributeTest.cpp

  Log Message:
  -----------
  [mlir][DenseElementsAttr] Add support for opaque APFloat/APInt complex values.

This revision allows for creating DenseElementsAttrs and accessing elements using std::complex<APInt>/std::complex<APFloat>. This allows for opaquely accessing and transforming complex values. This is used by the printer/parser to provide pretty printing for complex values. The form for complex values matches that of std::complex, i.e.:

```
// `(` element `,` element `)`
dense<(10,10)> : tensor<complex<i64>>
```

Differential Revision: https://reviews.llvm.org/D79296


  Commit: 4e9a7c8f5c527e7493394ab7869f38ca7c6b8903
      https://github.com/llvm/llvm-project/commit/4e9a7c8f5c527e7493394ab7869f38ca7c6b8903
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-05-05 (Tue, 05 May 2020)

  Changed paths:
    M mlir/lib/IR/Attributes.cpp

  Log Message:
  -----------
  [mlir][DenseStringElementsAttr] Fix AttributeElementIterator in the case of a splat.


Compare: https://github.com/llvm/llvm-project/compare/c296d2dc53d5...4e9a7c8f5c52


More information about the All-commits mailing list