[all-commits] [llvm/llvm-project] b4c8c4: Fix handling of rank-1 tensors in tosa.reduce_sum

Ramiro Leal-Cavazos via All-commits all-commits at lists.llvm.org
Thu Oct 13 09:02:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b4c8c4952a4da88706f275708430be2a25de7658
      https://github.com/llvm/llvm-project/commit/b4c8c4952a4da88706f275708430be2a25de7658
  Author: Ramiro Leal-Cavazos <ramiroleal050 at gmail.com>
  Date:   2022-10-13 (Thu, 13 Oct 2022)

  Changed paths:
    M mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
    M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir

  Log Message:
  -----------
  Fix handling of rank-1 tensors in tosa.reduce_sum

The conversion of `tosa.reduce_sum` to linalg creates a
`linalg.generic` op that produces a tensor of rank `input_rank -
1`. This tensor is then expanded back into a tensor of rank
`input_rank`. In the case where the tensor being expanded is rank-0,
the reassociation map used must be empty. However, the current
implementation indexes and modifies the reassociation map independent
of the rank of the tensor being expanded, resulting in out-of-bounds
indexing when the tensor being expanded is rank-0. This commit adds a
guard to the reassociation map indexing.

Reviewed By: jpienaar

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




More information about the All-commits mailing list