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
No related tags found
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)
# Compile flags (clang++)
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
(
HPVM_
OP
T_PASSES
-load
LLVMBuildDFG
.so
-load
LLVMInPlaceDFGAnalysis
.so
-load
LLVMDFG2LLVM_CU
DNN.so
-load LLVMDFG2LLVM_CPU.so
-load
LLVMClearDFG
.so
-inplace -dfg2llvm-cudnn -dfg2llvm-cpu -clearDFG
HPVM_
DEFAUL
T_PASSES
LLVMBuildDFG
LLVMInPlaceDFGAnalysis
LLVMDFG2LLVM_C
P
U
LLVMFuseHPVMTensorNodes
LLVMClearDFG
LLVMGenHPVM
)
# Manually specify dependencies because we're not using cmake "normally"
list
(
APPEND DEPEND
clang opt llvm-link
# LLVM binaries
hpvm-rt.ll
# HPVM runtime
LLVMGenHPVM LLVMBuildDFG LLVMInPlaceDFGAnalysis LLVMDFG2LLVM_CUDNN LLVMDFG2LLVM_CPU LLVMClearDFG
# Passes
set
(
HPVM_OPTIONAL_PASSES
LLVMDFG2LLVM_CUDNN
LLVMDFG2LLVM_WrapperAPI
)
# 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
(
test_targets
""
)
foreach
(
entry
${
entries
}
)
if
(
IS_DIRECTORY
${
entry
}
)
file
(
GLOB src_files
${
entry
}
/*.cpp
)
foreach
(
src_file
${
src_files
}
)
get_filename_component
(
target
"
${
src_file
}
"
NAME_WE
)
set
(
target
"test_
${
target
}
"
)
list
(
APPEND test_targets
${
target
}
)
set
(
WORK_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
)
set
(
test_compile_targets
""
)
function
(
compile_single_benchmark target src_file extra_passes extra_dfg_flags
)
foreach
(
pass
${
HPVM_DEFAULT_PASSES
}
${
extra_passes
}
)
list
(
APPEND LOAD_FILE_FLAGS
"-load"
"
${
pass
}
.so"
)
endforeach
()
set
(
HPVM_PASSES
${
LOAD_FILE_FLAGS
}
-buildDFG -inplace -hpvm-fuse
${
extra_dfg_flags
}
-dfg2llvm-cpu -clearDFG
)
set
(
WORK_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_custom_command
(
OUTPUT
"
${
target
}
.ll"
DEPENDS
${
src_file
}
COMMAND
${
CMAKE_CXX_COMPILER
}
${
INCLUDE_COMPILER_STRINGS
}
${
CLANG_FLAGS
}
-emit-llvm -S
${
src_file
}
-o
${
WORK_DIR
}
/
${
target
}
.ll
)
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.hpvm.ll"
"
${
WORK_DIR
}
/
${
target
}
_cudnn.bc"
"
${
WORK_DIR
}
/
${
target
}
_cudnn_linked.bc"
"
${
WORK_DIR
}
/
${
target
}
_cudnn_linked"
DEPENDS
"
${
target
}
.ll"
COMMAND
${
LLVM_OPT
}
-load LLVMGenHPVM.so -genhpvm -globaldce -S
${
WORK_DIR
}
/
${
target
}
.ll
-o
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
COMMAND
${
LLVM_OPT
}
${
HPVM_OPT_PASSES
}
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
-o
${
WORK_DIR
}
/
${
target
}
_cudnn.bc
COMMAND
${
LLVM_LINK
}
${
WORK_DIR
}
/
${
target
}
_cudnn.bc
${
HPVM_RT_PATH
}
-o
${
WORK_DIR
}
/
${
target
}
_cudnn_linked.bc
COMMAND
${
CMAKE_CXX_COMPILER
}
${
WORK_DIR
}
/
${
target
}
_cudnn_linked.bc
$<TARGET_FILE:tensor_runtime> $<TARGET_FILE:gpu_profiler> $<TARGET_FILE:promise_profiler>
-o
${
WORK_DIR
}
/
${
target
}
${
LINKER_FLAGS
}
)
add_custom_target
(
${
target
}
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
_cudnn_linked"
)
add_dependencies
(
${
target
}
${
DEPEND
}
)
endforeach
()
endif
()
endforeach
(
entry
)
message
(
STATUS
"List of test dnn benchmarks:
${
test_targets
}
"
)
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.ll"
DEPENDS
${
src_file
}
COMMAND
${
CMAKE_CXX_COMPILER
}
${
INCLUDE_COMPILER_STRINGS
}
${
CLANG_FLAGS
}
-emit-llvm -S
${
src_file
}
-o
${
WORK_DIR
}
/
${
target
}
.ll
)
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.hpvm.ll"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.ll"
COMMAND
${
LLVM_OPT
}
-load LLVMGenHPVM.so -genhpvm -globaldce -S
${
WORK_DIR
}
/
${
target
}
.ll
-o
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
)
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.llvm.ll"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.hpvm.ll"
COMMAND
${
LLVM_OPT
}
${
HPVM_PASSES
}
-S
${
WORK_DIR
}
/
${
target
}
.hpvm.ll
-o
${
WORK_DIR
}
/
${
target
}
.llvm.ll
)
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
.linked.bc"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.llvm.ll"
COMMAND
${
LLVM_LINK
}
${
WORK_DIR
}
/
${
target
}
.llvm.ll
${
HPVM_RT_PATH
}
-o
${
WORK_DIR
}
/
${
target
}
.linked.bc
)
add_custom_command
(
OUTPUT
"
${
WORK_DIR
}
/
${
target
}
"
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
.linked.bc"
COMMAND
${
CMAKE_CXX_COMPILER
}
${
WORK_DIR
}
/
${
target
}
.linked.bc
$<TARGET_FILE:tensor_runtime> $<TARGET_FILE:gpu_profiler> $<TARGET_FILE:promise_profiler>
-o
${
WORK_DIR
}
/
${
target
}
${
LINKER_FLAGS
}
)
add_custom_target
(
${
target
}
DEPENDS
"
${
WORK_DIR
}
/
${
target
}
"
)
add_dependencies
(
${
target
}
${
DEPEND
}
)
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