Skip to content

[mlir] [vector] -convert-vector-to-gpu crashes #107967

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

Closed
axeabc opened this issue Sep 10, 2024 · 2 comments · Fixed by #113454
Closed

[mlir] [vector] -convert-vector-to-gpu crashes #107967

axeabc opened this issue Sep 10, 2024 · 2 comments · Fixed by #113454
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@axeabc
Copy link

axeabc commented Sep 10, 2024

git version: 761bf33

system: Ubuntu 18.04.6 LTS

reproduce with: mlir-opt -convert-vector-to-gpu a.mlir

a.mlir:

#map = affine_map<(d0, d1, d2) -> (d0, d2)>
#map1 = affine_map<(d0, d1, d2) -> (d2, d1)>
#map2 = affine_map<(d0, d1, d2) -> (d0, d1)>
module {
  func.func @matmul_mk_kn_mn_4x4xi32_extui_i64(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector <4x4xi64>) -> vector<4x4xi64 > {
    %0 = arith.extui %arg0 : vector<4x4xi32> to vector<4x4xi64>
    %1 = arith.extui %arg1 : vector<4x4xi32> to vector<4x4xi64>
    %2 = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %0, %1, %arg2 : vector<4x4xi64>, vector<4x4xi64> into vector<4x4xi64>
    return %2 : vector<4x4xi64>
  }
}

stack trace:

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 -convert-vector-to-gpu a.mlir
 #0 0x000055fabd724128 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d7128)
 #1 0x000055fabd721c3e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d4c3e)
 #2 0x000055fabd724abd SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f9c83b13420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x000055fac024dbb8 bool integerExtendSupportsMMAMatrixType<mlir::arith::ExtUIOp>(mlir::arith::ExtUIOp) VectorToGPU.cpp:0:0
 #5 0x000055fac024cedb bool __gnu_cxx::__ops::_Iter_pred<getOpToConvert(mlir::Operation*, bool)::$_2::operator()(mlir::vector::ContractionOp) const::'lambda'(mlir::Operation*)>::operator()<mlir::Operation* const*>(mlir::Operation* const*) VectorToGPU.cpp:0:0
 #6 0x000055fac024c47c void llvm::function_ref<void (mlir::Operation*)>::callback_fn<std::enable_if<!llvm::is_one_of<mlir::vector::ContractionOp, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<void, void>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, getOpToConvert(mlir::Operation*, bool)::$_2, mlir::vector::ContractionOp, void>(mlir::Operation*, getOpToConvert(mlir::Operation*, bool)::$_2&&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) VectorToGPU.cpp:0:0
 #7 0x000055fabd82824e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11db24e)
 #8 0x000055fabd82824e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11db24e)
 #9 0x000055fac024591c getOpToConvert(mlir::Operation*, bool) VectorToGPU.cpp:0:0
#10 0x000055fac0243545 mlir::convertVectorToMMAOps(mlir::RewriterBase&, mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x3bf6545)
#11 0x000055fac0252d39 (anonymous namespace)::ConvertVectorToGPUPass::runOnOperation() VectorToGPU.cpp:0:0
#12 0x000055fac08162d6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c92d6)
#13 0x000055fac0816c40 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+0x41c9c40)
#14 0x000055fac0819282 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41cc282)
#15 0x000055fac0811ab1 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#16 0x000055fac081170b 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
#17 0x000055fac08be3a5 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+0x42713a5)
#18 0x000055fac080cb35 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+0x41bfb35)
#19 0x000055fac080cddf mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41bfddf)
#20 0x000055fac080d10e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c010e)
#21 0x000055fabd704d67 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b7d67)
#22 0x00007f9c83131083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#23 0x000055fabd7048ee _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b78ee)
@github-actions github-actions bot added the mlir label Sep 10, 2024
@EugeneZelenko EugeneZelenko added the crash Prefer [crash-on-valid] or [crash-on-invalid] label Sep 10, 2024
@CoTinker
Copy link
Contributor

The #map of vector.contract is missed, so I can't reproduce it.

@axeabc
Copy link
Author

axeabc commented Sep 11, 2024

The #map of vector.contract is missed, so I can't reproduce it.

Sorry for that, I have updated the test case.

@CoTinker CoTinker self-assigned this Oct 21, 2024
CoTinker added a commit that referenced this issue Oct 24, 2024
This PR fixes a crash in `VectorToGPU` when the operand of `extOp` is a
function argument, which cannot be retrieved using `getDefiningOp`.
Fixes #107967.
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this issue Nov 4, 2024
This PR fixes a crash in `VectorToGPU` when the operand of `extOp` is a
function argument, which cannot be retrieved using `getDefiningOp`.
Fixes llvm#107967.
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants