Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
75813092
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
75813092
编写于
8月 22, 2020
作者:
W
wsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify the '-fvisibility' attribute of mindspore-lite project.
上级
33c7b492
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
108 addition
and
52 deletion
+108
-52
cmake/package_lite.cmake
cmake/package_lite.cmake
+8
-3
mindspore/lite/CMakeLists.txt
mindspore/lite/CMakeLists.txt
+3
-0
mindspore/lite/nnacl/CMakeLists.txt
mindspore/lite/nnacl/CMakeLists.txt
+41
-5
mindspore/lite/nnacl/fp16/reduce_fp16.c
mindspore/lite/nnacl/fp16/reduce_fp16.c
+1
-1
mindspore/lite/nnacl/fp16/reduce_fp16.h
mindspore/lite/nnacl/fp16/reduce_fp16.h
+1
-1
mindspore/lite/nnacl/int8/reduce_int8.c
mindspore/lite/nnacl/int8/reduce_int8.c
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_fp16.cc
...spore/lite/src/runtime/kernel/arm/fp16/arithmetic_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_1x1_fp16.cc
.../lite/src/runtime/kernel/arm/fp16/convolution_1x1_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_3x3_fp16.cc
.../lite/src/runtime/kernel/arm/fp16/convolution_3x3_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_fp16.cc
...src/runtime/kernel/arm/fp16/convolution_depthwise_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc
...pore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_sw_fp16.cc
...e/lite/src/runtime/kernel/arm/fp16/convolution_sw_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc
.../src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_depthwise_fp16.cc
...c/runtime/kernel/arm/fp16/deconvolution_depthwise_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_fp16.cc
...re/lite/src/runtime/kernel/arm/fp16/deconvolution_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/pooling_fp16.cc
mindspore/lite/src/runtime/kernel/arm/fp16/pooling_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/reduce_fp16.cc
mindspore/lite/src/runtime/kernel/arm/fp16/reduce_fp16.cc
+2
-2
mindspore/lite/src/runtime/kernel/arm/fp16/split_fp16.cc
mindspore/lite/src/runtime/kernel/arm/fp16/split_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp16/transpose_fp16.cc
mindspore/lite/src/runtime/kernel/arm/fp16/transpose_fp16.cc
+1
-1
mindspore/lite/src/runtime/kernel/arm/fp32/unstack.cc
mindspore/lite/src/runtime/kernel/arm/fp32/unstack.cc
+1
-1
mindspore/lite/test/CMakeLists.txt
mindspore/lite/test/CMakeLists.txt
+2
-2
mindspore/lite/test/run_benchmark_nets.sh
mindspore/lite/test/run_benchmark_nets.sh
+27
-19
mindspore/lite/tools/benchmark/CMakeLists.txt
mindspore/lite/tools/benchmark/CMakeLists.txt
+7
-3
mindspore/lite/tools/converter/CMakeLists.txt
mindspore/lite/tools/converter/CMakeLists.txt
+1
-1
mindspore/lite/tools/converter/quantizer/quantize_util.cc
mindspore/lite/tools/converter/quantizer/quantize_util.cc
+1
-1
未找到文件。
cmake/package_lite.cmake
浏览文件 @
75813092
...
...
@@ -7,7 +7,6 @@ set(OPENCV_DIR ${MAIN_DIR}/third_party/opencv)
set
(
PROTOBF_DIR
${
MAIN_DIR
}
/third_party/protobuf
)
set
(
FLATBF_DIR
${
MAIN_DIR
}
/third_party/flatbuffers
)
install
(
FILES
${
TOP_DIR
}
/mindspore/lite/build/src/libmindspore-lite.so DESTINATION
${
LIB_DIR
}
COMPONENT
${
COMPONENT_NAME
}
)
if
(
BUILD_MINDDATA
)
install
(
DIRECTORY
${
TOP_DIR
}
/mindspore/ccsrc/minddata/dataset/include/ DESTINATION
${
INC_DIR
}
COMPONENT
${
COMPONENT_NAME
}
FILES_MATCHING PATTERN
"*.h"
)
install
(
FILES
${
TOP_DIR
}
/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION
${
LIB_DIR
}
COMPONENT
${
COMPONENT_NAME
}
)
...
...
@@ -30,24 +29,30 @@ if (BUILD_MINDDATA)
endif
()
if
(
PLATFORM_ARM64
)
install
(
FILES
${
TOP_DIR
}
/mindspore/lite/build/src/libmindspore-lite.so DESTINATION
${
LIB_DIR
}
COMPONENT
${
COMPONENT_NAME
}
)
install
(
FILES
${
TOP_DIR
}
/mindspore/core/ir/dtype/type_id.h DESTINATION
${
INC_DIR
}
/ir/dtype COMPONENT
${
COMPONENT_NAME
}
)
install
(
DIRECTORY
${
TOP_DIR
}
/mindspore/lite/include/ DESTINATION
${
INC_DIR
}
COMPONENT
${
COMPONENT_NAME
}
FILES_MATCHING PATTERN
"*.h"
)
install
(
DIRECTORY
${
TOP_DIR
}
/mindspore/lite/schema/ DESTINATION
${
INC_DIR
}
/schema COMPONENT
${
COMPONENT_NAME
}
FILES_MATCHING PATTERN
"*.h"
PATTERN
"inner"
EXCLUDE
)
install
(
FILES
${
TOP_DIR
}
/mindspore/lite/build/nnacl/liboptimize.so DESTINATION
${
LIB_DIR
}
COMPONENT
${
COMPONENT_NAME
}
)
install
(
DIRECTORY
${
TOP_DIR
}
/third_party/flatbuffers/include DESTINATION
${
FLATBF_DIR
}
COMPONENT
${
COMPONENT_NAME
}
)
elseif
(
PLATFORM_ARM32
)
install
(
FILES
${
TOP_DIR
}
/mindspore/lite/build/src/libmindspore-lite.so DESTINATION
${
LIB_DIR
}
COMPONENT
${
COMPONENT_NAME
}
)
install
(
FILES
${
TOP_DIR
}
/mindspore/core/ir/dtype/type_id.h DESTINATION
${
INC_DIR
}
/ir/dtype COMPONENT
${
COMPONENT_NAME
}
)
install
(
DIRECTORY
${
TOP_DIR
}
/mindspore/lite/include/ DESTINATION
${
INC_DIR
}
COMPONENT
${
COMPONENT_NAME
}
FILES_MATCHING PATTERN
"*.h"
)
install
(
DIRECTORY
${
TOP_DIR
}
/mindspore/lite/schema/ DESTINATION
${
INC_DIR
}
/schema COMPONENT
${
COMPONENT_NAME
}
FILES_MATCHING PATTERN
"*.h"
PATTERN
"inner"
EXCLUDE
)
install
(
DIRECTORY
${
TOP_DIR
}
/third_party/flatbuffers/include DESTINATION
${
FLATBF_DIR
}
COMPONENT
${
COMPONENT_NAME
}
)
else
()
install
(
FILES
${
TOP_DIR
}
/mindspore/lite/build/src/libmindspore-lite.so DESTINATION
${
LIB_DIR
}
COMPONENT
${
RUN_X86_COMPONENT_NAME
}
)
install
(
FILES
${
TOP_DIR
}
/third_party/protobuf/build/lib/libprotobuf.so.19.0.0 DESTINATION
${
PROTOBF_DIR
}
/lib RENAME libprotobuf.so.19 COMPONENT
${
COMPONENT_NAME
}
)
endif
()
set
(
CPACK_GENERATOR TGZ
)
set
(
CPACK_ARCHIVE_COMPONENT_INSTALL ON
)
set
(
CPACK_COMPONENTS_ALL
${
COMPONENT_NAME
}
)
if
(
PLATFORM_ARM64 OR PLATFORM_ARM32
)
set
(
CPACK_COMPONENTS_ALL
${
COMPONENT_NAME
}
)
else
()
set
(
CPACK_COMPONENTS_ALL
${
COMPONENT_NAME
}
${
RUN_X86_COMPONENT_NAME
}
)
endif
()
set
(
CPACK_PACKAGE_FILE_NAME
${
MAIN_DIR
}
)
set
(
CPACK_PACKAGE_DIRECTORY
${
TOP_DIR
}
/output/tmp
)
set
(
CPACK_PACKAGE_CHECKSUM SHA256
)
...
...
mindspore/lite/CMakeLists.txt
浏览文件 @
75813092
...
...
@@ -28,6 +28,7 @@ elseif (PLATFORM_ARM32)
else
()
set
(
COMPONENT_NAME convert-ubuntu
)
endif
()
set
(
RUN_X86_COMPONENT_NAME runtime-x86-
${
PROCESS_UNIT
}
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++17"
)
set
(
TOP_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/../..
)
...
...
@@ -77,6 +78,8 @@ if (NOT PLATFORM_ARM64 AND NOT PLATFORM_ARM32)
set
(
CMAKE_SHARED_LINKER_FLAGS
"-Wl,-z,relro,-z,now -Wl,-z,noexecstack
${
CMAKE_SHARED_LINKER_FLAGS
}
"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-Wl,-z,relro,-z,now -Wl,-z,noexecstack
${
CMAKE_EXE_LINKER_FLAGS
}
"
)
string
(
REPLACE
" -g "
" "
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-fvisibility=hidden"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fvisibility=hidden"
)
endif
()
endif
()
...
...
mindspore/lite/nnacl/CMakeLists.txt
浏览文件 @
75813092
...
...
@@ -2,6 +2,42 @@ project(nnacl)
set
(
NNACL_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
TOP_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/..
)
set
(
SRC_DIR
${
TOP_DIR
}
/src
)
set
(
LITE_SRC
${
SRC_DIR
}
/common/graph_util.cc
${
SRC_DIR
}
/common/ms_tensor_utils.cc
${
SRC_DIR
}
/runtime/allocator.cc
${
SRC_DIR
}
/runtime/runtime_api.cc
${
SRC_DIR
}
/runtime/thread_pool.cc
${
SRC_DIR
}
/runtime/workspace_pool.cc
${
SRC_DIR
}
/ir/tensor.cc
${
SRC_DIR
}
/context.cc
${
SRC_DIR
}
/executor.cc
${
SRC_DIR
}
/kernel_registry.cc
${
SRC_DIR
}
/lite_kernel.cc
${
SRC_DIR
}
/populate_parameter.cc
${
SRC_DIR
}
/scheduler.cc
${
SRC_DIR
}
/lite_session.cc
${
SRC_DIR
}
/model.cc
)
if
(
SUPPORT_GPU
)
set
(
LITE_SRC
${
LITE_SRC
}
${
SRC_DIR
}
/runtime/kernel/opencl/subgraph_opencl_kernel.cc
${
SRC_DIR
}
/runtime/kernel/opencl/utils.cc
${
SRC_DIR
}
/runtime/opencl/opencl_executor.cc
${
SRC_DIR
}
/runtime/opencl/opencl_allocator.cc
${
SRC_DIR
}
/runtime/opencl/opencl_runtime.cc
${
SRC_DIR
}
/runtime/opencl/opencl_wrapper.cc
)
endif
()
set
(
ANF_SRC
${
ANF_SRC
}
${
SRC_DIR
}
/ir/meta_tensor_extends.cc
)
file
(
GLOB_RECURSE C_OPS_SRC
${
SRC_DIR
}
/ops/*.cc
)
include_directories
(
NNACL_DIR
)
########################### optimized files ###########################
...
...
@@ -25,11 +61,11 @@ if (PLATFORM_ARM64)
string
(
REPLACE
"-fvisibility=hidden"
"-fvisibility=default"
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-march=armv8.2-a+dotprod+fp16"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-march=armv8.2-a+dotprod+fp16"
)
add_library
(
optimize SHARED
${
OPTIMIZED_OPS
}
)
target_link_libraries
(
optimize
mindspore-lite
)
add_library
(
optimize SHARED
${
OPTIMIZED_OPS
}
${
LITE_SRC
}
${
ANF_SRC
}
${
C_OPS_SRC
}
)
add_library
(
cpu_kernel STATIC $<TARGET_OBJECTS:cpu_kernel_mid_>
)
target_link_libraries
(
optimize cpu_kernel
)
find_library
(
log-lib log
)
target_link_libraries
(
optimize
${
log-lib
}
)
set_target_properties
(
optimize PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
add_custom_command
(
TARGET optimize POST_BUILD
...
...
mindspore/lite/nnacl/fp16/reduce_fp16.c
浏览文件 @
75813092
...
...
@@ -18,7 +18,7 @@
#include "nnacl/fp16/reduce_fp16.h"
#include "nnacl/errorcode.h"
int
ReduceMean
(
const
int
outer_size
,
const
int
inner_size
,
const
int
axis_size
,
const
float16_t
*
src_data
,
int
ReduceMean
Fp16
(
const
int
outer_size
,
const
int
inner_size
,
const
int
axis_size
,
const
float16_t
*
src_data
,
const
int
*
src_shape
,
float16_t
*
dst_data
,
const
int
tid
,
const
int
thread_num
)
{
if
(
src_data
==
NULL
||
src_shape
==
NULL
||
dst_data
==
NULL
)
{
return
NNACL_NULL_PTR
;
...
...
mindspore/lite/nnacl/fp16/reduce_fp16.h
浏览文件 @
75813092
...
...
@@ -25,7 +25,7 @@
#ifdef __cplusplus
extern
"C"
{
#endif
int
ReduceMean
(
const
int
outer_size
,
const
int
inner_size
,
const
int
axis_size
,
const
float16_t
*
src_data
,
int
ReduceMean
Fp16
(
const
int
outer_size
,
const
int
inner_size
,
const
int
axis_size
,
const
float16_t
*
src_data
,
const
int
*
src_shape
,
float16_t
*
dst_data
,
const
int
tid
,
const
int
thread_num
);
#ifdef __cplusplus
...
...
mindspore/lite/nnacl/int8/reduce_int8.c
浏览文件 @
75813092
...
...
@@ -268,7 +268,7 @@ int ReduceMinLastAxis(const int outer_size, const int inner_size, const int axis
RoundingDivideByPOT
(
SaturatingRoundingDoublingHighMul
(
(
tmp
-
quant
->
in_zp_
)
*
(
1
<<
((
unsigned
int
)
quant
->
in_out_left_shift_
+
base_offset
)),
quant
->
in_out_multiplier_
),
quant
->
in_out_right_shift_
+
base_offset
);
quant
->
in_out_right_shift_
+
base_offset
);
if
(
isAddOverflow
(
tmp_scaled
,
quant
->
out_zp_
))
{
return
NNACL_ERRCODE_ADD_OVERFLOW
;
}
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_fp16.cc
浏览文件 @
75813092
...
...
@@ -333,7 +333,7 @@ int ArithmeticFP16CPUKernel::DoArithmetic(int task_id) {
return
RET_OK
;
}
int
ArithmeticsRun
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
ArithmeticsRun
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
arithmetic_kernel
=
reinterpret_cast
<
ArithmeticFP16CPUKernel
*>
(
cdata
);
auto
error_code
=
arithmetic_kernel
->
DoArithmetic
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_1x1_fp16.cc
浏览文件 @
75813092
...
...
@@ -170,7 +170,7 @@ int Convolution1x1FP16CPUKernel::RunImpl(int task_id) {
return
RET_OK
;
}
int
Convolution1x1Fp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
Convolution1x1Fp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
conv
=
reinterpret_cast
<
Convolution1x1FP16CPUKernel
*>
(
cdata
);
auto
error_code
=
conv
->
RunImpl
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_3x3_fp16.cc
浏览文件 @
75813092
...
...
@@ -197,7 +197,7 @@ int Convolution3x3FP16CPUKernel::RunImpl(int task_id) {
return
RET_OK
;
}
int
Convolution3x3Fp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
Convolution3x3Fp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
conv
=
reinterpret_cast
<
Convolution3x3FP16CPUKernel
*>
(
cdata
);
auto
error_code
=
conv
->
RunImpl
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_fp16.cc
浏览文件 @
75813092
...
...
@@ -150,7 +150,7 @@ int ConvolutionDepthwiseFp16CPUKernel::Execute(int task_id) {
return
RET_OK
;
}
int
ConvDwFp16Run
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
ConvDwFp16Run
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
conv_dw_fp16
=
reinterpret_cast
<
ConvolutionDepthwiseFp16CPUKernel
*>
(
cdata
);
auto
ret
=
conv_dw_fp16
->
Execute
(
task_id
);
if
(
ret
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc
浏览文件 @
75813092
...
...
@@ -177,7 +177,7 @@ int ConvolutionFP16CPUKernel::RunImpl(int task_id) {
return
RET_OK
;
}
int
ConvolutionFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
ConvolutionFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
conv
=
reinterpret_cast
<
ConvolutionFP16CPUKernel
*>
(
cdata
);
auto
error_code
=
conv
->
RunImpl
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_sw_fp16.cc
浏览文件 @
75813092
...
...
@@ -186,7 +186,7 @@ int ConvolutionSWFP16CPUKernel::RunImpl(int task_id) {
return
RET_OK
;
}
int
ConvolutionSWFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
ConvolutionSWFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
conv
=
reinterpret_cast
<
ConvolutionSWFP16CPUKernel
*>
(
cdata
);
auto
error_code
=
conv
->
RunImpl
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc
浏览文件 @
75813092
...
...
@@ -348,7 +348,7 @@ int ConvolutionWinogradFP16CPUKernel::RunImpl(int task_id) {
return
RET_OK
;
}
int
ConvolutionWinogradFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
ConvolutionWinogradFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
conv
=
reinterpret_cast
<
ConvolutionWinogradFP16CPUKernel
*>
(
cdata
);
auto
error_code
=
conv
->
RunImpl
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_depthwise_fp16.cc
浏览文件 @
75813092
...
...
@@ -157,7 +157,7 @@ int DeconvolutionDepthwiseFp16CPUKernel::Execute(int task_id) {
return
RET_OK
;
}
int
DeconvDwFp16Run
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
DeconvDwFp16Run
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
deconv_dw_fp16
=
reinterpret_cast
<
DeconvolutionDepthwiseFp16CPUKernel
*>
(
cdata
);
auto
ret
=
deconv_dw_fp16
->
Execute
(
task_id
);
if
(
ret
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_fp16.cc
浏览文件 @
75813092
...
...
@@ -137,7 +137,7 @@ void DeConvolutionFp16CPUKernel::FreeRunBuf() {
return
;
}
int
DeConvFp16Run
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
DeConvFp16Run
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
deconv
=
reinterpret_cast
<
DeConvolutionFp16CPUKernel
*>
(
cdata
);
auto
error_code
=
deconv
->
DoDeconv
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/pooling_fp16.cc
浏览文件 @
75813092
...
...
@@ -89,7 +89,7 @@ int PoolingFp16CPUKernel::RunImpl(int task_id) {
return
RET_OK
;
}
int
PoolingFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
PoolingFp16Impl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
pooling
=
reinterpret_cast
<
PoolingFp16CPUKernel
*>
(
cdata
);
auto
error_code
=
pooling
->
RunImpl
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/reduce_fp16.cc
浏览文件 @
75813092
...
...
@@ -49,7 +49,7 @@ int ReduceFp16CPUKernel::Init() {
MS_LOG
(
ERROR
)
<<
"Reduce fp16 only support ReduceMode_ReduceMean"
;
return
RET_ERROR
;
}
reducer_
=
ReduceMean
;
reducer_
=
ReduceMean
Fp16
;
if
(
!
InferShapeDone
())
{
return
RET_OK
;
...
...
@@ -67,7 +67,7 @@ int ReduceFp16CPUKernel::CallReduceUnit(int task_id) {
return
ret
;
}
int
ReduceImpl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
ReduceImpl
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
reduce
=
reinterpret_cast
<
ReduceFp16CPUKernel
*>
(
cdata
);
auto
error_code
=
reduce
->
CallReduceUnit
(
task_id
);
if
(
error_code
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/split_fp16.cc
浏览文件 @
75813092
...
...
@@ -63,7 +63,7 @@ int SplitFp16CPUKernel::Split(int task_id) {
return
RET_OK
;
}
int
SplitRun
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
SplitRun
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
g_kernel
=
reinterpret_cast
<
SplitFp16CPUKernel
*>
(
cdata
);
auto
ret
=
g_kernel
->
Split
(
task_id
);
if
(
ret
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp16/transpose_fp16.cc
浏览文件 @
75813092
...
...
@@ -121,7 +121,7 @@ int TransposeFp16CPUKernel::TransposeParallel(int task_id) {
return
RET_OK
;
}
int
TransposeRun
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
static
int
TransposeRun
(
int
task_id
,
LiteParallelGroupEnv
*
penv
,
void
*
cdata
)
{
auto
g_kernel
=
reinterpret_cast
<
TransposeFp16CPUKernel
*>
(
cdata
);
auto
ret
=
g_kernel
->
TransposeParallel
(
task_id
);
if
(
ret
!=
RET_OK
)
{
...
...
mindspore/lite/src/runtime/kernel/arm/fp32/unstack.cc
浏览文件 @
75813092
...
...
@@ -42,7 +42,7 @@ int UnstackCPUKernel::ReSize() {
if
(
para
->
axis_
<
0
)
{
para
->
axis_
+=
shape_size
;
}
for
(
size_t
i
=
0
;
i
<
s
tatic_cast
<
size_t
>
(
shape_size
)
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
s
hape_size
;
i
++
)
{
if
(
static_cast
<
int
>
(
i
)
<
para
->
axis_
)
{
para
->
pre_dims_
*=
input
->
DimensionSize
(
i
);
}
else
if
(
static_cast
<
int
>
(
i
)
>
para
->
axis_
)
{
...
...
mindspore/lite/test/CMakeLists.txt
浏览文件 @
75813092
...
...
@@ -8,8 +8,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/dependency_gtest.cmake)
string
(
REPLACE
" -Werror "
" "
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
"
)
string
(
REPLACE
" -Werror "
" "
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
STRING
(
REPLACE
" fvisibility=hidden "
" -fvisibility=default "
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
"
)
STRING
(
REPLACE
" fvisibility=hidden "
" -fvisibility=default "
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
STRING
(
REPLACE
"
-
fvisibility=hidden "
" -fvisibility=default "
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
"
)
STRING
(
REPLACE
"
-
fvisibility=hidden "
" -fvisibility=default "
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
### anf src
set
(
ANF_SRC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../core/ir/meta_tensor.cc
...
...
mindspore/lite/test/run_benchmark_nets.sh
浏览文件 @
75813092
...
...
@@ -9,8 +9,8 @@ function Run_x86() {
continue
fi
echo
${
model_name
}
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
convert-ubuntu'
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
convert-ubuntu
||
return
1
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
runtime-x86-'
${
process_unit_x86
}
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
runtime-x86-
${
process_unit_x86
}
||
return
1
echo
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib;./benchmark/benchmark --modelPath='
${
ms_models_path
}
'/'
${
model_name
}
'.ms --inDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'
${
model_name
}
'.ms.bin --calibDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'
${
model_name
}
'.ms.out --warmUpLoopCount=1 --loopCount=1'
||
return
1
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:./lib
;
./benchmark/benchmark
--modelPath
=
${
ms_models_path
}
/
${
model_name
}
.ms
--inDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/
${
model_name
}
.ms.bin
--calibDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/
${
model_name
}
.ms.out
--warmUpLoopCount
=
1
--loopCount
=
1
if
[
$?
=
0
]
;
then
...
...
@@ -30,8 +30,8 @@ function Run_x86() {
continue
fi
echo
${
model_name
}
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
convert-ubuntu'
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
convert-ubuntu
||
return
1
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
runtime-x86-'
${
process_unit_x86
}
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
runtime-x86-
${
process_unit_x86
}
||
return
1
echo
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib;./benchmark/benchmark --modelPath='
${
ms_models_path
}
'/'
${
model_name
}
'.ms --inDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'
${
model_name
}
'.ms.bin --calibDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'
${
model_name
}
'.ms.out --warmUpLoopCount=1 --loopCount=1'
||
return
1
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:./lib
;
./benchmark/benchmark
--modelPath
=
${
ms_models_path
}
/
${
model_name
}
.ms
--inDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/
${
model_name
}
.ms.bin
--calibDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/
${
model_name
}
.ms.out
--warmUpLoopCount
=
1
--loopCount
=
1
if
[
$?
=
0
]
;
then
...
...
@@ -51,8 +51,8 @@ function Run_x86() {
continue
fi
echo
${
model_name
}
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
convert-ubuntu'
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
convert-ubuntu
||
return
1
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
runtime-x86-'
${
process_unit_x86
}
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
runtime-x86-
${
process_unit_x86
}
||
return
1
echo
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib;./benchmark/benchmark --modelPath='
${
ms_models_path
}
'/'
${
model_name
}
'.ms --inDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'
${
model_name
}
'.ms.bin --calibDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'
${
model_name
}
'.ms.out --warmUpLoopCount=1 --loopCount=1'
||
return
1
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:./lib
;
./benchmark/benchmark
--modelPath
=
${
ms_models_path
}
/
${
model_name
}
.ms
--inDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/
${
model_name
}
.ms.bin
--calibDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/
${
model_name
}
.ms.out
--warmUpLoopCount
=
1
--loopCount
=
1
if
[
$?
=
0
]
;
then
...
...
@@ -72,8 +72,8 @@ function Run_x86() {
continue
fi
echo
${
model_name
}
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
convert-ubuntu'
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
convert-ubuntu
||
return
1
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
runtime-x86-'
${
process_unit_x86
}
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
runtime-x86-
${
process_unit_x86
}
||
return
1
echo
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib;./benchmark/benchmark --modelPath='
${
ms_models_path
}
'/'
${
model_name
}
'_posttraining.ms --inDataPath=/home/workspace/mindspore_dataset/mslite/quantTraining/mnist_calibration_data/00099.bin --calibDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'
${
model_name
}
'_posttraining.ms.out --warmUpLoopCount=1 --loopCount=1'
||
return
1
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:./lib
;
./benchmark/benchmark
--modelPath
=
${
ms_models_path
}
/
${
model_name
}
_posttraining.ms
--inDataPath
=
/home/workspace/mindspore_dataset/mslite/quantTraining/mnist_calibration_data/00099.bin
--calibDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/
${
model_name
}
_posttraining.ms.out
--warmUpLoopCount
=
1
--loopCount
=
1
if
[
$?
=
0
]
;
then
...
...
@@ -93,8 +93,8 @@ function Run_x86() {
continue
fi
echo
${
model_name
}
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
convert-ubuntu'
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
convert-ubuntu
||
return
1
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
runtime-x86-'
${
process_unit_x86
}
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
runtime-x86-
${
process_unit_x86
}
||
return
1
echo
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib;./benchmark/benchmark --modelPath='
${
ms_models_path
}
'/'
${
model_name
}
'.ms --inDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/${model_name}.ms.bin --calibDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'
${
model_name
}
'.ms.out --warmUpLoopCount=1 --loopCount=1 --numThreads=1'
||
return
1
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:./lib
;
./benchmark/benchmark
--modelPath
=
${
ms_models_path
}
/
${
model_name
}
.ms
--inDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/
${
model_name
}
.ms.bin
--calibDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/
${
model_name
}
.ms.out
--warmUpLoopCount
=
1
--loopCount
=
1
--numThreads
=
1
if
[
$?
=
0
]
;
then
...
...
@@ -114,8 +114,8 @@ function Run_x86() {
continue
fi
echo
${
model_name
}
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
convert-ubuntu'
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
convert-ubuntu
||
return
1
echo
'cd '
${
convertor_path
}
'/mindspore-lite-'
${
version
}
'-
runtime-x86-'
${
process_unit_x86
}
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-
runtime-x86-
${
process_unit_x86
}
||
return
1
echo
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib;./benchmark/benchmark --modelPath='
${
ms_models_path
}
'/'
${
model_name
}
'.ms --inDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/'
${
model_name
}
'.ms.bin --calibDataPath=/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/'
${
model_name
}
'.ms.out --warmUpLoopCount=1 --loopCount=1'
||
return
1
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:./lib
;
./benchmark/benchmark
--modelPath
=
${
ms_models_path
}
/
${
model_name
}
.ms
--inDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/input/
${
model_name
}
.ms.bin
--calibDataPath
=
/home/workspace/mindspore_dataset/mslite/models/hiai/input_output/output/
${
model_name
}
.ms.out
--warmUpLoopCount
=
1
--loopCount
=
1
--accuracyThreshold
=
1.5
if
[
$?
=
0
]
;
then
...
...
@@ -323,15 +323,23 @@ file_name=$(ls ${arm_path}/*runtime-arm64*.tar.gz)
IFS
=
"-"
read
-r
-a
file_name_array
<<<
"
$file_name
"
version
=
${
file_name_array
[2]
}
IFS
=
"."
read
-r
-a
suffix
<<<
"
${
file_name_array
[-1]
}
"
process_unit
=
${
suffix
[0]
}
process_unit_arm
=
${
suffix
[0]
}
file_name
=
$(
ls
${
convertor_path
}
/
*
runtime-x86
*
.tar.gz
)
IFS
=
"-"
read
-r
-a
file_name_array
<<<
"
$file_name
"
IFS
=
"."
read
-r
-a
suffix
<<<
"
${
file_name_array
[-1]
}
"
process_unit_x86
=
${
suffix
[0]
}
# Unzip arm
cd
${
arm_path
}
||
exit
1
mkdir
mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
}
tar
-zxf
mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
}
.tar.gz
-C
mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
}
--strip-components
1
||
exit
1
mkdir
mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
_arm
}
tar
-zxf
mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
_arm
}
.tar.gz
-C
mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit_arm
}
--strip-components
1
||
exit
1
# Unzip convertor
# Unzip
x86 runtime and
convertor
cd
${
convertor_path
}
||
exit
1
mkdir
mindspore-lite-
${
version
}
-runtime-x86-
${
process_unit_x86
}
tar
-zxf
mindspore-lite-
${
version
}
-runtime-x86-
${
process_unit_x86
}
.tar.gz
-C
mindspore-lite-
${
version
}
-runtime-x86-
${
process_unit_x86
}
--strip-components
1
||
exit
1
mkdir
mindspore-lite-
${
version
}
-convert-ubuntu
tar
-zxf
mindspore-lite-
${
version
}
-convert-ubuntu
.tar.gz
-C
mindspore-lite-
${
version
}
-convert-ubuntu
--strip-components
1
||
exit
1
cd
${
convertor_path
}
/mindspore-lite-
${
version
}
-convert-ubuntu
||
exit
1
...
...
@@ -439,9 +447,9 @@ rm -rf ${basepath}/benchmark_test
mkdir
-p
${
basepath
}
/benchmark_test
benchmark_test_path
=
${
basepath
}
/benchmark_test
cd
${
benchmark_test_path
}
||
exit
1
cp
-a
${
arm_path
}
/mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
}
/lib/libmindspore-lite.so
${
benchmark_test_path
}
/libmindspore-lite.so
||
exit
1
cp
-a
${
arm_path
}
/mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
}
/lib/liboptimize.so
${
benchmark_test_path
}
/liboptimize.so
||
exit
1
cp
-a
${
arm_path
}
/mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
}
/benchmark/benchmark
${
benchmark_test_path
}
/benchmark
||
exit
1
cp
-a
${
arm_path
}
/mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
_arm
}
/lib/libmindspore-lite.so
${
benchmark_test_path
}
/libmindspore-lite.so
||
exit
1
cp
-a
${
arm_path
}
/mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
_arm
}
/lib/liboptimize.so
${
benchmark_test_path
}
/liboptimize.so
||
exit
1
cp
-a
${
arm_path
}
/mindspore-lite-
${
version
}
-runtime-arm64-
${
process_unit
_arm
}
/benchmark/benchmark
${
benchmark_test_path
}
/benchmark
||
exit
1
# Copy the MindSpore models:
cp
-a
${
ms_models_path
}
/
*
.ms
${
benchmark_test_path
}
||
exit
1
...
...
mindspore/lite/tools/benchmark/CMakeLists.txt
浏览文件 @
75813092
...
...
@@ -15,6 +15,10 @@ if (PLATFORM_ARM32 OR PLATFORM_ARM64)
else
()
target_link_libraries
(
benchmark mindspore-lite pthread
)
endif
()
install
(
TARGETS benchmark
RUNTIME DESTINATION
${
MAIN_DIR
}
/benchmark COMPONENT
${
COMPONENT_NAME
}
)
\ No newline at end of file
if
(
PLATFORM_ARM32 OR PLATFORM_ARM64
)
install
(
TARGETS benchmark
RUNTIME DESTINATION
${
MAIN_DIR
}
/benchmark COMPONENT
${
COMPONENT_NAME
}
)
else
()
install
(
TARGETS benchmark
RUNTIME DESTINATION
${
MAIN_DIR
}
/benchmark COMPONENT
${
RUN_X86_COMPONENT_NAME
}
)
endif
()
mindspore/lite/tools/converter/CMakeLists.txt
浏览文件 @
75813092
...
...
@@ -185,7 +185,7 @@ target_link_libraries(converter_lite PRIVATE
mindspore::eigen
)
if
(
NOT PLATFORM_
arm64 AND NOT PLATFORM_arm
32
)
if
(
NOT PLATFORM_
ARM64 AND NOT PLATFORM_ARM
32
)
install
(
TARGETS converter_lite
RUNTIME DESTINATION
${
MAIN_DIR
}
/converter COMPONENT
${
COMPONENT_NAME
}
)
endif
()
mindspore/lite/tools/converter/quantizer/quantize_util.cc
浏览文件 @
75813092
...
...
@@ -373,7 +373,7 @@ STATUS QuantFilter(ParamValueLitePtr weight, std::shared_ptr<PrimitiveC> primiti
float
min
=
FLT_MAX
;
float
max
=
-
FLT_MAX
;
// find min and max
for
(
uint32
_t
j
=
0
;
j
<
one_filter_size
;
j
++
)
{
for
(
size
_t
j
=
0
;
j
<
one_filter_size
;
j
++
)
{
auto
index
=
j
+
i
*
one_filter_size
;
if
(
index
>=
elem_count
)
{
MS_LOG
(
ERROR
)
<<
"over flow!"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录