[all-commits] [llvm/llvm-project] f5f7e2: [mlir][tosa] Constant optimizations for reduce ope...

Amir Bishara via All-commits all-commits at lists.llvm.org
Thu Sep 21 09:20:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f5f7e2a336ce657c20859295bbf542f71cdf4d3e
      https://github.com/llvm/llvm-project/commit/f5f7e2a336ce657c20859295bbf542f71cdf4d3e
  Author: Amir Bishara <amir.bishara at mobileye.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
    M mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h
    M mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
    M mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
    M mlir/test/Dialect/Tosa/constant-op-fold.mlir

  Log Message:
  -----------
  [mlir][tosa] Constant optimizations for reduce operations

Replace the different reduce operations which is getting
a constant tensor as an input argument with a constant
tensor.

As the arguement of the reduce operation is constant tensor
and has only a single user we could calculate the resulted
constant tensor in compilation time and replace it
with reduced memory tensor

This optimization has been implemented for:
tosa.reduce_sum
tosa.reduce_prod
tosa.reduce_any
tosa.reduce_all
tosa.reduce_max
tosa.reduce_min

Reviewed By: rsuderman

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




More information about the All-commits mailing list