diff --git a/mace/codegen/BUILD b/mace/codegen/BUILD index e22741c10c78a4aba66619b59597fd8f8c86fd30..fbb351d5003cdfd2a20fdd54b65c0634d7188e8a 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 abf4cd4ef9ddd7172670544d751242e7e023f0b6..59ed8b83260e1be7b4fcbeafc45816fa50ee668b 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 b3ed6006724e3c9060eaa1d92f7b794373cf235f..ba6b1930efe5afb15713857d952a141754c4d349 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