[all-commits] [llvm/llvm-project] 56593f: [MLIR] Simplify semi-affine expressions

yashjain1129 via All-commits all-commits at lists.llvm.org
Tue Aug 4 09:41:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 56593fa370124a4d77703e7ddfa4dfca81e0c8f2
      https://github.com/llvm/llvm-project/commit/56593fa370124a4d77703e7ddfa4dfca81e0c8f2
  Author: Yash Jain <yash.jain at polymagelabs.com>
  Date:   2020-08-04 (Tue, 04 Aug 2020)

  Changed paths:
    M mlir/lib/IR/AffineExpr.cpp
    M mlir/test/Dialect/Affine/simplify-affine-structures.mlir

  Log Message:
  -----------
  [MLIR] Simplify semi-affine expressions

Simplify semi-affine expression for the operations like ceildiv,
floordiv and modulo by any given symbol by checking divisibilty by that
symbol.

Some properties used in simplification are:

1) Commutative property of the floordiv and ceildiv:
((expr1 floordiv expr2) floordiv expr3 ) = ((expr1 floordiv expr3) floordiv expr2)
((expr1 ceildiv expr2) ceildiv expr3 ) = ((expr1 ceildiv expr3) ceildiv expr2)

While simplification if operations are different no simplification is
possible as there is no property that simplify expressions like these:
((expr1 ceildiv expr2) floordiv expr3) or  ((expr1 floordiv expr2)
ceildiv expr3).

2) If both expr1 and expr2 are divisible by the expr3 then:
(expr1 % expr2) / expr3 = ((expr1 / expr3) % (expr2 / expr3))
where / is divide symbol.

3) If expr1 is divisible by expr2 then expr1 % expr2 = 0.

Signed-off-by: Yash Jain <yash.jain at polymagelabs.com>

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




More information about the All-commits mailing list