提交 75f6240b 编写于 作者: L Liangliang He

Merge branch 'fix_protobuf_conflict_with_os' into 'master'

fix protobuf version conflict with libandroid (remove unnecessary symbols)

See merge request !634
...@@ -2,13 +2,15 @@ mace { ...@@ -2,13 +2,15 @@ mace {
global: global:
*MaceTensor*; *MaceTensor*;
*MaceEngine*; *MaceEngine*;
*MaceVersion*; *CreateMaceEngineFromProto*;
*SetOpenMPThreadPolicy*;
*SetGPUHints*;
*SetOpenCLBinaryPaths*;
*FileStorageFactory*; *FileStorageFactory*;
*SetKVStorageFactory*; *SetKVStorageFactory*;
*CreateMaceEngineFromProto*; *SetOpenCLBinaryPaths*;
*SetGPUHints*;
*SetOpenMPThreadPolicy*;
*SetOpenMPThreadAffinity*;
*GetBigLittleCoreIDs*;
*MaceVersion*;
local: local:
*; *;
}; };
...@@ -74,7 +74,7 @@ enum MaceStatus { ...@@ -74,7 +74,7 @@ enum MaceStatus {
} }
// MACE input/output tensor // MACE input/output tensor
class MaceTensor { class __attribute__((visibility("default"))) MaceTensor {
public: public:
// shape - the shape of the tensor, with size n // shape - the shape of the tensor, with size n
// data - the buffer of the tensor, must not be null with size equals // data - the buffer of the tensor, must not be null with size equals
...@@ -97,7 +97,7 @@ class MaceTensor { ...@@ -97,7 +97,7 @@ class MaceTensor {
std::unique_ptr<Impl> impl_; std::unique_ptr<Impl> impl_;
}; };
class MaceEngine { class __attribute__((visibility("default"))) MaceEngine {
public: public:
explicit MaceEngine(DeviceType device_type); explicit MaceEngine(DeviceType device_type);
~MaceEngine(); ~MaceEngine();
...@@ -127,6 +127,7 @@ class MaceEngine { ...@@ -127,6 +127,7 @@ class MaceEngine {
MaceEngine &operator=(const MaceEngine &) = delete; MaceEngine &operator=(const MaceEngine &) = delete;
}; };
__attribute__((visibility("default")))
MaceStatus CreateMaceEngineFromProto( MaceStatus CreateMaceEngineFromProto(
const std::vector<unsigned char> &model_pb, const std::vector<unsigned char> &model_pb,
const std::string &model_data_file, const std::string &model_data_file,
......
...@@ -63,7 +63,8 @@ class KVStorageFactory { ...@@ -63,7 +63,8 @@ class KVStorageFactory {
virtual std::unique_ptr<KVStorage> CreateStorage(const std::string &name) = 0; virtual std::unique_ptr<KVStorage> CreateStorage(const std::string &name) = 0;
}; };
class FileStorageFactory : public KVStorageFactory { class __attribute__((visibility("default"))) FileStorageFactory
: public KVStorageFactory {
public: public:
explicit FileStorageFactory(const std::string &path); explicit FileStorageFactory(const std::string &path);
...@@ -77,6 +78,7 @@ class FileStorageFactory : public KVStorageFactory { ...@@ -77,6 +78,7 @@ class FileStorageFactory : public KVStorageFactory {
}; };
// Set KV store factory used as OpenCL cache. (Call Once) // Set KV store factory used as OpenCL cache. (Call Once)
__attribute__((visibility("default")))
void SetKVStorageFactory(std::shared_ptr<KVStorageFactory> storage_factory); void SetKVStorageFactory(std::shared_ptr<KVStorageFactory> storage_factory);
// Just call once. (Not thread-safe) // Just call once. (Not thread-safe)
...@@ -85,11 +87,13 @@ void SetKVStorageFactory(std::shared_ptr<KVStorageFactory> storage_factory); ...@@ -85,11 +87,13 @@ void SetKVStorageFactory(std::shared_ptr<KVStorageFactory> storage_factory);
// Using OpenCL binary will speed up the initialization. // Using OpenCL binary will speed up the initialization.
// OpenCL binary is corresponding to the OpenCL Driver version, // OpenCL binary is corresponding to the OpenCL Driver version,
// you should update the binary when OpenCL Driver changed. // you should update the binary when OpenCL Driver changed.
__attribute__((visibility("default")))
void SetOpenCLBinaryPaths(const std::vector<std::string> &paths); void SetOpenCLBinaryPaths(const std::vector<std::string> &paths);
// Set GPU hints, currently only supports Adreno GPU. // Set GPU hints, currently only supports Adreno GPU.
// //
// Caution: this function may hurt performance if improper parameters provided. // Caution: this function may hurt performance if improper parameters provided.
__attribute__((visibility("default")))
void SetGPUHints(GPUPerfHint perf_hint, GPUPriorityHint priority_hint); void SetGPUHints(GPUPerfHint perf_hint, GPUPriorityHint priority_hint);
// Set OpenMP threads number and affinity policy. // Set OpenMP threads number and affinity policy.
...@@ -109,6 +113,7 @@ void SetGPUHints(GPUPerfHint perf_hint, GPUPriorityHint priority_hint); ...@@ -109,6 +113,7 @@ void SetGPUHints(GPUPerfHint perf_hint, GPUPriorityHint priority_hint);
// If successful, it returns MACE_SUCCESS and error if it can't reliabley // If successful, it returns MACE_SUCCESS and error if it can't reliabley
// detect big-LITTLE cores (see GetBigLittleCoreIDs). In such cases, it's // detect big-LITTLE cores (see GetBigLittleCoreIDs). In such cases, it's
// suggested to use AFFINITY_NONE to use all cores. // suggested to use AFFINITY_NONE to use all cores.
__attribute__((visibility("default")))
MaceStatus SetOpenMPThreadPolicy(int num_threads_hint, MaceStatus SetOpenMPThreadPolicy(int num_threads_hint,
CPUAffinityPolicy policy); CPUAffinityPolicy policy);
...@@ -119,6 +124,7 @@ MaceStatus SetOpenMPThreadPolicy(int num_threads_hint, ...@@ -119,6 +124,7 @@ MaceStatus SetOpenMPThreadPolicy(int num_threads_hint,
// This function may not work well on some chips (e.g. MTK). Setting thread // This function may not work well on some chips (e.g. MTK). Setting thread
// affinity to offline cores may run very slow or unexpectedly. In such cases, // affinity to offline cores may run very slow or unexpectedly. In such cases,
// please use SetOpenMPThreadPolicy with default policy instead. // please use SetOpenMPThreadPolicy with default policy instead.
__attribute__((visibility("default")))
void SetOpenMPThreadAffinity(int num_threads, const std::vector<int> &cpu_ids); void SetOpenMPThreadAffinity(int num_threads, const std::vector<int> &cpu_ids);
// Get ARM big.LITTLE configuration. // Get ARM big.LITTLE configuration.
...@@ -130,6 +136,7 @@ void SetOpenMPThreadAffinity(int num_threads, const std::vector<int> &cpu_ids); ...@@ -130,6 +136,7 @@ void SetOpenMPThreadAffinity(int num_threads, const std::vector<int> &cpu_ids);
// //
// If successful, it returns MACE_SUCCESS and error if it can't reliabley // If successful, it returns MACE_SUCCESS and error if it can't reliabley
// detect the frequency of big-LITTLE cores (e.g. MTK). // detect the frequency of big-LITTLE cores (e.g. MTK).
__attribute__((visibility("default")))
MaceStatus GetBigLittleCoreIDs(std::vector<int> *big_core_ids, MaceStatus GetBigLittleCoreIDs(std::vector<int> *big_core_ids,
std::vector<int> *little_core_ids); std::vector<int> *little_core_ids);
......
...@@ -45,6 +45,7 @@ cat <<EOF > ${OUTPUT_FILENAME} ...@@ -45,6 +45,7 @@ cat <<EOF > ${OUTPUT_FILENAME}
// This is a generated file. DO NOT EDIT! // This is a generated file. DO NOT EDIT!
namespace mace { namespace mace {
__attribute__((visibility ("default")))
const char *MaceVersion() { return "MACEVER-${GIT_VERSION}" + 8; } const char *MaceVersion() { return "MACEVER-${GIT_VERSION}" + 8; }
} // namespace mace } // namespace mace
EOF EOF
...@@ -22,6 +22,7 @@ build:optimization --linkopt=-Wl,--strip-all ...@@ -22,6 +22,7 @@ build:optimization --linkopt=-Wl,--strip-all
build:optimization --copt=-ffunction-sections build:optimization --copt=-ffunction-sections
build:optimization --copt=-fdata-sections build:optimization --copt=-fdata-sections
build:optimization --linkopt=-Wl,--gc-sections build:optimization --linkopt=-Wl,--gc-sections
build:optimization --copt=-fvisibility=hidden
# Address sanitizer # Address sanitizer
build:asan --strip=never build:asan --strip=never
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册