[all-commits] [llvm/llvm-project] 9e3ca7: [mlir][tosa] Canonicalize concatenate->slice sequence

Luke Hutton via All-commits all-commits at lists.llvm.org
Wed Mar 22 10:01:37 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e3ca7987a4dc33cdf847b79a6304b117651d21f
      https://github.com/llvm/llvm-project/commit/9e3ca7987a4dc33cdf847b79a6304b117651d21f
  Author: Luke Hutton <luke.hutton at arm.com>
  Date:   2023-03-22 (Wed, 22 Mar 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
    M mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
    M mlir/test/Dialect/Tosa/canonicalize.mlir

  Log Message:
  -----------
  [mlir][tosa] Canonicalize concatenate->slice sequence

Adds a canonicalizer for the concatenate->slice sequence where
an output of slice can be replaced with an input of concatenate.

This is useful in the context of operations with complex inputs
and outputs that are legalized from a framework such as TFL.
For example, a TFL graph (FFT->FFT) will be legalized to the
following TOSA graph:

     <complex input>
         /     \
     slice    slice
         \     /
           FFT
          /   \     -+
       concatenate   |
         /     \     |  Redundant
     slice    slice  |
         \     /    -+
           FFT
         /     \
       concatenate
            |
     <complex output>

Concatenate and slice operations at the boundaries of the graph are
useful as they maintain the correct correspondance of input/output
tensors to the original TFL graph. However, consecutive
complex operations will result in redundant concatenate->slice
sequences which should be removed from the final TOSA graph.

The canonicalization does not currently handle dynamic types.

Signed-off-by: Luke Hutton <luke.hutton at arm.com>

Reviewed By: rsuderman

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




More information about the All-commits mailing list