diff --git a/.gitignore b/.gitignore index b3a51dd83dbcba3ce393e112b6df5fb02310ba4a..c78b060c4a06e8597917b39f67d90fb53f466a29 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ cmake-build-debug/ mace/codegen/models/ mace/codegen/opencl/ mace/codegen/opencl_bin/ +mace/codegen/tuning/ mace/codegen/version/ build/ diff --git a/mace/core/file_storage_engine.cc b/mace/core/file_storage_engine.cc index 9cb53cf245b49a963de8b3a6bcb8a5934a0590b3..a3cd12f180875d885a49f7057ebe3e195e19c545 100644 --- a/mace/core/file_storage_engine.cc +++ b/mace/core/file_storage_engine.cc @@ -10,10 +10,11 @@ namespace mace { -std::string FileStorageEngine::kStoragePath = "/data/local/tmp"; +std::string FileStorageEngine::kStoragePath // NOLINT(runtime/string) + = "/data/local/tmp"; FileStorageEngine::FileStorageEngine(const std::string &file_name): - file_name_(file_name){} + file_name_(file_name) {} void FileStorageEngine::Write( const std::map> &data) { @@ -25,7 +26,7 @@ void FileStorageEngine::Write( int64_t data_size = data.size(); ofs.write(reinterpret_cast(&data_size), sizeof(data_size)); - for (auto &kv: data) { + for (auto &kv : data) { int32_t key_size = static_cast(kv.first.size()); ofs.write(reinterpret_cast(&key_size), sizeof(key_size)); ofs.write(kv.first.c_str(), key_size); diff --git a/mace/core/file_storage_engine.h b/mace/core/file_storage_engine.h index f54071fc75842a1eec6f78eb382e598e741a674b..9ce742a4d2cdeabb79c04549a3fd8a8969f1b715 100644 --- a/mace/core/file_storage_engine.h +++ b/mace/core/file_storage_engine.h @@ -15,7 +15,7 @@ namespace mace { class FileStorageEngine : public KVStorageEngine { public: - FileStorageEngine(const std::string &file_name); + explicit FileStorageEngine(const std::string &file_name); public: void Write( const std::map> &data) override; diff --git a/mace/core/runtime/opencl/opencl_runtime.cc b/mace/core/runtime/opencl/opencl_runtime.cc index 5b9d3d45fd26a0d6cabe0e833c4ecdae238872a6..89db2e9b03141518c76f0703df231da4049ac30c 100644 --- a/mace/core/runtime/opencl/opencl_runtime.cc +++ b/mace/core/runtime/opencl/opencl_runtime.cc @@ -10,6 +10,7 @@ #include // NOLINT(build/c++11) #include #include +#include #include "mace/core/file_storage_engine.h" #include "mace/core/runtime/opencl/opencl_extension.h" @@ -453,7 +454,7 @@ void OpenCLRuntime::BuildProgramFromSource( this->program_content_map_.emplace(built_program_key, content); this->program_map_changed = true; - VLOG(3) << "Program from source: " << built_program_key ; + VLOG(3) << "Program from source: " << built_program_key; } } @@ -477,7 +478,6 @@ void OpenCLRuntime::BuildProgram(const std::string &program_name, build_options_str, program); } } - } cl::Kernel OpenCLRuntime::BuildKernel( diff --git a/mace/core/runtime/opencl/opencl_runtime.h b/mace/core/runtime/opencl/opencl_runtime.h index b38c0b3a3f472238e3b29a506e93c8aecadc0ba8..d0a509328e149a174c9176122e1259a8a8e82b22 100644 --- a/mace/core/runtime/opencl/opencl_runtime.h +++ b/mace/core/runtime/opencl/opencl_runtime.h @@ -10,6 +10,7 @@ #include // NOLINT(build/c++11) #include #include +#include #include "mace/core/future.h" #include "mace/core/runtime/opencl/cl2_header.h" diff --git a/mace/utils/utils.h b/mace/utils/utils.h index 4fe463757285a78940607faf2ea3a1a6404d1246..a9ca2a40aae252c10ce96d5968987b68af9894ea 100644 --- a/mace/utils/utils.h +++ b/mace/utils/utils.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace mace { template diff --git a/tools/generate_opencl_code.sh b/tools/generate_opencl_code.sh index 69f5ce5a5deb23356407934b60efc58878f2ab79..381ce19df27a77c017adc03818cd887f68c6696d 100644 --- a/tools/generate_opencl_code.sh +++ b/tools/generate_opencl_code.sh @@ -17,6 +17,8 @@ TARGET_SOC=$2 CL_BIN_DIRS=$3 PULL_OR_NOT=$4 +mkdir -p ${CL_CODEGEN_DIR} + if [ x"$TYPE" == x"source" ];then python mace/python/tools/encrypt_opencl_codegen.py \ --cl_kernel_dir=./mace/kernels/opencl/cl/ \ diff --git a/tools/generate_tuning_param_code.sh b/tools/generate_tuning_param_code.sh index 353ebc607abdcce0583c25c249107f465af5dbf1..11d250e40cc5ce394b19f9749ab54c962b23f963 100644 --- a/tools/generate_tuning_param_code.sh +++ b/tools/generate_tuning_param_code.sh @@ -3,6 +3,8 @@ CURRENT_DIR=`dirname $0` source ${CURRENT_DIR}/env.sh +mkdir -p ${TUNING_CODEGEN_DIR} + if [ "$#" -eq "0" ]; then python mace/python/tools/binary_codegen.py \ --binary_file_name=mace_run.config \ diff --git a/tools/sh_commands.py b/tools/sh_commands.py index ed5ba51f85c0dcd7c78e969e8d359fd043536ac4..c0742c5d32274e1f56c82a43efd2c2961e704b81 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -128,6 +128,7 @@ def bazel_target_to_bin(target): ################################ # TODO this should be refactored def gen_encrypted_opencl_source(codegen_path="mace/codegen"): + sh.mkdir("-p", "%s/opencl" % codegen_path) sh.python("mace/python/tools/encrypt_opencl_codegen.py", "--cl_kernel_dir=./mace/kernels/opencl/cl/", "--output_path=%s/opencl/opencl_encrypt_program.cc" % codegen_path) @@ -138,6 +139,7 @@ def gen_mace_version(codegen_path="mace/codegen"): "%s/version/version.cc" % codegen_path) def gen_compiled_opencl_source(codegen_path="mace/codegen"): + sh.mkdir("-p", "%s/opencl" % codegen_path) sh.python("mace/python/tools/opencl_codegen.py", "--output_path=%s/opencl/opencl_compiled_program.cc" % codegen_path)