-
Notifications
You must be signed in to change notification settings - Fork 45
[DeepLearning/Models] add MobileNet-V3 Model benchmark #131
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
29931c0
add MobileNet-V3 Model benchmark
db836e2
update MobileNet-V3 benchmark
0d674fe
Merge branch 'buddy-compiler:main' into main
ShiHaoGao 4af8f9b
add batchMatMul opt pass
e485324
Update MobileNet-V3 README.md
ecf689e
Fix bugs on MobileNet-V3 benchmark
13d508f
Fix <file in wrong format> bug
fa99315
Update readme & fix CMakeList.txt
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(Models) | ||
add_subdirectory(Ops) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(MobileNet-V3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# model params file | ||
arg0.data | ||
arg1.data | ||
|
||
# model mlir file | ||
forward.mlir | ||
subgraph0.mlir |
161 changes: 161 additions & 0 deletions
161
benchmarks/DeepLearning/Models/MobileNet-V3/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
add_custom_command( | ||
OUTPUT | ||
${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/forward.mlir | ||
${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/subgraph0.mlir | ||
COMMAND python3 ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/buddy_mobilenetv3_import.py | ||
COMMENT "Generating forward.mlir, subgraph0.mlir" | ||
) | ||
|
||
add_custom_command( | ||
OUTPUT forward_auto_vectorization.o | ||
COMMAND cat ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/forward.mlir | | ||
sed -e {s/@forward/@forward_auto_vectorization/} -e {s/@subgraph0/@subgraph0_auto_vectorization/} | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-opt | ||
-pass-pipeline | ||
"builtin.module(func.func(tosa-to-linalg-named, tosa-to-linalg, tosa-to-tensor, tosa-to-arith), \ | ||
empty-tensor-to-alloc-tensor, convert-elementwise-to-linalg, arith-bufferize, \ | ||
func.func(linalg-bufferize, tensor-bufferize), func-bufferize)" | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-opt | ||
-pass-pipeline | ||
"builtin.module(func.func(buffer-deallocation-simplification, convert-linalg-to-loops), \ | ||
eliminate-empty-tensors, func.func(llvm-request-c-wrappers), \ | ||
convert-math-to-llvm, convert-math-to-libm, convert-scf-to-cf, \ | ||
convert-arith-to-llvm, expand-strided-metadata, finalize-memref-to-llvm, \ | ||
convert-func-to-llvm, reconcile-unrealized-casts)" | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-translate -mlir-to-llvmir | | ||
${LLVM_MLIR_BINARY_DIR}/llvm-as | | ||
${LLVM_MLIR_BINARY_DIR}/llc -O3 -mtriple=${BUDDY_OPT_TRIPLE} | ||
-mattr=${BUDDY_OPT_ATTR} -filetype=obj | ||
-o ${BUDDY_BINARY_DIR}/../benchmarks/DeepLearning/Models/MobileNet-V3/forward_auto_vectorization.o | ||
DEPENDS ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/forward.mlir | ||
COMMENT "Building forward_auto_vectorization.o" | ||
VERBATIM) | ||
|
||
add_custom_command( | ||
OUTPUT subgraph0_auto_vectorization.o | ||
COMMAND cat ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/subgraph0.mlir | | ||
sed -e {s/@subgraph0/@subgraph0_auto_vectorization/} | | ||
${BUDDY_MLIR_BINARY_DIR}/buddy-opt | ||
-pass-pipeline | ||
"builtin.module(func.func(tosa-to-linalg-named, tosa-to-arith, tosa-to-linalg, tosa-to-tensor))" | | ||
${BUDDY_MLIR_BINARY_DIR}/buddy-opt | ||
-convert-elementwise-to-linalg | ||
-func-bufferize-dynamic-offset | ||
-arith-bufferize | ||
-func-bufferize | ||
-tensor-bufferize | ||
-linalg-bufferize | ||
-finalizing-bufferize | ||
-convert-linalg-to-loops | ||
-lower-affine | ||
-convert-scf-to-cf | ||
-llvm-request-c-wrappers | ||
-convert-math-to-llvm | ||
-convert-math-to-libm | ||
-convert-arith-to-llvm | ||
-convert-func-to-llvm | ||
-expand-strided-metadata | ||
-finalize-memref-to-llvm | ||
-reconcile-unrealized-casts | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-translate -mlir-to-llvmir | | ||
${LLVM_MLIR_BINARY_DIR}/llvm-as | | ||
${LLVM_MLIR_BINARY_DIR}/llc -O3 -mtriple=${BUDDY_OPT_TRIPLE} | ||
-mattr=${BUDDY_OPT_ATTR} -filetype=obj | ||
-o ${BUDDY_BINARY_DIR}/../benchmarks/DeepLearning/Models/MobileNet-V3/subgraph0_auto_vectorization.o | ||
DEPENDS ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/subgraph0.mlir | ||
${BUDDY_MLIR_BINARY_DIR}/buddy-opt | ||
COMMENT "Building subgraph0_auto_vectorization.o" | ||
VERBATIM) | ||
|
||
add_custom_command( | ||
OUTPUT forward_vectorization.o | ||
COMMAND cat ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/forward.mlir | | ||
sed -e {s/@forward/@forward_vectorization/} -e {s/@subgraph0/@subgraph0_vectorization/} | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-opt | ||
-pass-pipeline | ||
"builtin.module(func.func(tosa-to-linalg-named, tosa-to-linalg, tosa-to-tensor, tosa-to-arith), \ | ||
empty-tensor-to-alloc-tensor, convert-elementwise-to-linalg, arith-bufferize, \ | ||
func.func(linalg-bufferize, tensor-bufferize), func-bufferize)" | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-opt | ||
-pass-pipeline | ||
"builtin.module(func.func(buffer-deallocation-simplification, convert-linalg-to-loops), \ | ||
eliminate-empty-tensors, func.func(llvm-request-c-wrappers), \ | ||
convert-math-to-llvm, convert-math-to-libm, convert-scf-to-cf, \ | ||
convert-arith-to-llvm, expand-strided-metadata, finalize-memref-to-llvm, \ | ||
convert-func-to-llvm, reconcile-unrealized-casts)" | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-translate -mlir-to-llvmir | | ||
${LLVM_MLIR_BINARY_DIR}/llvm-as | | ||
${LLVM_MLIR_BINARY_DIR}/llc -O3 -mtriple=${BUDDY_OPT_TRIPLE} | ||
-mattr=${BUDDY_OPT_ATTR} -filetype=obj | ||
-o ${BUDDY_BINARY_DIR}/../benchmarks/DeepLearning/Models/MobileNet-V3/forward_vectorization.o | ||
DEPENDS ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/forward.mlir | ||
COMMENT "Building forward_vectorization.o" | ||
VERBATIM) | ||
|
||
add_custom_command( | ||
OUTPUT subgraph0_vectorization.o | ||
COMMAND cat ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/subgraph0.mlir | | ||
sed -e {s/@subgraph0/@subgraph0_vectorization/} | | ||
${BUDDY_MLIR_BINARY_DIR}/buddy-opt | ||
-pass-pipeline | ||
"builtin.module(func.func(tosa-to-linalg-named, tosa-to-arith, tosa-to-linalg, tosa-to-tensor))" | | ||
${BUDDY_MLIR_BINARY_DIR}/buddy-opt | ||
-convert-elementwise-to-linalg | ||
-func-bufferize-dynamic-offset | ||
-arith-bufferize | ||
-func-bufferize | ||
-tensor-bufferize | ||
-linalg-bufferize | ||
-finalizing-bufferize | ||
-batchmatmul-optimize | ||
-convert-linalg-to-affine-loops | ||
-lower-affine | ||
-convert-vector-to-scf | ||
-convert-scf-to-cf | ||
-llvm-request-c-wrappers | ||
-convert-vector-to-llvm | ||
-convert-math-to-llvm | ||
-convert-math-to-libm | ||
-convert-arith-to-llvm | ||
-convert-func-to-llvm | ||
-expand-strided-metadata | ||
-finalize-memref-to-llvm | ||
-reconcile-unrealized-casts | | ||
${LLVM_MLIR_BINARY_DIR}/mlir-translate -mlir-to-llvmir | | ||
${LLVM_MLIR_BINARY_DIR}/llvm-as | | ||
${LLVM_MLIR_BINARY_DIR}/llc -O3 -mtriple=${BUDDY_OPT_TRIPLE} | ||
-mattr=${BUDDY_OPT_ATTR} -filetype=obj | ||
-o ${BUDDY_BINARY_DIR}/../benchmarks/DeepLearning/Models/MobileNet-V3/subgraph0_vectorization.o | ||
DEPENDS ${BUDDY_BENCHMARK_DEEP_LEARNING_DIR}/Models/MobileNet-V3/subgraph0.mlir | ||
${BUDDY_MLIR_BINARY_DIR}/buddy-opt | ||
COMMENT "Building subgraph0_vectorization.o" | ||
VERBATIM) | ||
|
||
add_library(MOBILENETV3_AUTO_VECTORIZATION STATIC subgraph0_auto_vectorization.o forward_auto_vectorization.o) | ||
set_target_properties(MOBILENETV3_AUTO_VECTORIZATION PROPERTIES LINKER_LANGUAGE CXX) | ||
|
||
add_library(MOBILENETV3_VECTORIZATION STATIC subgraph0_vectorization.o forward_vectorization.o) | ||
set_target_properties(MOBILENETV3_VECTORIZATION PROPERTIES LINKER_LANGUAGE CXX) | ||
|
||
add_executable(dl-model-mobileNetV3-benchmark | ||
GoogleBenchmarkMain.cpp | ||
) | ||
|
||
set_target_properties(dl-model-mobileNetV3-benchmark PROPERTIES | ||
LINK_FLAGS "-static" | ||
) | ||
|
||
set(BenchmarkTool GoogleBenchmark) | ||
|
||
if(CROSS_COMPILE_RVV) | ||
set(BUDDY_LIB_DIR ${BUDDY_MLIR_CROSS_LIB_DIR}) | ||
else() | ||
set(BUDDY_LIB_DIR ${BUDDY_MLIR_LIB_DIR}) | ||
endif() | ||
|
||
target_link_libraries(dl-model-mobileNetV3-benchmark | ||
${BenchmarkTool} | ||
MOBILENETV3_AUTO_VECTORIZATION | ||
MOBILENETV3_VECTORIZATION | ||
${BUDDY_LIB_DIR}/libStaticMLIRCRunnerUtils.a | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMake bug!
Please include
BUDDY_OPT_TRIPLE
andBUDDY_OPT_ATTR
for local machine in theelse
branch.