spcl / open-earth-compiler

development repository for the open earth compiler
https://arxiv.org/abs/2005.13014
Other
75 stars 14 forks source link

problem about compiling fastwaves.mlir #46

Open Xinyu302 opened 2 years ago

Xinyu302 commented 2 years ago

I use the latest version of open-earth to run some tests. When I compile 'Laplace.mlir' according to readme in this repo, the result is correct. However, when I use the following command to comile fastwaves.mlir:

oec-opt --stencil-shape-inference --convert-stencil-to-std --cse --parallel-loop-tiling='parallel-loop-tile-sizes=128,1,1' --canonicalize --test-gpu-greedy-parallel-loop-mapping --convert-parallel-loops-to-gpu --canonicalize --lower-affine --convert-scf-to-std --stencil-kernel-to-cubin ../../test/Examples/fastwaves.mlir

It seems that open-earth can't do convert-stencil-to-std to fastwaves.mlir. The output is as follows:

oec-opt: /home/yxy/open-earth-compiler/lib/Conversion/StencilToStandard/ConvertStencilToStandard.cpp:593: {anonymous}::StencilToStandardPass::runOnOperation()::<lambda(mlir::stencil::ApplyOp)>: Assertion `lb.size() == shapeOp.getRank() && "expected to find valid storage shape"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.

Could you help me analyze where I may make mistakes and give a feasible solution? Thanks very much!

gysit commented 2 years ago

Can you give the following command line a try:

--canonicalize --stencil-inlining --cse --canonicalize --stencil-shape-inference --stencil-storage-materialization --stencil-shape-inference --stencil-combine-to-ifelse --cse --canonicalize --convert-stencil-to-std --cse --parallel-loop-tiling='parallel-loop-tile-sizes=128,1,1' --canonicalize --test-gpu-greedy-parallel-loop-mapping --convert-parallel-loops-to-gpu --lower-affine --convert-scf-to-std --gpu-kernel-outlining --cse --canonicalize --stencil-kernel-to-cubin --cse --canonicalize --mlir-disable-threading

Note that the full fastwaves kernel is rather complex. AFAIK it should still work though.

Xinyu302 commented 2 years ago

It works, thank you!