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

[BUG][Pluto] Failed to process modulo access relation #98

Open
kumasento opened this issue Oct 9, 2021 · 1 comment
Open

[BUG][Pluto] Failed to process modulo access relation #98

kumasento opened this issue Oct 9, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@kumasento
Copy link
Owner

func private @S0(%A: memref<40x50xf32>, %t: index, %i: index) attributes {scop.stmt} {
  %cst = constant 0.25: f32
  %cst2 = constant 2.0 : f32

  %0 = affine.load %A[%t mod 2, %i + 1]: memref<40x50xf32>
  %1 = affine.load %A[%t mod 2, %i] : memref<40x50xf32>
  %2 = mulf %cst2, %1 : f32
  %3 = addf %0, %2 : f32
  %4 = affine.load %A[%t mod 2, %i - 1]: memref<40x50xf32>
  %5 = addf %3, %4 : f32
  %6 = mulf %cst, %5 : f32
  affine.store %6, %A[(%t + 1) mod 2, %i] : memref<40x50xf32>

  return
}


func @jacobi_diamond(%A: memref<40x50xf32>) {
  affine.for %t = 0 to 38 {
    affine.for %i = 1 to 47 {
      call @S0(%A, %t, %i): (memref<40x50xf32>, index, index) -> ()
    }
  }
  return
}
ninja && ./bin/polymer-opt ../test/polymer-opt/PlutoTransforms/jacobi-diamond.mlir -pluto-opt                 ninja: no work to do.
polymer-opt: /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:257: const T &llvm::ArrayRef<long>::operator[](size_t) const [T = long]: Assertion `Index < Length && "Invalid index!"' failed.PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:0.      Program arguments: ./bin/polymer-opt ../test/polymer-opt/PlutoTransforms/jacobi-diamond.mlir -pluto-opt
 #0 0x0000000000b7f48a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:11
 #1 0x0000000000b7f65b PrintStackTraceSignalHandler(void*) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x0000000000b7dc2b llvm::sys::RunSignalHandlers() /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/lib/Support/Signals.cpp:96:5
 #3 0x0000000000b7fda1 SignalHandler(int) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1 #4 0x00007fb558686630 __restore_rt (/lib64/libpthread.so.0+0xf630)
 #5 0x00007fb555e0e3d7 raise (/lib64/libc.so.6+0x363d7) #6 0x00007fb555e0fac8 abort (/lib64/libc.so.6+0x37ac8)
 #7 0x00007fb555e071a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6) #8 0x00007fb555e07252 (/lib64/libc.so.6+0x2f252)
 #9 0x0000000000f7d4ba llvm::ArrayRef<long>::operator[](unsigned long) const /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:0:7#10 0x00000000011c45ff polymer::OslScop::addRelation(int, int, int, int, int, int, int, int, llvm::ArrayRef<long>, llvm::ArrayRef<long>) /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../lib/Support/OslScop.cc:128:43#11 0x00000000011c588b polymer::OslScop::addAccessRelation(int, bool, mlir::Value, mlir::AffineValueMap&, mlir::FlatAffineValueConstraints&) /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../lib/Support/OslScop.cc:273:1#12 0x00000000011c20e0 (anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0::operator()(mlir::Operation*) const /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../lib/Target/OpenScop/ConvertToOpenScop.cc:132:7#13 0x00000000011c2000 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0>(long, mlir::Operation*) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/include/llvm/ADT/STLExtras.h:177:5#14 0x0000000000f299bc llvm::function_ref<void (mlir::Operation*)>::operator()(mlir::Operation*) const /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/llvm/include/llvm/ADT/STLExtras.h:200:5#15 0x000000000111ba26 mlir::detail::walk(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/IR/Visitors.cpp:68:1
#16 0x000000000111b9d3 mlir::detail::walk(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/IR/Visitors.cpp:61:27#17 0x00000000011c1f95 std::enable_if<llvm::is_one_of<mlir::Operation*, mlir::Operation*, mlir::Region*, mlir::Block*>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, (anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0, mlir::Operation*, void>(mlir::Operation*, (anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0&&) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/include/mlir/IR/Visitors.h:134:3#18 0x00000000011c1f30 void mlir::Operation::walk<(mlir::WalkOrder)1, (anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0, void>((anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0&&) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/include/mlir/IR/Operation.h:522:5#19 0x00000000011c1bc3 void mlir::OpState::walk<(mlir::WalkOrder)1, (anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0, void>((anonymous namespace)::OslScopBuilder::build(mlir::FuncOp)::$_0&&) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/include/mlir/IR/OpDefinition.h:161:5
#20 0x00000000011c10b8 (anonymous namespace)::OslScopBuilder::build(mlir::FuncOp) /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../lib/Target/OpenScop/ConvertToOpenScop.cc:135:11
#21 0x00000000011c0d57 polymer::createOpenScopFromFuncOp(mlir::FuncOp, polymer::OslSymbolTable&) /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../lib/Target/OpenScop/ConvertToOpenScop.cc:225:27
#22 0x000000000111d3e5 plutoTransform(mlir::FuncOp, mlir::OpBuilder&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, bool, int, int, bool) /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../lib/Transforms/PlutoTransform.cc:80:8#23 0x000000000111cee8 (anonymous namespace)::PlutoTransformPass::runOnOperation() /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../lib/Transforms/PlutoTransform.cc:164:28#24 0x0000000000e8eb48 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:386:21#25 0x0000000000e8f10d mlir::detail::OpToOpPassAdaptor::runPipeline(llvm::iterator_range<llvm::pointee_iterator<std::unique_ptr<mlir::Pass, std::default_delete<mlir::Pass> >*, mlir::Pass> >, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:445:16
#26 0x0000000000e907be mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:689:10#27 0x0000000000e906a0 mlir::PassManager::run(mlir::Operation*) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/Pass/Pass.cpp:669:60
#28 0x0000000000e35c49 performActions(llvm::raw_ostream&, bool, bool, llvm::SourceMgr&, mlir::MLIRContext*, mlir::PassPipelineCLParser const&) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:84:17#29 0x0000000000e34b78 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:120:12
#30 0x0000000000e34996 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) /mnt/ccnas2/bdp/rz3515/projects/phism/polygeist/llvm-project/mlir/lib/Support/MlirOptMain.cpp:157:10
#31 0x0000000000a5549e main /mnt/ccnas2/bdp/rz3515/projects/phism/polymer/build/../tools/polymer-opt/polymer-opt.cc:117:17
#32 0x00007fb555dfa555 __libc_start_main (/lib64/libc.so.6+0x22555)
#33 0x0000000000a55029 _start (./bin/polymer-opt+0xa55029)
[1]    160465 abort (core dumped)  ./bin/polymer-opt ../test/polymer-opt/PlutoTransforms/jacobi-diamond.mlir 
@kumasento kumasento added the bug Something isn't working label Oct 9, 2021
@kumasento kumasento self-assigned this Oct 9, 2021
@kumasento kumasento changed the title [BUG][Pluto] Failed to process jacobi [BUG][Pluto] Failed to process modulo access relation Oct 9, 2021
@kumasento
Copy link
Owner Author

This assertion is from a minor issue due to missing inequalities for access relations.

But even this has been fixed, there seems to be another problem from Pluto -

https://github.com/bondhugula/pluto/blob/dae26e77b94b2624a540c08ec7128f20cd7b7985/tool/osl_pluto.c#L554

The mod operator would introduce local dims, and this cannot be handled by Pluto due to the line above.

Will try to fix this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant