[all-commits] [llvm/llvm-project] 5b89c1: [mlir] DenseStringElementsAttr added to default at...

rsuderman via All-commits all-commits at lists.llvm.org
Thu Apr 23 19:05:53 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b89c1dd68966b7fc8d19a0197da4f95eaab066a
      https://github.com/llvm/llvm-project/commit/5b89c1dd68966b7fc8d19a0197da4f95eaab066a
  Author: Rob Suderman <rob.suderman at gmail.com>
  Date:   2020-04-23 (Thu, 23 Apr 2020)

  Changed paths:
    M mlir/include/mlir/IR/Attributes.h
    M mlir/include/mlir/IR/OpBase.td
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/AttributeDetail.h
    M mlir/lib/IR/Attributes.cpp
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/IR/attribute.mlir
    M mlir/test/IR/dense-elements-hex.mlir
    M mlir/test/lib/Dialect/Test/TestOps.td

  Log Message:
  -----------
  [mlir] DenseStringElementsAttr added to default attribute types

Summary:
Implemented a DenseStringsElements attr for handling arrays / tensors of strings. This includes the
necessary logic for parsing and printing the attribute from MLIR's text format.

To store the attribute we perform a single allocation that includes all wrapped string data tightly packed.
This means no padding characters and no null terminators (as they could be present in the string). This
buffer includes a first chunk of data that represents an array of StringRefs, that contain address pointers
into the string data, with the length of each string wrapped. At this point there is no Sparse representation
however strings are not typically represented sparsely.

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




More information about the All-commits mailing list