Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir] -sparsification-and-bufferization crashes #120884

Open
wwy6191 opened this issue Dec 22, 2024 · 0 comments
Open

[mlir] -sparsification-and-bufferization crashes #120884

wwy6191 opened this issue Dec 22, 2024 · 0 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir:bufferization Bufferization infrastructure

Comments

@wwy6191
Copy link

wwy6191 commented Dec 22, 2024

git version: bc29fc9

system: Ubuntu 18.04.6 LTS

reproduce with: mlir-opt -sparsification-and-bufferization a.mlir

a.mlir:

#map = affine_map<()[s0,s1,s2] -> ((s0 * s1) * s1)>
module {
  func.func @test_reshape_3d_same_d2d_explicit_empty(%arg0: tensor<3x?x?xf32>) -> tensor<?x?x?xf32> {
    %c2 = arith.constant 2 : index
    %c1 = arith.constant 1 : index
    %c3 = arith.constant 3 : index
    %collapsed = tensor.collapse_shape %arg0 [[0, 1, 2]] : tensor<3x?x?xf32> into tensor<?xf32>
    %dim = tensor.dim %arg0, %c1 : tensor<3x?x?xf32>
    %dim_0 = tensor.dim %collapsed, %c2 : tensor<?xf32>
    %dim_1 = tensor.dim %collapsed, %c3 : tensor<?xf32>
    %0 = affine.apply #map()[%dim, %dim_0, %dim_1]
    %1 = arith.divui %0, %c1 : index
    %expanded = tensor.expand_shape %collapsed [[0, 1, 2]] output_shape [%1, 3, %0] : tensor<?xf32> into tensor<?x3x?xf32>
    %cast = tensor.cast %expanded : tensor<?x3x?xf32> to tensor<?x?x?xf32>
    return %cast : tensor<?x?x?xf32>
  }
}

stack trace:

mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:2315: static void mlir::memref::ExpandShapeOp::build(OpBuilder &, OperationState &, Type, Value, ArrayRef<ReassociationIndices>): Assertion `succeeded(outputShape) && "unable to infer output shape"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -sparsification-and-bufferization /data/szy/MLIR/seed/seed14/tmp.hNYivZemUi.mlir
 #0 0x0000556e46049418 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11ee418)
 #1 0x0000556e46046f2e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11ebf2e)
 #2 0x0000556e46049dad SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f218845a420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f2187a9700b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f2187a76859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f2187a76729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f2187a76729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f2187a87fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x0000556e478b5681 (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x2a5a681)
#10 0x0000556e48590b6b mlir::memref::ExpandShapeOp mlir::OpBuilder::create<mlir::memref::ExpandShapeOp, llvm::ArrayRef<long>, mlir::Value&, llvm::SmallVector<llvm::SmallVector<long, 2u>, 4u>>(mlir::Location, llvm::ArrayRef<long>&&, mlir::Value&, llvm::SmallVector<llvm::SmallVector<long, 2u>, 4u>&&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x3735b6b)
#11 0x0000556e485902ea mlir::bufferization::detail::BufferizableOpInterfaceInterfaceTraits::FallbackModel<mlir::tensor::(anonymous namespace)::ExpandShapeOpInterface>::bufferize(mlir::bufferization::detail::BufferizableOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::RewriterBase&, mlir::bufferization::BufferizationOptions const&) BufferizableOpInterfaceImpl.cpp:0:0
#12 0x0000556e465a1340 mlir::bufferization::bufferizeOp(mlir::Operation*, mlir::bufferization::BufferizationOptions const&, mlir::bufferization::BufferizationStatistics*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1746340)
#13 0x0000556e465dc1e4 mlir::bufferization::bufferizeModuleOp(mlir::ModuleOp, mlir::bufferization::OneShotBufferizationOptions const&, mlir::bufferization::BufferizationStatistics*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x17811e4)
#14 0x0000556e4805e588 mlir::sparse_tensor::SparsificationAndBufferizationPass::runDenseBufferization() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x3203588)
#15 0x0000556e4805e0dc mlir::sparse_tensor::SparsificationAndBufferizationPass::runOnOperation() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x32030dc)
#16 0x0000556e48fa9d66 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x414ed66)
#17 0x0000556e48faa690 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x414f690)
#18 0x0000556e48facc62 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4151c62)
#19 0x0000556e48fa53da performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x0000556e48fa502d llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#21 0x0000556e49050985 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41f5985)
#22 0x0000556e48f9f015 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4144015)
#23 0x0000556e48f9f2bf mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41442bf)
#24 0x0000556e48f9f5ee mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41445ee)
#25 0x0000556e46029f07 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11cef07)
#26 0x00007f2187a78083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#27 0x0000556e46029a7e _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11cea7e)
@github-actions github-actions bot added the mlir label Dec 22, 2024
@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] mlir:bufferization Bufferization infrastructure and removed mlir labels Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir:bufferization Bufferization infrastructure
Projects
None yet
Development

No branches or pull requests

2 participants