[all-commits] [llvm/llvm-project] 728a8d: [mlir] Add a builtin distinct attribute

Tobias Gysi via All-commits all-commits at lists.llvm.org
Tue Jul 11 00:34:56 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 728a8d5a81f35f24492fcd31928ef95e597a66af
      https://github.com/llvm/llvm-project/commit/728a8d5a81f35f24492fcd31928ef95e597a66af
  Author: Tobias Gysi <tobias.gysi at nextsilicon.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M mlir/docs/Dialects/Builtin.md
    M mlir/include/mlir/IR/AttributeSupport.h
    M mlir/include/mlir/IR/BuiltinAttributes.h
    M mlir/include/mlir/IR/BuiltinDialectBytecode.td
    M mlir/lib/AsmParser/AttributeParser.cpp
    M mlir/lib/AsmParser/Parser.h
    M mlir/lib/AsmParser/ParserState.h
    M mlir/lib/AsmParser/TokenKinds.def
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/AttributeDetail.h
    M mlir/lib/IR/BuiltinAttributes.cpp
    M mlir/lib/IR/BuiltinDialect.cpp
    M mlir/lib/IR/BuiltinDialectBytecode.cpp
    M mlir/lib/IR/MLIRContext.cpp
    M mlir/test/Dialect/Builtin/Bytecode/attrs.mlir
    A mlir/test/IR/distinct-attr.mlir
    M mlir/test/IR/invalid-builtin-attributes.mlir
    A mlir/test/IR/test-builtin-distinct-attrs.mlir
    M mlir/test/IR/test-symbol-rauw.mlir
    M mlir/test/IR/test-symbol-uses.mlir
    M mlir/test/lib/IR/CMakeLists.txt
    A mlir/test/lib/IR/TestBuiltinDistinctAttributes.cpp
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  [mlir] Add a builtin distinct attribute

A distinct attribute associates a referenced attribute with a unique
identifier. Every call to its create function allocates a new
distinct attribute instance. The address of the attribute instance
temporarily serves as its unique identifier. Similar to the names
of SSA values, the final unique identifiers are generated during
pretty printing.

Examples:
 #distinct = distinct[0]<42.0 : f32>
 #distinct1 = distinct[1]<42.0 : f32>
 #distinct2 = distinct[2]<array<i32: 10, 42>>

This mechanism is meant to generate attributes with a unique
identifier, which can be used to mark groups of operations
that share a common properties such as if they are aliasing.

The design of the distinct attribute ensures minimal memory
footprint per distinct attribute since it only contains a reference
to another attribute. All distinct attributes are stored outside of
the storage uniquer in a thread local store that is part of the
context. It uses one bump pointer allocator per thread to ensure
distinct attributes can be created in-parallel.

Reviewed By: rriddle, Dinistro, zero9178

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




More information about the All-commits mailing list