Skip to content

[DeepLearning/Models] add MobileNet-V3 Model benchmark#131

Merged
zhanghb97 merged 8 commits into
buddy-compiler:mainfrom
ShiHaoGao:main
Aug 18, 2024
Merged

[DeepLearning/Models] add MobileNet-V3 Model benchmark#131
zhanghb97 merged 8 commits into
buddy-compiler:mainfrom
ShiHaoGao:main

Conversation

@ShiHaoGao

Copy link
Copy Markdown
Contributor

k230:
image-20240712144722362

local:
image-20240712145055758

Comment thread CMakeLists.txt Outdated
## Configure the buddy-benchmark build.
##
##===----------------------------------------------------------------------===//
# #===- CMakeLists.txt - buddy-benchmark cmake root ------------*- cmake -*-===//

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please do not modify the format.

Comment thread CMakeLists.txt Outdated
set(BUDDY_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(BUDDY_EXAMPLES_DIR ${BUDDY_SOURCE_DIR}/examples)
set(BUDDY_MLIR_BINARY_DIR ${BUDDY_MLIR_BUILD_DIR}/bin)
set(BUDDY_DEEP_LEARNING_DIR ${BUDDY_SOURCE_DIR}/benchmarks/DeepLearning)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

BUDDY_DEEP_LEARNING_DIR -> BUDDY_BENCHMARK_DEEP_LEARNING_DIR


# model mlir file
forward.mlir
subgraph0.mlir No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add an empty line here.

MemRef<long long, 1> ParamsContainerInt64({34});
loadParameters(paramsDir, intDir, paramsContainerf32, ParamsContainerInt64);
for (auto _ : state) {
_mlir_ciface_forward(&output, &paramsContainerf32, &ParamsContainerInt64,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Benchmark should only evaluate the forward function.

MemRef<long long, 1> ParamsContainerInt64({34});
loadParameters(paramsDir, intDir, paramsContainerf32, ParamsContainerInt64);

// Call the forward function of the model.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems that the benchmark did not clarify these two functions, i.e., scalar vs auto-vectorization

@@ -0,0 +1,78 @@
# ===- buddy-mobilenetv3-import.py ---------------------------------------------

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

buddy-mobilenetv3-import.py -> buddy_mobilenetv3_import.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We will use random values as the fake input, so we do not need the following images.

@ShiHaoGao

ShiHaoGao commented Jul 17, 2024

Copy link
Copy Markdown
Contributor Author

MobileNet-V3 benchmark on local hardware platform is upated. But, build mobileNet-V3 benchmark lib on RV platform has some errors about LLVM.

LLVM ERROR: Incomplete scavenging after 2nd pass
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc -O0 -mtriple=riscv64 -mattr=+v,+m -filetype=obj -o /home/gaoshihao/project/buddy-benchmark/build/bin/../benchmarks/DeepLearning/Models/MobileNet-V3/subgraph0_scalar.o
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@_mlir_ciface_subgraph0_scalar'
 #0 0x0000564f422cd850 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x1d65850)
 #1 0x0000564f422cac5f llvm::sys::RunSignalHandlers() (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x1d62c5f)
 #2 0x0000564f422cadb5 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f2024a71520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f2024ac59fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007f2024ac59fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007f2024ac59fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007f2024a71476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007f2024a577f3 abort ./stdlib/abort.c:81:7
 #9 0x0000564f40a07910 llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
#10 0x0000564f42221e8e (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x1cb9e8e)
#11 0x0000564f41748654 llvm::scavengeFrameVirtualRegs(llvm::MachineFunction&, llvm::RegScavenger&) (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x11e0654)
#12 0x0000564f416a778b (anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) PrologEpilogInserter.cpp:0:0
#13 0x0000564f4151f837 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x0000564f41ae80de llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x15800de)
#15 0x0000564f41ae8329 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x1580329)
#16 0x0000564f41ae8c65 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x1580c65)
#17 0x0000564f40a8177e compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x0000564f40a0cfb6 main (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x4a4fb6)
#19 0x00007f2024a58d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#20 0x00007f2024a58e40 call_init ./csu/../csu/libc-start.c:128:20
#21 0x00007f2024a58e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#22 0x0000564f40a78495 _start (/home/gaoshihao/project/buddy-mlir/build/../llvm/build/bin/llc+0x510495)
Aborted (core dumped)
ninja: build stopped: subcommand failed.

local:
image-20240717163842163

@zhanghb97 zhanghb97 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OSError: The environment variable 'MOBILENETV3_MODEL_PATH' is not set or is invalid.

@zhanghb97

Copy link
Copy Markdown
Member
[18/18] Linking CXX executable bin/dl-model-mobileNetV3-benchmark
FAILED: bin/dl-model-mobileNetV3-benchmark 
: && /home/zhanghongbin/buddy-mlir/build/thirdparty/riscv-gnu-toolchain/bin/riscv64-unknown-linux-gnu-g++ -no-pie -O3 -DNDEBUG -static benchmarks/DeepLearning/Models/MobileNet-V3/CMakeFiles/dl-model-mobileNetV3-benchmark.dir/GoogleBenchmarkMain.cpp.o -o bin/dl-model-mobileNetV3-benchmark  vendor/benchmark/lib/libbenchmark.a  benchmarks/DeepLearning/Models/MobileNet-V3/libMOBILENETV3_SCALAR.a  benchmarks/DeepLearning/Models/MobileNet-V3/libMOBILENETV3_AUTO_VECTORIZATION.a  /home/zhanghongbin/buddy-mlir/build-cross-rv//lib/libStaticMLIRCRunnerUtils.a && :
/home/zhanghongbin/buddy-mlir/build/thirdparty/riscv-gnu-toolchain/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: benchmarks/DeepLearning/Models/MobileNet-V3/libMOBILENETV3_SCALAR.a(forward_scalar.o): Relocations in generic ELF (EM: 62)
/home/zhanghongbin/buddy-mlir/build/thirdparty/riscv-gnu-toolchain/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: benchmarks/DeepLearning/Models/MobileNet-V3/libMOBILENETV3_SCALAR.a(forward_scalar.o): Relocations in generic ELF (EM: 62)
/home/zhanghongbin/buddy-mlir/build/thirdparty/riscv-gnu-toolchain/lib/gcc/riscv64-unknown-linux-gnu/13.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: benchmarks/DeepLearning/Models/MobileNet-V3/libMOBILENETV3_SCALAR.a: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

@ShiHaoGao

Copy link
Copy Markdown
Contributor Author

k230:
image

@zhanghb97

Copy link
Copy Markdown
Member
  1. The README does not contain tips and guidance for the Python environment
image
  1. The RVV target file has the wrong format
image

Comment thread CMakeLists.txt
set(BUDDY_OPT_TRIPLE riscv64)
set(BUDDY_OPT_ATTR +v,+m)
set(BUDDY_MLIR_CROSS_LIB_DIR ${BUDDY_MLIR_BUILD_CROSS_DIR}/lib)
else()

@zhanghb97 zhanghb97 Aug 18, 2024

Copy link
Copy Markdown
Member

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 and BUDDY_OPT_ATTR for local machine in the else branch.

)

add_custom_command(
OUTPUT forward_autoVectorization.o

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Weird naming convention.
forward_autoVectorization -> forward_auto_vectorization

@@ -1,5 +1,12 @@
# Deep Learning Benchmark

## Model Level Benchmark

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add the statement for Python (using model-level benchmark needs the Python environment), e.g., enter the Python environment, configure the Python path, etc.

@@ -0,0 +1,49 @@
# Buddy Compiler MobileNetV3 Benchmark

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let’s not make the READMEs too scattered. Remove this file and add the necessary information (python env and path) to the deep learning benchmark README.

@zhanghb97 zhanghb97 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@zhanghb97 zhanghb97 merged commit 7ffe997 into buddy-compiler:main Aug 18, 2024
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