[PATCH] D79281: [mlir][DenseElementsAttr] Add support for ComplexType elements

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 19:48:59 PDT 2020


rriddle created this revision.
rriddle added a reviewer: jpienaar.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, mehdi_amini.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79281

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79281.261606.patch
Type: text/x-patch
Size: 25626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200502/f6fd2d52/attachment.bin>


More information about the llvm-commits mailing list