Skip to content

[MLIR]Crashed with '<unknown> error' on -affine-super-vectorize pass #61309

@BealZephyr

Description

@BealZephyr

Test on commit: 22c0ce9
The same crash occurred in llvm16

steps to reproduce:

mlir-opt test.mlir -affine-super-vectorize="virtual-vector-size=4,8"

test case:

func.func @main(%a : memref<10x20xf32>, %b : memref<10x20xf32>,
                  %c : memref<10x20xf32>) {
  affine.for %j = 0 to 10 {
    affine.for %i = 0 to 5 {
      %ld0 = affine.vector_load %a[%j, %i*4] : memref<10x20xf32>, vector<4xf32>
      affine.vector_store %ld0, %b[%j, %i*4] : memref<10x20xf32>, vector<4xf32>
    }
  }
  return
}

crash trace:

<unknown>:0: error: vector elements must be int/index/float type but got 'vector<4xf32>'
mlir-opt: /home/verify/llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/mlir/include/mlir/IR/StorageUniquerSupport.h:174: static ConcreteT mlir::detail::StorageUserBase<ConcreteT, BaseT, StorageT, UniquerT, Traits>::get(mlir::MLIRContext*, Args ...) [with Args = {llvm::ArrayRef<long int>, mlir::Type, unsigned int}; ConcreteT = mlir::VectorType; BaseT = mlir::Type; StorageT = mlir::detail::VectorTypeStorage; UniquerT = mlir::detail::TypeUniquer; Traits = {mlir::ShapedType::Trait}]: Assertion `succeeded(ConcreteT::verify(getDefaultDiagnosticEmitFn(ctx), args...))' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt test.mlir -affine-super-vectorize=virtual-vector-size=4,8
 #0 0x00005569433c4aaa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x221aaa)
 #1 0x00005569433c1fac SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f828c82c980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #3 0x00007f828b924e87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #4 0x00007f828b9267f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
 #5 0x00007f828b9163fa __assert_fail_base /build/glibc-CVJwZb/glibc-2.27/assert/assert.c:89:0
 #6 0x00007f828b916472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
 #7 0x0000556944dab9cd mlir::VectorType mlir::detail::StorageUserBase<mlir::VectorType, mlir::Type, mlir::detail::VectorTypeStorage, mlir::detail::TypeUniquer, mlir::ShapedType::Trait>::get<llvm::ArrayRef<long>, mlir::Type, unsigned int>(mlir::MLIRContext*, llvm::ArrayRef<long>, mlir::Type, unsigned int) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1c089cd)
 #8 0x0000556944daba16 mlir::VectorType::get(llvm::ArrayRef<long>, mlir::Type, unsigned int) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1c08a16)
 #9 0x00005569434a6b91 widenOp(mlir::Operation*, (anonymous namespace)::VectorizationState&) SuperVectorize.cpp:0:0
#10 0x00005569434a76e8 mlir::WalkResult llvm::function_ref<mlir::WalkResult (mlir::Operation*)>::callback_fn<vectorizeLoopNest(std::vector<llvm::SmallVector<mlir::AffineForOp, 2u>, std::allocator<llvm::SmallVector<mlir::AffineForOp, 2u>>>&, mlir::VectorizationStrategy const&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) SuperVectorize.cpp:0:0
#11 0x000055694349fc0b mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x2fcc0b)
#12 0x000055694349fcac mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x2fccac)
#13 0x000055694349fcac mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x2fccac)
#14 0x00005569434a13a3 vectorizeLoopNest(std::vector<llvm::SmallVector<mlir::AffineForOp, 2u>, std::allocator<llvm::SmallVector<mlir::AffineForOp, 2u>>>&, mlir::VectorizationStrategy const&) SuperVectorize.cpp:0:0
#15 0x00005569434a8adf vectorizeLoops(mlir::Operation*, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>&, llvm::ArrayRef<long>, llvm::ArrayRef<long>, llvm::DenseMap<mlir::Operation*, llvm::SmallVector<mlir::LoopReduction, 2u>, llvm::DenseMapInfo<mlir::Operation*, void>, llvm::detail::DenseMapPair<mlir::Operation*, llvm::SmallVector<mlir::LoopReduction, 2u>>> const&) SuperVectorize.cpp:0:0
#16 0x00005569434a9a29 (anonymous namespace)::Vectorize::runOnOperation() SuperVectorize.cpp:0:0
#17 0x0000556944c6ee59 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1acbe59)
#18 0x0000556944c6f17a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1acc17a)
#19 0x0000556944c6f4f8 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#20 0x0000556944c6e635 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1acb635)
#21 0x0000556944c6edca mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1acbdca)
#22 0x0000556944c6fcb3 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (.constprop.495) Pass.cpp:0:0
#23 0x0000556944c7039d mlir::PassManager::run(mlir::Operation*) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1acd39d)
#24 0x0000556944c633a3 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x0000556944c63ad9 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#26 0x0000556944c63e01 mlir::LogicalResult llvm::function_ref<mlir::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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#27 0x0000556944d289b0 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1b859b0)
#28 0x0000556944c60ae3 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1abdae3)
#29 0x0000556944c641e8 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1ac11e8)
#30 0x0000556943390ec0 main (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x1edec0)
#31 0x00007f828b907c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#32 0x00005569433a3b5a _start (llvm-project-22c0ce96912f55f48ba4535800bacc0c48fe9832/build/bin/mlir-opt+0x200b5a)
Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]mlir:affine

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions