1 #===============================================================================
2 # Copyright 2017-2018 Intel Corporation
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #===============================================================================
17 file(GLOB_RECURSE HEADERS
18 ${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h
19 ${CMAKE_CURRENT_SOURCE_DIR}/../include/*.hpp
21 file(GLOB_RECURSE SOURCES
22 ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
25 ${CMAKE_CURRENT_SOURCE_DIR}
26 ${CMAKE_CURRENT_SOURCE_DIR}/conv
27 ${CMAKE_CURRENT_SOURCE_DIR}/ip
28 ${CMAKE_CURRENT_SOURCE_DIR}/shuffle
29 ${CMAKE_CURRENT_SOURCE_DIR}/reorder
32 if(BENCHDNN_USE_RDPMC)
33 add_definitions(-DBENCHDNN_USE_RDPMC)
36 if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
37 append_if(WIN32 CMAKE_CXX_FLAGS "-Qprec-div")
38 append_if(UNIX CMAKE_CXX_FLAGS "-prec-div -fp-model precise")
41 if(UNIX AND NOT APPLE)
42 find_library(LIBRT rt)
44 register_exe(benchdnn "${SOURCES}" "" "${LIBRT}")
46 file(COPY inputs DESTINATION .)
48 # register benchdnn test case
49 function(register_benchdnn_test name cmd)
50 string(REPLACE " " ";" cmd ${cmd})
51 string(REPLACE " " ";" ARGV2 "${ARGV2}")
52 add_custom_target(${name}
54 COMMAND ${ARGV2} # if any
56 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
59 set_property(TARGET ${name} PROPERTY ENVIRONMENT "PATH=${CTESTCONFIG_PATH}")
60 configure_file(${CMAKE_SOURCE_DIR}/config_template.vcxproj.user ${name}.vcxproj.user @ONLY)
64 register_benchdnn_test(test_conv "benchdnn -v1 --conv --batch=inputs/test_conv_all")
65 register_benchdnn_test(test_benchdnn_conv "benchdnn -v1 --conv --batch=inputs/test_conv_all")
66 register_benchdnn_test(test_benchdnn_deconv "benchdnn -v1 --deconv --batch=inputs/test_deconv_all")
67 register_benchdnn_test(test_benchdnn_rnn "benchdnn -v1 --rnn")
68 register_benchdnn_test(test_benchdnn_reorder "benchdnn --reorder --batch=inputs/reorder/test_default")
69 register_benchdnn_test(test_benchdnn_bnorm "benchdnn --bnorm --batch=inputs/bnorm/test_bnorm_topo")
70 register_benchdnn_test(test_benchdnn_ip "benchdnn --ip --batch=inputs/ip/test_ip_all")
71 register_benchdnn_test(test_benchdnn_regression
72 "benchdnn --conv --batch=inputs/test_conv_regression"
73 "benchdnn --bnorm --batch=inputs/bnorm/test_bnorm_regressions"
75 register_benchdnn_test(test_benchdnn_regression_large
76 "benchdnn --bnorm --batch=inputs/bnorm/test_bnorm_regressions_large"