提交 2446ddfd 编写于 作者: L liuqi

Format codes.

上级 a2f2a3c6
...@@ -6,5 +6,6 @@ cmake-build-debug/ ...@@ -6,5 +6,6 @@ cmake-build-debug/
mace/codegen/models/ mace/codegen/models/
mace/codegen/opencl/ mace/codegen/opencl/
mace/codegen/opencl_bin/ mace/codegen/opencl_bin/
mace/codegen/tuning/
mace/codegen/version/ mace/codegen/version/
build/ build/
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
namespace mace { 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): FileStorageEngine::FileStorageEngine(const std::string &file_name):
file_name_(file_name){} file_name_(file_name) {}
void FileStorageEngine::Write( void FileStorageEngine::Write(
const std::map<std::string, std::vector<unsigned char>> &data) { const std::map<std::string, std::vector<unsigned char>> &data) {
...@@ -25,7 +26,7 @@ void FileStorageEngine::Write( ...@@ -25,7 +26,7 @@ void FileStorageEngine::Write(
int64_t data_size = data.size(); int64_t data_size = data.size();
ofs.write(reinterpret_cast<const char *>(&data_size), ofs.write(reinterpret_cast<const char *>(&data_size),
sizeof(data_size)); sizeof(data_size));
for (auto &kv: data) { for (auto &kv : data) {
int32_t key_size = static_cast<int32_t>(kv.first.size()); int32_t key_size = static_cast<int32_t>(kv.first.size());
ofs.write(reinterpret_cast<const char *>(&key_size), sizeof(key_size)); ofs.write(reinterpret_cast<const char *>(&key_size), sizeof(key_size));
ofs.write(kv.first.c_str(), key_size); ofs.write(kv.first.c_str(), key_size);
......
...@@ -15,7 +15,7 @@ namespace mace { ...@@ -15,7 +15,7 @@ namespace mace {
class FileStorageEngine : public KVStorageEngine { class FileStorageEngine : public KVStorageEngine {
public: public:
FileStorageEngine(const std::string &file_name); explicit FileStorageEngine(const std::string &file_name);
public: public:
void Write( void Write(
const std::map<std::string, std::vector<unsigned char>> &data) override; const std::map<std::string, std::vector<unsigned char>> &data) override;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <mutex> // NOLINT(build/c++11) #include <mutex> // NOLINT(build/c++11)
#include <string> #include <string>
#include <vector> #include <vector>
#include <utility>
#include "mace/core/file_storage_engine.h" #include "mace/core/file_storage_engine.h"
#include "mace/core/runtime/opencl/opencl_extension.h" #include "mace/core/runtime/opencl/opencl_extension.h"
...@@ -453,7 +454,7 @@ void OpenCLRuntime::BuildProgramFromSource( ...@@ -453,7 +454,7 @@ void OpenCLRuntime::BuildProgramFromSource(
this->program_content_map_.emplace(built_program_key, this->program_content_map_.emplace(built_program_key,
content); content);
this->program_map_changed = true; 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, ...@@ -477,7 +478,6 @@ void OpenCLRuntime::BuildProgram(const std::string &program_name,
build_options_str, program); build_options_str, program);
} }
} }
} }
cl::Kernel OpenCLRuntime::BuildKernel( cl::Kernel OpenCLRuntime::BuildKernel(
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <mutex> // NOLINT(build/c++11) #include <mutex> // NOLINT(build/c++11)
#include <set> #include <set>
#include <string> #include <string>
#include <vector>
#include "mace/core/future.h" #include "mace/core/future.h"
#include "mace/core/runtime/opencl/cl2_header.h" #include "mace/core/runtime/opencl/cl2_header.h"
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector>
namespace mace { namespace mace {
template <typename Integer> template <typename Integer>
......
...@@ -17,6 +17,8 @@ TARGET_SOC=$2 ...@@ -17,6 +17,8 @@ TARGET_SOC=$2
CL_BIN_DIRS=$3 CL_BIN_DIRS=$3
PULL_OR_NOT=$4 PULL_OR_NOT=$4
mkdir -p ${CL_CODEGEN_DIR}
if [ x"$TYPE" == x"source" ];then if [ x"$TYPE" == x"source" ];then
python mace/python/tools/encrypt_opencl_codegen.py \ python mace/python/tools/encrypt_opencl_codegen.py \
--cl_kernel_dir=./mace/kernels/opencl/cl/ \ --cl_kernel_dir=./mace/kernels/opencl/cl/ \
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
CURRENT_DIR=`dirname $0` CURRENT_DIR=`dirname $0`
source ${CURRENT_DIR}/env.sh source ${CURRENT_DIR}/env.sh
mkdir -p ${TUNING_CODEGEN_DIR}
if [ "$#" -eq "0" ]; then if [ "$#" -eq "0" ]; then
python mace/python/tools/binary_codegen.py \ python mace/python/tools/binary_codegen.py \
--binary_file_name=mace_run.config \ --binary_file_name=mace_run.config \
......
...@@ -128,6 +128,7 @@ def bazel_target_to_bin(target): ...@@ -128,6 +128,7 @@ def bazel_target_to_bin(target):
################################ ################################
# TODO this should be refactored # TODO this should be refactored
def gen_encrypted_opencl_source(codegen_path="mace/codegen"): 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", sh.python("mace/python/tools/encrypt_opencl_codegen.py",
"--cl_kernel_dir=./mace/kernels/opencl/cl/", "--cl_kernel_dir=./mace/kernels/opencl/cl/",
"--output_path=%s/opencl/opencl_encrypt_program.cc" % codegen_path) "--output_path=%s/opencl/opencl_encrypt_program.cc" % codegen_path)
...@@ -138,6 +139,7 @@ def gen_mace_version(codegen_path="mace/codegen"): ...@@ -138,6 +139,7 @@ def gen_mace_version(codegen_path="mace/codegen"):
"%s/version/version.cc" % codegen_path) "%s/version/version.cc" % codegen_path)
def gen_compiled_opencl_source(codegen_path="mace/codegen"): def gen_compiled_opencl_source(codegen_path="mace/codegen"):
sh.mkdir("-p", "%s/opencl" % codegen_path)
sh.python("mace/python/tools/opencl_codegen.py", sh.python("mace/python/tools/opencl_codegen.py",
"--output_path=%s/opencl/opencl_compiled_program.cc" % codegen_path) "--output_path=%s/opencl/opencl_compiled_program.cc" % codegen_path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册