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

No Pluto optimization in matrix multiplication example #119

Closed
malixian opened this issue Nov 29, 2021 · 4 comments · Fixed by #120
Closed

No Pluto optimization in matrix multiplication example #119

malixian opened this issue Nov 29, 2021 · 4 comments · Fixed by #120

Comments

@malixian
Copy link

malixian commented Nov 29, 2021

I build the polymer with impact branch, and try to optimize matmul.mlir. But I find there is no difference between output mlir and input mlir.
The command I used is polymer-opt -pluto-opt ../matmul.mlir.
And the output mlir is:

module  {
  func @matmul() {
    %0 = alloc() : memref<64x64xf32>
    %1 = alloc() : memref<64x64xf32>
    %2 = alloc() : memref<64x64xf32>
    affine.for %arg0 = 0 to 64 {
      affine.for %arg1 = 0 to 64 {
        affine.for %arg2 = 0 to 64 {
          %3 = affine.load %0[%arg0, %arg2] : memref<64x64xf32>
          %4 = affine.load %1[%arg2, %arg1] : memref<64x64xf32>
          %5 = mulf %3, %4 : f32
          %6 = affine.load %2[%arg0, %arg1] : memref<64x64xf32>
          %7 = addf %5, %6 : f32
          affine.store %7, %2[%arg0, %arg1] : memref<64x64xf32>
        }
      }
    }
    return
  }
}

When I try to build this project with main branch and use the command ./scripts/build-with-polygeist.sh, I get a compile error:

configure: error: clang header file not found
checking for pet/Makefile... no
configure: error: configure in pet/ failed
tools/mlir/tools/polymer/CMakeFiles/pluto.dir/build.make:124: recipe for target 'tools/mlir/tools/polymer/pluto/src/pluto-stamp/pluto-configure' failed
make[3]: *** [tools/mlir/tools/polymer/pluto/src/pluto-stamp/pluto-configure] Error 1
CMakeFiles/Makefile2:109388: recipe for target 'tools/mlir/tools/polymer/CMakeFiles/pluto.dir/all' failed
make[2]: *** [tools/mlir/tools/polymer/CMakeFiles/pluto.dir/all] Error 2
CMakeFiles/Makefile2:110540: recipe for target 'tools/mlir/tools/polymer/test/CMakeFiles/check-polymer.dir/rule' failed
make[1]: *** [tools/mlir/tools/polymer/test/CMakeFiles/check-polymer.dir/rule] Error 2
Makefile:27063: recipe for target 'check-polymer' failed
make: *** [check-polymer] Error 2

Is there any solutions to solve these problems above? Thanks.

@kumasento
Copy link
Owner

kumasento commented Nov 29, 2021 via email

@malixian
Copy link
Author

Thank you for your reply @kumasento . When I run the command ./polymer-opt -reg2mem -extract-scop-stmt -pluto-opt matmul.mlir, there occurs a core dump.
Error log is:

polymer-opt: /home/mlx/repos/MLIR-repos/polymer/llvm/mlir/lib/Analysis/AffineStructures.cpp:3050: void getIndependentConstraints(const mlir::FlatAffineConstraints &, unsigned int, unsigned int, SmallVectorImpl &, SmallVectorImpl &): Assertion `pos < cst.getNumIds() && "invalid start position"' failed.

@kumasento
Copy link
Owner

kumasento commented Nov 30, 2021 via email

@malixian
Copy link
Author

Thanks, I will try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants