提交 c796c29b 编写于 作者: Y yejianwu

fix protobuf version conflict with os (remove unnecessary symbols)

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