[all-commits] [llvm/llvm-project] 36150c: [mlir] Affine symbols: do not expect AffineScope t...

ftynse via All-commits all-commits at lists.llvm.org
Mon Jun 15 08:56:10 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 36150c3637309dabe0e287727c81717dfbe9bc84
      https://github.com/llvm/llvm-project/commit/36150c3637309dabe0e287727c81717dfbe9bc84
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-06-15 (Mon, 15 Jun 2020)

  Changed paths:
    M mlir/docs/Dialects/Affine.md
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp

  Log Message:
  -----------
  [mlir] Affine symbols: do not expect AffineScope to always exist

In the affine symbol and dimension check, the code currently assumes
`getAffineScope` and its users `isValidDim` and `isValidSymbol` are only called
on values defined in regions that have a parent Op with `AffineScope` trait.
This is not necessarily the case, and these functions may be called on valid IR
that does not satisfy this assumption. Return `nullptr` from `getAffineScope`
if there is no parent op with `AffineScope` trait. Treat this case
conservatively in `isValidSymbol` by only accepting as symbols the values that
are guaranteed to be symbols (constants, and certain operations). No
modifications are necessary to `isValidDim` that delegates most of the work to
`isValidDim`.

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


  Commit: 3f5bd53eb1044b166fd9d2771ca7135d1b29ee6f
      https://github.com/llvm/llvm-project/commit/3f5bd53eb1044b166fd9d2771ca7135d1b29ee6f
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-06-15 (Mon, 15 Jun 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Affine/EDSC/Builders.h
    M mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
    M mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
    M mlir/lib/Dialect/Affine/EDSC/Builders.cpp
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/test/EDSC/builder-api-test.cpp

  Log Message:
  -----------
  [mlir] Introduce callback-based builders for AffineForOp

Similarly to `scf::ForOp`, introduce additional `function_ref` arguments to
`AffineForOp::build` that can be used to populate the body of the loop during
its construction. Provide compatibility functions for constructing affine loop
nests using `edsc::ScopedContext`.

`edsc::AffineLoopNestBuilder` and reletad functionality is now deprecated and
will be removed soon, users are expected to switch to `affineLoopNestBuilder`
that provides similar functionality with a simpler OpBuilder-based
implementation.

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


Compare: https://github.com/llvm/llvm-project/compare/3813f24e971b...3f5bd53eb104


More information about the All-commits mailing list