Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
bc7d93c8
Commit
bc7d93c8
authored
4 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
Fixed compilation of promise-targeted dnn benchmarks
parent
f0ff9ee5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hpvm/test/dnn_benchmarks/CMakeLists.txt
+76
-54
76 additions, 54 deletions
hpvm/test/dnn_benchmarks/CMakeLists.txt
with
76 additions
and
54 deletions
hpvm/test/dnn_benchmarks/CMakeLists.txt
+
76
−
54
View file @
bc7d93c8
...
@@ -48,63 +48,85 @@ set(HPVM_RT_PATH ${PROJECT_BINARY_DIR}/tools/hpvm/projects/hpvm-rt/hpvm-rt.ll)
...
@@ -48,63 +48,85 @@ set(HPVM_RT_PATH ${PROJECT_BINARY_DIR}/tools/hpvm/projects/hpvm-rt/hpvm-rt.ll)
# Compile flags (clang++)
# Compile flags (clang++)
set
(
CLANG_FLAGS -fno-exceptions -std=c++11 -O3
)
set
(
CLANG_FLAGS -fno-exceptions -std=c++11 -O3
)
#
Passes flags
#
All compilation uses HPVM_DEFAULT_PASSES, some can pick from HPVM_OPTIONAL_PASSES
set
(
set
(
HPVM_
OP
T_PASSES
HPVM_
DEFAUL
T_PASSES
-load
LLVMBuildDFG
.so
LLVMBuildDFG
-load
LLVMInPlaceDFGAnalysis
.so
LLVMInPlaceDFGAnalysis
-load
LLVMDFG2LLVM_CU
DNN.so
LLVMDFG2LLVM_C
P
U
-load LLVMDFG2LLVM_CPU.so
LLVMFuseHPVMTensorNodes
-load
LLVMClearDFG
.so
LLVMClearDFG
-inplace -dfg2llvm-cudnn -dfg2llvm-cpu -clearDFG
LLVMGenHPVM
)
)
set
(
# Manually specify dependencies because we're not using cmake "normally"
HPVM_OPTIONAL_PASSES
list
(
LLVMDFG2LLVM_CUDNN
APPEND DEPEND
LLVMDFG2LLVM_WrapperAPI
clang opt llvm-link
# LLVM binaries
hpvm-rt.ll
# HPVM runtime
LLVMGenHPVM LLVMBuildDFG LLVMInPlaceDFGAnalysis LLVMDFG2LLVM_CUDNN LLVMDFG2LLVM_CPU LLVMClearDFG
# Passes
)
)
# Manually specify dependencies because we're not using cmake "normally"
list
(
APPEND DEPEND clang opt llvm-link hpvm-rt.ll
${
HPVM_DEFAULT_PASSES
}
${
HPVM_OPTIONAL_PASSES
}
)
file
(
GLOB entries ./benchmarks/*
)
set
(
WORK_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
)
set
(
test_targets
""
)
set
(
test_compile_targets
""
)
foreach
(
entry
${
entries
}
)
function
(
compile_single_benchmark target src_file extra_passes extra_dfg_flags
)
if
(
IS_DIRECTORY
${
entry
}
)
foreach
(
pass
${
HPVM_DEFAULT_PASSES
}
${
extra_passes
}
)
file
(
GLOB src_files
${
entry
}
/*.cpp
)
list
(
APPEND LOAD_FILE_FLAGS
"-load"
"
${
pass
}
.so"
)
foreach
(
src_file
${
src_files
}
)
endforeach
()
get_filename_component
(
target
"
${
src_file
}
"
NAME_WE
)
set
(
set
(
target
"test_
${
target
}
"
)
HPVM_PASSES
${
LOAD_FILE_FLAGS
}
list
(
APPEND test_targets
${
target
}
)
-buildDFG -inplace -hpvm-fuse
${
extra_dfg_flags
}
-dfg2llvm-cpu -clearDFG
)
set
(
WORK_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_custom_command
(
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.ll"
DEPENDS
${
src_file
}
OUTPUT
"
${
target
}
.ll"
DEPENDS
${
src_file
}
COMMAND
${
CMAKE_CXX_COMPILER
}
${
INCLUDE_COMPILER_STRINGS
}
${
CLANG_FLAGS
}
-emit-llvm -S
${
src_file
}
COMMAND
${
CMAKE_CXX_COMPILER
}
${
INCLUDE_COMPILER_STRINGS
}
${
CLANG_FLAGS
}
-emit-llvm -S
${
src_file
}
-o
${
WORK_DIR
}
/
${
target
}
.ll
-o
${
WORK_DIR
}
/
${
target
}
.ll
)
)
add_custom_command
(
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.hpvm.ll"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.ll"
OUTPUT
COMMAND
${
LLVM_OPT
}
-load LLVMGenHPVM.so -genhpvm -globaldce -S
${
WORK_DIR
}
/
${
target
}
.ll
"
${
WORK_DIR
}
/
${
target
}
.hpvm.ll"
-o
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
"
${
WORK_DIR
}
/
${
target
}
_cudnn.bc"
)
"
${
WORK_DIR
}
/
${
target
}
_cudnn_linked.bc"
add_custom_command
(
"
${
WORK_DIR
}
/
${
target
}
_cudnn_linked"
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.llvm.ll"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.hpvm.ll"
DEPENDS
"
${
target
}
.ll"
COMMAND
${
LLVM_OPT
}
${
HPVM_PASSES
}
-S
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
COMMAND
${
LLVM_OPT
}
-load LLVMGenHPVM.so -genhpvm -globaldce -S
${
WORK_DIR
}
/
${
target
}
.ll
-o
${
WORK_DIR
}
/
${
target
}
.llvm.ll
-o
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
)
COMMAND
${
LLVM_OPT
}
${
HPVM_OPT_PASSES
}
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
add_custom_command
(
-o
${
WORK_DIR
}
/
${
target
}
_cudnn.bc
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.linked.bc"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.llvm.ll"
COMMAND
${
LLVM_LINK
}
${
WORK_DIR
}
/
${
target
}
_cudnn.bc
${
HPVM_RT_PATH
}
COMMAND
${
LLVM_LINK
}
${
WORK_DIR
}
/
${
target
}
.llvm.ll
${
HPVM_RT_PATH
}
-o
${
WORK_DIR
}
/
${
target
}
_cudnn_linked.bc
-o
${
WORK_DIR
}
/
${
target
}
.linked.bc
COMMAND
${
CMAKE_CXX_COMPILER
}
)
${
WORK_DIR
}
/
${
target
}
_cudnn_linked.bc
add_custom_command
(
$<TARGET_FILE:tensor_runtime> $<TARGET_FILE:gpu_profiler> $<TARGET_FILE:promise_profiler>
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.linked.bc"
-o
${
WORK_DIR
}
/
${
target
}
${
LINKER_FLAGS
}
COMMAND
${
CMAKE_CXX_COMPILER
}
)
${
WORK_DIR
}
/
${
target
}
.linked.bc
add_custom_target
(
${
target
}
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
_cudnn_linked"
)
$<TARGET_FILE:tensor_runtime> $<TARGET_FILE:gpu_profiler> $<TARGET_FILE:promise_profiler>
add_dependencies
(
${
target
}
${
DEPEND
}
)
-o
${
WORK_DIR
}
/
${
target
}
${
LINKER_FLAGS
}
endforeach
()
)
endif
()
add_custom_target
(
${
target
}
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
"
)
endforeach
(
entry
)
add_dependencies
(
${
target
}
${
DEPEND
}
)
message
(
STATUS
"List of test dnn benchmarks:
${
test_targets
}
"
)
set
(
test_compile_targets
${
test_compile_targets
}
${
target
}
PARENT_SCOPE
)
endfunction
(
compile_single_benchmark
)
file
(
GLOB entries ./benchmarks/*
)
foreach
(
dir
${
entries
}
)
get_filename_component
(
dirname
"
${
dir
}
"
NAME
)
compile_single_benchmark
(
"test_
${
dirname
}
"
${
dir
}
/
${
dirname
}
.cpp LLVMDFG2LLVM_CUDNN -dfg2llvm-cudnn
)
set
(
loop_extra_flags
-dfg2llvm-wrapperapi
-quantization-levels-filename=
${
dir
}
/data/quant_ranges_rt.txt
-configuration-inputs-filename=
${
dir
}
/data/tuner_confs.txt
)
compile_single_benchmark
(
"test_
${
dirname
}
_loop"
${
dir
}
/
${
dirname
}
_loop.cpp
LLVMDFG2LLVM_WrapperAPI
"
${
loop_extra_flags
}
"
)
endforeach
(
dir
)
message
(
STATUS
"List of test dnn benchmarks:
${
test_compile_targets
}
"
)
add_custom_target
(
dnn_benchmarks DEPENDS
${
test_compile_targets
}
)
message
(
STATUS
"Target name for compiling all dnn benchmarks: dnn_benchmarks"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment