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] Sparse Vectorization Pass triggers assertion failure "vectorLength > 0" #59970

Closed
Colloportus0 opened this issue Jan 12, 2023 · 7 comments
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir:sparse Sparse compiler in MLIR

Comments

@Colloportus0
Copy link

MLIR built at commit a0138390
Reproduced with:
mlir-opt --sparse-vectorization temp.mlir

temp.mlir:

  func.func @func()  {
    %c4 = arith.constant 4 : index
    %alloc = memref.alloc(%c4) {alignment = 4096 : i64} : memref<?xf32>
    return 
  }

trace:

Assertion failed: (vectorLength > 0), function populateSparseVectorizationPatterns, file SparseVectorization.cpp, line 671.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: mlir-opt --sparse-vectorization temp.mlir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mlir-opt                 0x0000000104aa85bc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  mlir-opt                 0x0000000104aa7624 llvm::sys::RunSignalHandlers() + 112
2  mlir-opt                 0x0000000104aa8c54 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x00000001867854c4 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000018676dee0 pthread_kill + 288
5  libsystem_c.dylib        0x00000001866a8340 abort + 168
6  libsystem_c.dylib        0x00000001866a7754 err + 0
7  mlir-opt                 0x0000000106233530 mlir::populateSparseVectorizationPatterns(mlir::RewritePatternSet&, unsigned int, bool, bool) (.cold.2) + 0
8  mlir-opt                 0x0000000105455fd0 mlir::populateSparseVectorizationPatterns(mlir::RewritePatternSet&, unsigned int, bool, bool) + 1576
9  mlir-opt                 0x0000000105445600 (anonymous namespace)::SparseVectorizationPass::runOnOperation() + 152
10 mlir-opt                 0x0000000105cb34dc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 420
11 mlir-opt                 0x0000000105cb3a0c mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
12 mlir-opt                 0x0000000105cb5388 mlir::PassManager::run(mlir::Operation*) + 1148
13 mlir-opt                 0x0000000105cae840 performActions(llvm::raw_ostream&, bool, bool, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 504
14 mlir-opt                 0x0000000105cae410 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) + 704
15 mlir-opt                 0x0000000105d1902c mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) + 656
16 mlir-opt                 0x0000000105cac838 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool) + 216
17 mlir-opt                 0x0000000105cacd2c mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 1208
18 mlir-opt                 0x000000010494b0a0 main + 108
19 dyld                     0x0000000109421088 start + 516
@EugeneZelenko EugeneZelenko added mlir:sparse Sparse compiler in MLIR crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jan 12, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 12, 2023

@llvm/issue-subscribers-mlir-sparse

@Colloportus0 Colloportus0 changed the title [mlir] Sparse Vectorization Pass failed with assertion failure "vectorLength > 0" [mlir] Sparse Vectorization Pass triggers assertion failure "vectorLength > 0" Jan 13, 2023
@joker-eph
Copy link
Collaborator

@aartbik : is this part of your area?

@aartbik
Copy link
Contributor

aartbik commented Jan 21, 2023

This seems WAI. The assertion reports that it expects "vectorLength > 0". The proper use of this flag should be -sparse-vectorization="vl=16" (or your preferred vector length). Is there any other way of prompting this back to the user you would prefer?

@joker-eph
Copy link
Collaborator

I think we should sanitize the option in the in the pass and signalPassFailure() and return, before passing it to an API that will assert.

@aartbik
Copy link
Contributor

aartbik commented Jan 21, 2023

sgtm, will make it so

@aartbik
Copy link
Contributor

aartbik commented Jan 21, 2023

After Mehdi's suggestion, pass now cleanly reports failure, no assert crash:

// -----// IR Dump After SparseVectorization Failed (sparse-vectorization) //----- //
....

@joker-eph
Copy link
Collaborator

Nice :) thanks!

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:sparse Sparse compiler in MLIR
Projects
None yet
Development

No branches or pull requests

5 participants