[all-commits] [llvm/llvm-project] 7d6ef5: [mlir][tensor] Fold `tensor.cast` into `tensor.col...

Gaurav Shukla via All-commits all-commits at lists.llvm.org
Thu Jul 28 00:41:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d6ef5caef80a24d170dee0f1fec54f3bc7fd979
      https://github.com/llvm/llvm-project/commit/7d6ef5caef80a24d170dee0f1fec54f3bc7fd979
  Author: Gaurav Shukla <gaurav at nod-labs.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
    M mlir/test/Dialect/Tensor/canonicalize.mlir

  Log Message:
  -----------
  [mlir][tensor] Fold `tensor.cast` into `tensor.collapse_shape` op

This commit folds a `tensor.cast` op into a `tensor.collapse_shape` op
when following two conditions meet:
1. the `tensor.collapse_shape` op consumes result of the `tensor.cast` op.
2. `tensor.cast` op casts to a more dynamic version of the source tensor.
This is added as a canonicalization pattern in `tensor.collapse_shape` op.

Signed-Off-By: Gaurav Shukla <gaurav at nod-labs.com>

Reviewed By: mravishankar

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




More information about the All-commits mailing list