Skip to content

Crash in iree-flow-fusion-of-tensor-ops #10194

Closed

Description

@hanhanW

I hit a crash in a compilation after integrates. I think there are some bugs related to multiple outputs in the pass.

To repro:

#map0 = affine_map<(d0, d1) -> (d1)>
#map1 = affine_map<(d0, d1) -> (d0, d1)>
module {
  func.func @foo(%arg0: tensor<512xf32>, %arg1: tensor<512xf32>, %arg2: tensor<512xf32>, %arg3: tensor<200x512xf32>) -> tensor<25x8x1x512xf32> {
    %0:2 = linalg.generic {
      indexing_maps = [#map0, #map0, #map0, #map1],
      iterator_types = ["parallel", "parallel"]
    }
      ins(%arg0, %arg1 : tensor<512xf32>, tensor<512xf32>)
      outs(%arg2, %arg3 : tensor<512xf32>, tensor<200x512xf32>) {
    ^bb0(%arg4: f32, %arg5: f32, %arg6: f32, %arg7: f32):
      %2 = arith.addf %arg4, %arg5 : f32
      linalg.yield %2, %2 : f32, f32
    } -> (tensor<512xf32>, tensor<200x512xf32>)
    %1 = tensor.expand_shape %0#1 [[0, 1, 2], [3]] : tensor<200x512xf32> into tensor<25x8x1x512xf32>
    return %1 : tensor<25x8x1x512xf32>
  }
}

Run: iree-opt --iree-flow-fusion-of-tensor-ops repro.mlir

log:

iree/third_party/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1162: ReferenceT llvm::detail::indexed_accessor_range_base<mlir:
:TypeRange, llvm::PointerUnion<const mlir::Value *, const mlir::Type *, mlir::OpOperand *, mlir::detail::OpResultImpl *>, mlir::Type, mlir::Type, mlir::Type>::operator[](size_t) const [D
erivedT = mlir::TypeRange, BaseT = llvm::PointerUnion<const mlir::Value *, const mlir::Type *, mlir::OpOperand *, mlir::detail::OpResultImpl *>, T = mlir::Type, PointerT = mlir::Type, Re
ferenceT = mlir::Type]: Assertion `Index < size() && "invalid index for value range"' failed.
...
third_party/llvm-project/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp:797

It's crash at here which triggers an out-of-bound access.

@MaheshRavishankar it seems like there is a bug in https://reviews.llvm.org/D132301

Activity

  1. added
    codegen
    on Aug 24, 2022
  2. added
    bug 🐞
    on Aug 24, 2022
  3. MaheshRavishankar commented on Aug 24, 2022

    @MaheshRavishankar
    Collaborator

    Oh, will look into it soon. Thanks for reporting!

  4. allieculp commented on Aug 24, 2022

    @allieculp

    Marking as P1, please downgrade if needed!

  5. moved this to Done in IREEon Aug 25, 2022
  6. MaheshRavishankar commented on Aug 25, 2022

    @MaheshRavishankar
    Collaborator

    Will close it after cherry-picking it into IREE.

  7. added a commit that references this issue on Aug 25, 2022
    8863f9e
  8. added a commit that references this issue on Aug 30, 2022
    3c8337e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug 🐞codegen

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions