[all-commits] [llvm/llvm-project] 408607: Reland "[mlir][linalg] Support parsing attributes ...

Lei Zhang via All-commits all-commits at lists.llvm.org
Tue Jan 12 08:05:20 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4086072f8a9200216088c435c9aa90a2d8ed74a5
      https://github.com/llvm/llvm-project/commit/4086072f8a9200216088c435c9aa90a2d8ed74a5
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
    M mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp

  Log Message:
  -----------
  Reland "[mlir][linalg] Support parsing attributes in named op spec"

With this, now we can specify a list of attributes on named ops
generated from the spec. The format is defined as

```
attr-id ::= bare-id (`?`)?
attr-typedef ::= type (`[` `]`)?
attr-def ::= attr-id `:` attr-typedef

tc-attr-def ::= `attr` `(` attr-def-list `)`
tc-def ::= `def` bare-id
  `(`tensor-def-list`)` `->` `(` tensor-def-list`)`
  (tc-attr-def)?
```

For example,

```
ods_def<SomeCppOp>
def some_op(...) -> (...)
attr(
  f32_attr: f32,
  i32_attr: i32,
  array_attr : f32[],
  optional_attr? : f32
)
```

where `?` means optional attribute and `[]` means array type.

Reviewed By: hanchung, nicolasvasilache

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




More information about the All-commits mailing list