提交 5b1cda72 编写于 作者: 叶剑武

Merge branch 'change_profiling_macro_to_env_var' into 'master'

change profiling macro to environment variable

See merge request !215
...@@ -24,14 +24,6 @@ config_setting( ...@@ -24,14 +24,6 @@ config_setting(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
config_setting(
name = "profiling_enabled",
define_values = {
"profiling": "true",
},
visibility = ["//visibility:public"],
)
config_setting( config_setting(
name = "production_mode", name = "production_mode",
define_values = { define_values = {
......
...@@ -10,7 +10,6 @@ licenses(["notice"]) # Apache 2.0 ...@@ -10,7 +10,6 @@ licenses(["notice"]) # Apache 2.0
load( load(
"//mace:mace.bzl", "//mace:mace.bzl",
"if_android", "if_android",
"if_profiling_enabled",
"if_hexagon_enabled", "if_hexagon_enabled",
"if_not_hexagon_enabled", "if_not_hexagon_enabled",
"if_production_mode", "if_production_mode",
...@@ -43,7 +42,6 @@ cc_library( ...@@ -43,7 +42,6 @@ cc_library(
"runtime/opencl/*.h", "runtime/opencl/*.h",
"runtime/hexagon/*.h", "runtime/hexagon/*.h",
]), ]),
copts = if_profiling_enabled(["-DMACE_OPENCL_PROFILING"]) + if_hexagon_enabled(["-DMACE_HEXAGON_ENABLED"]),
linkopts = if_android([ linkopts = if_android([
"-pie", "-pie",
"-ldl", "-ldl",
......
...@@ -91,9 +91,11 @@ OpenCLRuntime::OpenCLRuntime() { ...@@ -91,9 +91,11 @@ OpenCLRuntime::OpenCLRuntime() {
cl_command_queue_properties properties = 0; cl_command_queue_properties properties = 0;
#ifdef MACE_OPENCL_PROFILING const char *profiling = getenv("MACE_OPENCL_PROFILING");
properties |= CL_QUEUE_PROFILING_ENABLE; if (Tuner<uint32_t>::Get()->IsTuning() ||
#endif (profiling != nullptr && strlen(profiling) == 1 && profiling[0] == '1')) {
properties |= CL_QUEUE_PROFILING_ENABLE;
}
// a context is like a "runtime link" to the device and platform; // a context is like a "runtime link" to the device and platform;
// i.e. communication is possible // i.e. communication is possible
......
...@@ -24,12 +24,6 @@ def if_android_arm64(a): ...@@ -24,12 +24,6 @@ def if_android_arm64(a):
"//conditions:default": [], "//conditions:default": [],
}) })
def if_profiling_enabled(a):
return select({
"//mace:profiling_enabled": a,
"//conditions:default": [],
})
def if_production_mode(a): def if_production_mode(a):
return select({ return select({
"//mace:production_mode": a, "//mace:production_mode": a,
......
...@@ -22,7 +22,7 @@ ANDROID_ABI=arm64-v8a ...@@ -22,7 +22,7 @@ ANDROID_ABI=arm64-v8a
ANDROID_ABI=armeabi-v7a ANDROID_ABI=armeabi-v7a
STRIP="--strip always" STRIP="--strip always"
VLOG_LEVEL=0 VLOG_LEVEL=0
PROFILINE="--define profiling=true" PROFILING="1"
echo "Step 1: Generate encrypted opencl source" echo "Step 1: Generate encrypted opencl source"
python mace/python/tools/encrypt_opencl_codegen.py \ python mace/python/tools/encrypt_opencl_codegen.py \
...@@ -58,5 +58,5 @@ for device in `adb devices | grep "^[A-Za-z0-9]\+[[:space:]]\+device$"| cut -f1` ...@@ -58,5 +58,5 @@ for device in `adb devices | grep "^[A-Za-z0-9]\+[[:space:]]\+device$"| cut -f1`
adb -s ${device} shell "mkdir -p $DEVICE_PATH" adb -s ${device} shell "mkdir -p $DEVICE_PATH"
adb -s ${device} shell "mkdir -p $DEVICE_PATH/cl" adb -s ${device} shell "mkdir -p $DEVICE_PATH/cl"
adb -s ${device} push $BAZEL_BIN_PATH/$BIN_NAME $DEVICE_PATH && \ adb -s ${device} push $BAZEL_BIN_PATH/$BIN_NAME $DEVICE_PATH && \
adb -s ${device} shell "MACE_KERNEL_PATH=$DEVICE_CL_PATH MACE_CPP_MIN_VLOG_LEVEL=$VLOG_LEVEL $DEVICE_PATH/$BIN_NAME $@" adb -s ${device} shell "MACE_OPENCL_PROFILING=$PROFILING MACE_KERNEL_PATH=$DEVICE_CL_PATH MACE_CPP_MIN_VLOG_LEVEL=$VLOG_LEVEL $DEVICE_PATH/$BIN_NAME $@"
done done
...@@ -5,7 +5,7 @@ Usage() { ...@@ -5,7 +5,7 @@ Usage() {
echo 'Usage: bash tools/validate_gcn.sh tools/gcn.config tf_model_path model_tag image_size runtime[gpu/dsp] [tuning]' echo 'Usage: bash tools/validate_gcn.sh tools/gcn.config tf_model_path model_tag image_size runtime[gpu/dsp] [tuning]'
} }
if [ $# -lt 4 ];then if [ $# -lt 5 ];then
Usage Usage
exit -1 exit -1
fi fi
...@@ -50,7 +50,6 @@ build_and_run() ...@@ -50,7 +50,6 @@ build_and_run()
fi fi
if [[ "${TUNING_OR_NOT}" != "0" && "$PRODUCTION_MODE" != true ]];then if [[ "${TUNING_OR_NOT}" != "0" && "$PRODUCTION_MODE" != true ]];then
TUNING_MODE_BUILD_FLAGS="--define profiling=true"
tuning_flag=1 tuning_flag=1
round=0 # only warm up round=0 # only warm up
else else
...@@ -68,7 +67,7 @@ build_and_run() ...@@ -68,7 +67,7 @@ build_and_run()
--copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \ --copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \
--copt="-DMACE_OBFUSCATE_LITERALS" \ --copt="-DMACE_OBFUSCATE_LITERALS" \
$PRODUCTION_MODE_BUILD_FLAGS \ $PRODUCTION_MODE_BUILD_FLAGS \
$TUNING_MODE_BUILD_FLAGS --define hexagon=true || exit -1 --define hexagon=true || exit -1
adb shell "mkdir -p ${PHONE_DATA_DIR}" || exit -1 adb shell "mkdir -p ${PHONE_DATA_DIR}" || exit -1
if [ "$PRODUCTION_MODE" = false ]; then if [ "$PRODUCTION_MODE" = false ]; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册