kumasento / polymer

Bridging polyhedral analysis tools to the MLIR framework
MIT License
99 stars 21 forks source link

Unexpected dependence type Error when running the example #124

Open runzhech opened 2 years ago

runzhech commented 2 years ago

I meet this error when I tried to optimize the matmul example.

Dep type: 4
polymer-opt: osl_pluto.c:1562: deps_read: Assertion `0 && "unexpected dependence type"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./polymer-opt -reg2mem -extract-scop-stmt -pluto-opt ./test/matmul.mlir
 #0 0x0000000000c2393f PrintStackTraceSignalHandler(void*) (./polymer-opt+0xc2393f)
 #1 0x0000000000c210ed SignalHandler(int) (./polymer-opt+0xc210ed)
 #2 0x00007f139d0f5980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #3 0x00007f139a7a8fb7 raise /build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #4 0x00007f139a7aa921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
 #5 0x00007f139a79a48a __assert_fail_base /build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
 #6 0x00007f139a79a502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
 #7 0x00007f139c03b460 deps_read (/home/test/polymer/build/pluto/lib/libpluto.so.2+0x49460)
 #8 0x00007f139c03bb34 osl_scop_to_pluto_prog (/home/test/polymer/build/pluto/lib/libpluto.so.2+0x49b34)
 #9 0x00000000006f0c2d plutoTransform(mlir::FuncOp, mlir::OpBuilder&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, bool, int, int, bool) /home/test/polymer/build/../lib/Transforms/PlutoTransform.cc:107:14
#10 0x00000000006f04a7 (anonymous namespace)::PlutoTransformPass::runOnOperation() /home/test/polymer/build/../lib/Transforms/PlutoTransform.cc:170:15
#11 0x000000000057e881 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (.localalias.19) (./polymer-opt+0x57e881)
#12 0x000000000057fe61 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (.localalias.12) (./polymer-opt+0x57fe61)
#13 0x0000000000580955 mlir::PassManager::run(mlir::Operation*) (./polymer-opt+0x580955)
#14 0x000000000053bcdb performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, mlir::PassPipelineCLParser const&) (.constprop.156) (./polymer-opt+0x53bcdb)
#15 0x000000000053c365 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, llvm::ThreadPool&) (./polymer-opt+0x53c365)
#16 0x000000000053c71c mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool) (.localalias.0) (./polymer-opt+0x53c71c)
#17 0x000000000053e2fb mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (./polymer-opt+0x53e2fb)
#18 0x000000000041d6a4 main /home/test/polymer/build/../tools/polymer-opt/polymer-opt.cc:76:17
#19 0x00007f139a78bbf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x000000000041d4ea _start (./polymer-opt+0x41d4ea)
Aborted (core dumped)

Thanks for any help.

runzhech commented 2 years ago

what's more, when I tried the -heuristic-split, it also failed.

polymer-opt: ../lib/Transforms/ScopStmtOpt.cc:304: void scopStmtSplit(mlir::ModuleOp, mlir::OpBuilder &, int): Assertion `(call = findCallOpForFunc(m, func)) && "The call op for the target function should be found."' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./polymer-opt -heuristic-split ./test/matmul.mlir
 #0 0x0000000000c2393f PrintStackTraceSignalHandler(void*) (./polymer-opt+0xc2393f)
 #1 0x0000000000c210ed SignalHandler(int) (./polymer-opt+0xc210ed)
 #2 0x00007f074fec9980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #3 0x00007f074d57cfb7 raise /build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #4 0x00007f074d57e921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
 #5 0x00007f074d56e48a __assert_fail_base /build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
 #6 0x00007f074d56e502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
 #7 0x000000000073a403 scopStmtSplit(mlir::ModuleOp, mlir::OpBuilder&, int) /home/test/polymer/build/../lib/Transforms/ScopStmtOpt.cc:306:17
 #8 0x000000000073a014 (anonymous namespace)::ScopStmtSplitPass::runOnOperation() /home/test/polymer/build/../lib/Transforms/ScopStmtOpt.cc:334:18
 #9 0x000000000057e881 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (.localalias.19) (./polymer-opt+0x57e881)
#10 0x000000000057fe61 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (.localalias.12) (./polymer-opt+0x57fe61)
#11 0x0000000000580955 mlir::PassManager::run(mlir::Operation*) (./polymer-opt+0x580955)
#12 0x000000000053bcdb performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, mlir::PassPipelineCLParser const&) (.constprop.156) (./polymer-opt+0x53bcdb)
#13 0x000000000053c365 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, llvm::ThreadPool&) (./polymer-opt+0x53c365)
#14 0x000000000053c71c mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool) (.localalias.0) (./polymer-opt+0x53c71c)
#15 0x000000000053e2fb mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (./polymer-opt+0x53e2fb)
#16 0x000000000041d6a4 main /home/test/polymer/build/../tools/polymer-opt/polymer-opt.cc:76:17
#17 0x00007f074d55fbf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#18 0x000000000041d4ea _start (./polymer-opt+0x41d4ea)
Aborted (core dumped)
kumasento commented 2 years ago

Thanks for reporting this!

-heuristic-split is not an essential step and could not work if the input file cannot be successfully processed by the main workflow (reg2mem, extract, and pluto-opt).

If possible, could you please post here your input file? I will check it out later.

runzhech commented 2 years ago

Thanks for reporting this!

-heuristic-split is not an essential step and could not work if the input file cannot be successfully processed by the main workflow (reg2mem, extract, and pluto-opt).

If possible, could you please post here your input file? I will check it out later.

Thanks for your response. My input file is same as the matmul in the README.

func @matmul() {
  %A = memref.alloc() : memref<64x64xf32>
  %B = memref.alloc() : memref<64x64xf32>
  %C = memref.alloc() : memref<64x64xf32>

  affine.for %i = 0 to 64 {
    affine.for %j = 0 to 64 {
      affine.for %k = 0 to 64 {
        %0 = affine.load %A[%i, %k] : memref<64x64xf32>
        %1 = affine.load %B[%k, %j] : memref<64x64xf32>
        %2 = arith.mulf %0, %1 : f32
        %3 = affine.load %C[%i, %j] : memref<64x64xf32>
        %4 = arith.addf %2, %3 : f32
        affine.store %4, %C[%i, %j] : memref<64x64xf32>
      }
    }
  }

  return
}
kumasento commented 2 years ago

Hi @runzhech

I just confirmed on my side that this input works fine.

Please check again the git commit ID and see if that is aligned with the lastest one in the main branch.

The one I tested is 3df1600.

Best

paldebjit commented 2 years ago

@runzhech are you compiling on a non-Ubuntu machine? I am facing the same error message when I use non-Ubuntu machine whereas everything works fine in the Ubuntu machine. Not sure why.

kumasento commented 2 years ago

I'm not sure either. Perhaps it is something related to the isl package.