[all-commits] [llvm/llvm-project] a8de41: [mlir] NFC - Expose an OffsetSizeAndStrideOpInterface

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Tue Nov 24 06:47:20 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a8de412f516c6b796aad9c3765962eca4d126a17
      https://github.com/llvm/llvm-project/commit/a8de412f516c6b796aad9c3765962eca4d126a17
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2020-11-24 (Tue, 24 Nov 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/include/mlir/Interfaces/ViewLikeInterface.h
    M mlir/include/mlir/Interfaces/ViewLikeInterface.td
    M mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/lib/Interfaces/ViewLikeInterface.cpp
    M mlir/test/IR/invalid-ops.mlir

  Log Message:
  -----------
  [mlir] NFC - Expose an OffsetSizeAndStrideOpInterface

This revision will make it easier to create new ops base on the strided memref abstraction outside of the std dialect.

OffsetSizeAndStrideOpInterface is an interface for ops that allow specifying mixed dynamic and static offsets, sizes and strides variadic operands.
    Ops that implement this interface need to expose the following methods:
      1. `getArrayAttrRanks` to specify the length of static integer
          attributes.
      2. `offsets`, `sizes` and `strides` variadic operands.
      3. `static_offsets`, resp. `static_sizes` and `static_strides` integer
          array attributes.

    The invariants of this interface are:
      1. `static_offsets`, `static_sizes` and `static_strides` have length
          exactly `getArrayAttrRanks()`[0] (resp. [1], [2]).
      2. `offsets`, `sizes` and `strides` have each length at most
         `getArrayAttrRanks()`[0] (resp. [1], [2]).
      3. if an entry of `static_offsets` (resp. `static_sizes`,
         `static_strides`) is equal to a special sentinel value, namely
         `ShapedType::kDynamicStrideOrOffset` (resp. `ShapedType::kDynamicSize`,
         `ShapedType::kDynamicStrideOrOffset`), then the corresponding entry is
         a dynamic offset (resp. size, stride).
      4. a variadic `offset` (resp. `sizes`, `strides`) operand  must be present
         for each dynamic offset (resp. size, stride).

    This interface is useful to factor out common behavior and provide support
    for carrying or injecting static behavior through the use of the static
    attributes.

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




More information about the All-commits mailing list