[all-commits] [llvm/llvm-project] 06514c: [MLIR][Linalg] Fix linalg crash during elementwise...

Ian Wood via All-commits all-commits at lists.llvm.org
Tue Nov 26 16:00:40 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 06514c550105b3111c23751421265c318bd69ac6
      https://github.com/llvm/llvm-project/commit/06514c550105b3111c23751421265c318bd69ac6
  Author: Ian Wood <ianwood2024 at u.northwestern.edu>
  Date:   2024-11-26 (Tue, 26 Nov 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
    M mlir/include/mlir/IR/AffineMap.h
    M mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
    M mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
    M mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
    M mlir/lib/IR/AffineMap.cpp
    M mlir/test/Dialect/Linalg/fusion-elementwise.mlir

  Log Message:
  -----------
  [MLIR][Linalg] Fix linalg crash during elementwise op fusion (#117667)

`isOpOperandCanBeDroppedAfterFusedLinalgs` crashes when `indexingMaps`
is empty. This can occur when `producer` only has DPS init operands and
`consumer ` only has a single DPS input operand (all operands are
ignored and nothing gets added to `indexingMaps`). This is because
`concatAffineMaps` wasn't handling the maps being empty properly.


Similar to `canOpOperandsBeDroppedImpl`, I added an early return when
the maps are of size zero. Additionally, `concatAffineMaps`'s
declaration comment says it returns an empty map when `maps` is empty
but it has no way to get the `MLIRContext` needed to construct the empty
affine map when the array is empty. So, I changed this to take the
context.


__NOTE: concatAffineMaps now takes an MLIRContext to be able to
construct an empty map in the case where `maps` is empty.__

---------

Signed-off-by: Ian Wood <ianwood2024 at u.northwestern.edu>
Co-authored-by: Quinn Dawkins <quinn.dawkins at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list