From 33310ee83aee88a9adf60ff363b241addd3fea4e Mon Sep 17 00:00:00 2001 From: yejianwu Date: Wed, 3 Jan 2018 16:55:14 +0800 Subject: [PATCH] update opencl linkage lib --- mace/codegen/BUILD | 18 +++++++-------- mace/core/BUILD | 22 +++++++++++++++++++ .../runtime/opencl/opencl_binary_linkage.cc} | 0 .../runtime/opencl/opencl_source_linkage.cc} | 0 tools/validate_gcn.sh | 2 -- 5 files changed, 30 insertions(+), 12 deletions(-) rename mace/{codegen/distribute/use_binary.cc => core/runtime/opencl/opencl_binary_linkage.cc} (100%) rename mace/{codegen/distribute/use_source.cc => core/runtime/opencl/opencl_source_linkage.cc} (100%) diff --git a/mace/codegen/BUILD b/mace/codegen/BUILD index e22741c1..fbb351d5 100644 --- a/mace/codegen/BUILD +++ b/mace/codegen/BUILD @@ -15,27 +15,25 @@ cc_library( deps = [ "//mace/core", "//mace/ops", - "//mace/codegen:distribute_lib", + ] + if_embed_binary_program(["//mace/core:opencl_binary_linkage"]) + + if_use_source_program(["//mace/core:opencl_source_linkage"]) + [ "//mace/codegen:version_lib", - "//mace/codegen:generated_opencl_lib", + "//mace/codegen:generated_opencl_source_lib", + "//mace/codegen:generated_opencl_compiled_lib", "//mace/codegen:generated_tuning_lib", ], ) cc_library( - name = "distribute_lib", - srcs = if_embed_binary_program(["distribute/use_binary.cc"]) + - if_use_source_program(["distribute/use_source.cc"]), + name = "generated_opencl_source_lib", + srcs = glob(["opencl/opencl_encrypt_program.cc"]), copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, - deps = [ - "//mace/core", - ], ) cc_library( - name = "generated_opencl_lib", - srcs = glob(["opencl/*.cc"]), + name = "generated_opencl_compiled_lib", + srcs = glob(["opencl/opencl_compiled_program.cc"]), copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], linkstatic = 1, ) diff --git a/mace/core/BUILD b/mace/core/BUILD index abf4cd4e..59ed8b83 100644 --- a/mace/core/BUILD +++ b/mace/core/BUILD @@ -14,6 +14,8 @@ cc_library( srcs = glob([ "*.cc", "runtime/opencl/*.cc", + ], exclude=["runtime/opencl/opencl_binary_linkage.cc", + "runtime/opencl/opencl_source_linkage.cc", ]), hdrs = glob([ "*.h", @@ -49,3 +51,23 @@ cc_library( "//mace/utils:utils_hdrs", ], ) + +cc_library( + name = "opencl_source_linkage", + srcs = ["runtime/opencl/opencl_source_linkage.cc"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], + linkstatic = 1, + deps = [ + ":core", + ], +) + +cc_library( + name = "opencl_binary_linkage", + srcs = ["runtime/opencl/opencl_binary_linkage.cc"], + copts = ["-std=c++11", "-D_GLIBCXX_USE_C99_MATH_TR1", "-Werror=return-type"], + linkstatic = 1, + deps = [ + ":core", + ], +) diff --git a/mace/codegen/distribute/use_binary.cc b/mace/core/runtime/opencl/opencl_binary_linkage.cc similarity index 100% rename from mace/codegen/distribute/use_binary.cc rename to mace/core/runtime/opencl/opencl_binary_linkage.cc diff --git a/mace/codegen/distribute/use_source.cc b/mace/core/runtime/opencl/opencl_source_linkage.cc similarity index 100% rename from mace/codegen/distribute/use_source.cc rename to mace/core/runtime/opencl/opencl_source_linkage.cc diff --git a/tools/validate_gcn.sh b/tools/validate_gcn.sh index b3ed6006..ba6b1930 100644 --- a/tools/validate_gcn.sh +++ b/tools/validate_gcn.sh @@ -115,8 +115,6 @@ build_and_run false echo "Step 6: Generate OpenCL binary program and config code" rm -rf ${CL_BIN_DIR} adb pull ${KERNEL_DIR} ${CL_BIN_DIR} -rm -rf ${CL_CODEGEN_DIR} -mkdir -p ${CL_CODEGEN_DIR} python mace/python/tools/opencl_codegen.py \ --cl_binary_dir=${CL_BIN_DIR} --output_path=${CL_CODEGEN_DIR}/opencl_compiled_program.cc -- GitLab