[all-commits] [llvm/llvm-project] f3bf5c: [mlir] Model MemRef memory space as Attribute

Vladislav Vinogradov via All-commits all-commits at lists.llvm.org
Wed Mar 10 02:01:52 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f3bf5c053b06c756f75ff07517d1e54c48cc99c0
      https://github.com/llvm/llvm-project/commit/f3bf5c053b06c756f75ff07517d1e54c48cc99c0
  Author: Vladislav Vinogradov <vlad.vinogradov at intel.com>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M mlir/docs/LangRef.md
    M mlir/include/mlir-c/BuiltinTypes.h
    M mlir/include/mlir/IR/BuiltinTypes.h
    M mlir/include/mlir/IR/BuiltinTypes.td
    M mlir/lib/Bindings/Python/IRModules.cpp
    M mlir/lib/CAPI/IR/BuiltinTypes.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/BuiltinTypes.cpp
    M mlir/lib/IR/TypeDetail.h
    M mlir/lib/Parser/TypeParser.cpp
    M mlir/test/Bindings/Python/ir_types.py
    M mlir/test/CAPI/ir.c
    M mlir/test/IR/invalid.mlir
    M mlir/test/IR/parser.mlir
    M mlir/unittests/IR/ShapedTypeTest.cpp

  Log Message:
  -----------
  [mlir] Model MemRef memory space as Attribute

Based on the following discussion:
https://llvm.discourse.group/t/rfc-memref-memory-shape-as-attribute/2229

The goal of the change is to make memory space property to have more
expressive representation, rather then "magic" integer values.

It will allow to have more clean ASM form:

```
gpu.func @test(%arg0: memref<100xf32, "workgroup">)

// instead of

gpu.func @test(%arg0: memref<100xf32, 3>)
```

Explanation for `Attribute` choice instead of plain `string`:

* `Attribute` classes allow to use more type safe API based on RTTI.
* `Attribute` classes provides faster comparison operator based on
  pointer comparison in contrast to generic string comparison.
* `Attribute` allows to store more complex things, like structs or dictionaries.
  It will allows to have more complex memory space hierarchy.

This commit preserve old integer-based API and implements it on top
of the new one.

Depends on D97476

Reviewed By: rriddle, mehdi_amini

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




More information about the All-commits mailing list