rename and change lib c++_static to c++_shared

pull/7712/head
yeyunpeng 4 years ago
parent c5867d2d7e
commit 7945bbf9f2

@ -115,6 +115,7 @@ checkopts()
ENABLE_CONVERTER="on"
LITE_LANGUAGE="cpp"
ENABLE_GITEE="off"
ANDROID_STL="c++_shared"
# Process the options
while getopts 'drvj:c:t:hsb:a:g:p:ie:m:l:I:LRP:D:zM:V:K:swB:En:T:A:C:o:S:' opt
@ -313,9 +314,11 @@ checkopts()
COMPILE_LITE="on"
if [[ "$OPTARG" == "cpp" ]]; then
LITE_LANGUAGE="cpp"
ANDROID_STL="c++_shared"
elif [[ "$OPTARG" == "java" ]]; then
LITE_LANGUAGE="java"
ENABLE_CONVERTER="off"
ANDROID_STL="c++_static"
elif [[ "$OPTARG" == "object-c" ]]; then
LITE_LANGUAGE="object-c"
else
@ -669,7 +672,7 @@ build_lite()
checkndk
cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \
-DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="arm64-v8a" -DANDROID_TOOLCHAIN_NAME="aarch64-linux-android-clang" \
-DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
-DANDROID_STL=${ANDROID_STL} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
-DPLATFORM_ARM64=on -DENABLE_NEON=on -DENABLE_FP16="off" \
-DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} -DBUILD_TESTCASES=${RUN_TESTCASES} \
-DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \
@ -680,7 +683,7 @@ build_lite()
checkndk
cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \
-DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="armeabi-v7a" -DANDROID_TOOLCHAIN_NAME="clang" \
-DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DANDROID_STL=${ANDROID_STL} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DPLATFORM_ARM32=on -DENABLE_NEON=on -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
-DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} -DBUILD_TESTCASES=${RUN_TESTCASES} \
-DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "nnacl/int8/common_func.h"
#include "nnacl/int8/common_func_int8.h"
#include "nnacl/quantization/fixed_point.h"
void PostConvFuncCommInt8(const int32_t *in, int8_t *out, const int32_t *bias, size_t oc, size_t plane,

@ -17,7 +17,7 @@
#include "nnacl/int8/conv_depthwise_int8.h"
#include <string.h>
#include "nnacl/quantization/fixed_point.h"
#include "nnacl/int8/common_func.h"
#include "nnacl/int8/common_func_int8.h"
/*conv depthwise int8 begin*/
#ifndef ENABLE_ARM

@ -17,7 +17,7 @@
#include "nnacl/int8/conv_int8.h"
#include <string.h>
#include "nnacl/winograd_transform.h"
#include "nnacl/int8/common_func.h"
#include "nnacl/int8/common_func_int8.h"
void Conv3x3Int8Gemm(int32_t *dst, const int16_t *src, const int16_t *weight, int oc, int ic8, size_t real_cal_num) {
int oc4 = UP_DIV(oc, C4NUM);

@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "nnacl/int8/deconv.h"
#include "nnacl/int8/deconv_int8.h"
#include "nnacl/int8/matmul_int8.h"
#include "nnacl/int8/common_func.h"
#include "nnacl/int8/common_func_int8.h"
int DeConvPostInt8C8(const int32_t *src, const int32_t *bias, int32_t *tmp, int8_t *out, int output_channel,
ConvParameter *conv_param) {
/* row8x8-major(ih*iw x oc*kh*kw) -> row8-major(oh*ow x oc) */

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "nnacl/int8/pad.h"
#include "nnacl/int8/pad_int8.h"
#include "nnacl/common_func.h"
#include "nnacl/errorcode.h"

@ -15,7 +15,7 @@
*/
#include <math.h>
#include "nnacl/int8/quant_dtype_cast.h"
#include "nnacl/int8/quant_dtype_cast_int8.h"
#include "nnacl/errorcode.h"
int DoDequantizeInt8ToFp32(int8_t *quant_values, float *real_values, float scale, int32_t zp, int size) {

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <math.h>
#include "nnacl/int8/resize.h"
#include "nnacl/int8/resize_int8.h"
#include "nnacl/common_func.h"
#include "nnacl/quantization/fixed_point.h"
#include "nnacl/errorcode.h"

@ -0,0 +1,37 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/ops/add.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "nnacl/arithmetic_common.h"
#include "src/ops/populate/arithmetic_populate.h"
namespace mindspore {
namespace lite {
OpParameter *PopulateAddParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Add *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
Registry AddParameterRegistry(schema::PrimitiveType_Add, PopulateAddParameter);
} // namespace lite
} // namespace mindspore

@ -13,13 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/ops/populate/arithmetic_populate.h"
#include "src/ops/arithmetic.h"
#include "src/ops/add.h"
#include "src/ops/sub.h"
#include "src/ops/mul.h"
#include "src/ops/div.h"
#include "src/ops/eltwise.h"
#include "src/ops/greater_equal.h"
#include "src/common/log_adapter.h"
#include "src/tensor.h"
#include "src/ops/primitive_c.h"
@ -27,6 +23,7 @@
namespace mindspore {
namespace lite {
ArithmeticParameter *PopulateArithmeticCommonPara(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = reinterpret_cast<ArithmeticParameter *>(malloc(sizeof(ArithmeticParameter)));
if (param == nullptr) {
@ -57,70 +54,6 @@ OpParameter *PopulateArithmetic(const mindspore::lite::PrimitiveC *primitive) {
return reinterpret_cast<OpParameter *>(param);
}
OpParameter *PopulateAddParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Add *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
OpParameter *PopulateSubParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Sub *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
OpParameter *PopulateMulParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Mul *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
OpParameter *PopulateDivParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Div *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
OpParameter *PopulateEltwiseParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
auto eltwise = reinterpret_cast<const mindspore::lite::Eltwise *>(primitive);
switch (eltwise->GetMode()) {
case schema::EltwiseMode_PROD:
param->op_parameter_.type_ = schema::PrimitiveType_Mul;
break;
case schema::EltwiseMode_SUM:
param->op_parameter_.type_ = schema::PrimitiveType_Add;
break;
case schema::EltwiseMode_MAXIMUM:
param->op_parameter_.type_ = schema::PrimitiveType_Maximum;
break;
default:
free(param);
return nullptr;
}
return reinterpret_cast<OpParameter *>(param);
}
Registry RealDivParameterRegistry(schema::PrimitiveType_RealDiv, PopulateArithmetic);
Registry LogicalAndParameterRegistry(schema::PrimitiveType_LogicalAnd, PopulateArithmetic);
Registry ParameterRegistry(schema::PrimitiveType_LogicalOr, PopulateArithmetic);
@ -135,10 +68,5 @@ Registry MinimumParameterRegistry(schema::PrimitiveType_Minimum, PopulateArithme
Registry FloorDivParameterRegistry(schema::PrimitiveType_FloorDiv, PopulateArithmetic);
Registry FloorModParameterRegistry(schema::PrimitiveType_FloorMod, PopulateArithmetic);
Registry SquaredDifferenceParameterRegistry(schema::PrimitiveType_SquaredDifference, PopulateArithmetic);
Registry AddParameterRegistry(schema::PrimitiveType_Add, PopulateAddParameter);
Registry SubParameterRegistry(schema::PrimitiveType_Sub, PopulateSubParameter);
Registry MulParameterRegistry(schema::PrimitiveType_Mul, PopulateMulParameter);
Registry DivParameterRegistry(schema::PrimitiveType_Div, PopulateDivParameter);
Registry EltwiseParameterRegistry(schema::PrimitiveType_Eltwise, PopulateEltwiseParameter);
} // namespace lite
} // namespace mindspore

@ -0,0 +1,23 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/ops/arithmetic.h"
namespace mindspore {
namespace lite {
ArithmeticParameter *PopulateArithmeticCommonPara(const mindspore::lite::PrimitiveC *primitive);
} // namespace lite
} // namespace mindspore

@ -0,0 +1,37 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/ops/div.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "src/ops/populate/arithmetic_populate.h"
namespace mindspore {
namespace lite {
OpParameter *PopulateDivParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Div *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
Registry DivParameterRegistry(schema::PrimitiveType_Div, PopulateDivParameter);
} // namespace lite
} // namespace mindspore

@ -0,0 +1,52 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/ops/div.h"
#include "src/ops/eltwise.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "src/ops/populate/arithmetic_populate.h"
namespace mindspore {
namespace lite {
OpParameter *PopulateEltwiseParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
auto eltwise = reinterpret_cast<const mindspore::lite::Eltwise *>(primitive);
switch (eltwise->GetMode()) {
case schema::EltwiseMode_PROD:
param->op_parameter_.type_ = schema::PrimitiveType_Mul;
break;
case schema::EltwiseMode_SUM:
param->op_parameter_.type_ = schema::PrimitiveType_Add;
break;
case schema::EltwiseMode_MAXIMUM:
param->op_parameter_.type_ = schema::PrimitiveType_Maximum;
break;
default:
free(param);
return nullptr;
}
return reinterpret_cast<OpParameter *>(param);
}
Registry EltwiseParameterRegistry(schema::PrimitiveType_Eltwise, PopulateEltwiseParameter);
} // namespace lite
} // namespace mindspore

@ -0,0 +1,39 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/ops/mul.h"
#include "nnacl/arithmetic_common.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "src/ops/populate/arithmetic_populate.h"
namespace mindspore {
namespace lite {
OpParameter *PopulateMulParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Mul *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
Registry MulParameterRegistry(schema::PrimitiveType_Mul, PopulateMulParameter);
} // namespace lite
} // namespace mindspore

@ -17,7 +17,7 @@
#include "src/ops/quant_dtype_cast.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "nnacl/int8/quant_dtype_cast.h"
#include "nnacl/int8/quant_dtype_cast_int8.h"
namespace mindspore {
namespace lite {

@ -0,0 +1,39 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/ops/sub.h"
#include "src/ops/primitive_c.h"
#include "src/ops/populate/populate_register.h"
#include "nnacl/arithmetic_common.h"
#include "src/ops/populate/arithmetic_populate.h"
namespace mindspore {
namespace lite {
OpParameter *PopulateSubParameter(const mindspore::lite::PrimitiveC *primitive) {
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
if (param == nullptr) {
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
return nullptr;
}
param->activation_type_ = reinterpret_cast<const mindspore::lite::Sub *>(primitive)->GetActivationType();
return reinterpret_cast<OpParameter *>(param);
}
Registry SubParameterRegistry(schema::PrimitiveType_Sub, PopulateSubParameter);
} // namespace lite
} // namespace mindspore

@ -18,7 +18,7 @@
#include "schema/model_generated.h"
#include "src/kernel_registry.h"
#include "include/errorcode.h"
#include "nnacl/int8/quant_dtype_cast.h"
#include "nnacl/int8/quant_dtype_cast_int8.h"
using mindspore::kernel::KERNEL_ARCH::kCPU;
using mindspore::lite::RET_ERROR;

@ -15,7 +15,7 @@
*/
#include "src/runtime/kernel/arm/base/quant_dtype_cast.h"
#include <vector>
#include "nnacl/int8/quant_dtype_cast.h"
#include "nnacl/int8/quant_dtype_cast_int8.h"
#include "src/runtime/runtime_api.h"
#include "src/kernel_registry.h"
#include "schema/model_generated.h"

@ -15,7 +15,7 @@
*/
#include "src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.h"
#include <vector>
#include "nnacl/int8/quant_dtype_cast.h"
#include "nnacl/int8/quant_dtype_cast_int8.h"
#include "nnacl/fp16/quant_dtype_cast_fp16.h"
#include "src/runtime/runtime_api.h"
#include "src/kernel_registry.h"

@ -18,7 +18,7 @@
#include "schema/model_generated.h"
#include "src/kernel_registry.h"
#include "include/errorcode.h"
#include "nnacl/int8/quant_dtype_cast.h"
#include "nnacl/int8/quant_dtype_cast_int8.h"
using mindspore::lite::KernelRegistrar;
using mindspore::lite::RET_ERROR;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save