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

[OpOptimization] Add BatchMatMul benchmark and [OpOptimization] Further optimize BatchMatMulBroadcast and add OpenMP tests #73

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EllisLambda
Copy link

@EllisLambda EllisLambda commented Aug 19, 2023

The explanation of the further optimize:

EllisLambda@d8888a4#r126890428

@xlinsist
Copy link
Collaborator

Note: The file "BatchMatMulBroadcast.mlir" can be generated from "BatchMatMul.mlir" using --batchmatmul-optimize pass developed in buddy-compiler/buddy-mlir#187.

@xlinsist
Copy link
Collaborator

This PR can be merged once these issues mentioned above are fixed. @EllisLambda

@xlinsist
Copy link
Collaborator

xlinsist commented Sep 9, 2023

@EllisLambda Please also make changes based on the suggestions mentioned above.

@EllisLambda
Copy link
Author

@EllisLambda Please also make changes based on the suggestions mentioned above.

@xlinsist Problems have been fixed.

@EllisLambda
Copy link
Author

@xlinsist New commit have been pushed.

@EllisLambda EllisLambda changed the title [OpOptimization] Add BatchMatMul benchmark. [OpOptimization] Add BatchMatMul benchmark and [OpOptimization] Further optimize BatchMatMulBroadcast and add OpenMP tests Sep 9, 2023
@EllisLambda EllisLambda force-pushed the main branch 2 times, most recently from 100bb85 to fc5e694 Compare September 11, 2023 06:08
README.md Show resolved Hide resolved
@EllisLambda EllisLambda force-pushed the main branch 5 times, most recently from aa4bf23 to feb6685 Compare September 19, 2023 16:06
@xlinsist
Copy link
Collaborator

It seems that we have to carefully support lld and openmp. I will test this PR tomorrow.

@@ -227,13 +227,42 @@ $ mkdir build && cd build
$ cmake -G Ninja .. \
-DCMAKE_BUILD_TYPE=RELEASE \
-DOP_OPTIMIZATION_BENCHMARKS=ON \
-DCMAKE_CXX_COMPILER=clang++ \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we only need to use clang++ in matmul-benchmark, so the modification here should be withdrawn.

-DLLVM_ENABLE_RUNTIMES=all \
-DOPENMP_ENABLE_LIBOMPTARGET=OFF \
-DCMAKE_BUILD_TYPE=RELEASE
```
Copy link
Collaborator

@xlinsist xlinsist Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a specific construction process is required(in matmul-benchmark), please ensure that the construction process you provide is complete. For example, add the step $ ninja, since in the default construction process we only use $ ninja check-clang check-mlir.

$ cmake -G Ninja .. \
-DCMAKE_BUILD_TYPE=RELEASE \
-DOP_OPTIMIZATION_BENCHMARKS=ON \
-DCMAKE_CXX_COMPILER=/PATH/TO/BUDDY-MLIR/BUILD/bin/clang++ \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/PATH/TO/BUDDY-MLIR/BUILD/bin/clang++ ->
/PATH/TO/BUDDY-MLIR/llvm/build/bin/clang++

-DBUDDY_MLIR_BUILD_DIR=/PATH/TO/BUDDY-MLIR/BUILD/
$ ninja matmul-benchmark
```
- `matmul-benchmark` need to load the `libomp.so` in `buddy-mlir/llvm/build/lib` to execute, here's a temporary way without root.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommand to rephrase the description here like this:

To execute matmul-benchmark in buddy-benchmark/build/bin, The libomp.so file from buddy-mlir/llvm/build/lib need to be loaded. Here is a temporary workaround without root access:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
I have successfully constructed matmul-benchmark and verified the optimization, but there are some warnings using clang++ with argument -no-pie and -fuse-ld=lld. Are you able to reproduce them in your machine and can we eliminate them?

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 this pull request may close these issues.

2 participants