From: @yeyunpeng2020 Reviewed-by: @ddwsky,@ddwsky Signed-off-by: @ddwsky,@ddwskypull/14357/MERGE
| @@ -25,7 +25,7 @@ | |||||
| #include "include/lite_session.h" | #include "include/lite_session.h" | ||||
| std::string RealPath(const char *path) { | std::string RealPath(const char *path) { | ||||
| size_t max = 4096; | |||||
| const size_t max = 4096; | |||||
| if (path == nullptr) { | if (path == nullptr) { | ||||
| std::cerr << "path is nullptr" << std::endl; | std::cerr << "path is nullptr" << std::endl; | ||||
| return ""; | return ""; | ||||
| @@ -27,7 +27,7 @@ | |||||
| #include "include/version.h" | #include "include/version.h" | ||||
| std::string RealPath(const char *path) { | std::string RealPath(const char *path) { | ||||
| size_t max = 4096; | |||||
| const size_t max = 4096; | |||||
| if (path == nullptr) { | if (path == nullptr) { | ||||
| std::cerr << "path is nullptr" << std::endl; | std::cerr << "path is nullptr" << std::endl; | ||||
| return ""; | return ""; | ||||
| @@ -553,7 +553,6 @@ int RunWithSharedMemoryPool(const char *model_path) { | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| auto session1 = mindspore::session::LiteSession::CreateSession(context1.get()); | auto session1 = mindspore::session::LiteSession::CreateSession(context1.get()); | ||||
| if (session1 == nullptr) { | if (session1 == nullptr) { | ||||
| delete model; | delete model; | ||||
| std::cerr << "CreateSession failed while running." << std::endl; | std::cerr << "CreateSession failed while running." << std::endl; | ||||
| @@ -44,7 +44,7 @@ __kernel void MatMul_BUF_Add_Sub_2(__global FLT4 *input, __global FLT4 *output, | |||||
| return; | return; | ||||
| } | } | ||||
| int ci_co_4 = shape.w; | int ci_co_4 = shape.w; | ||||
| int origin_shape = 2 * ci_co_4; | |||||
| const int origin_shape = 2 * ci_co_4; | |||||
| int index_1 = (gidx + offset.x) * origin_shape + gidy + offset.y; | int index_1 = (gidx + offset.x) * origin_shape + gidy + offset.y; | ||||
| int index_2 = (gidx + offset.z) * origin_shape + gidy + offset.w; | int index_2 = (gidx + offset.z) * origin_shape + gidy + offset.w; | ||||
| FLT4 result1 = input[index_1]; | FLT4 result1 = input[index_1]; | ||||
| @@ -121,7 +121,7 @@ __kernel void MatMul_BUF_Filled(__global FLT4 *input, __global FLT4 *output, int | |||||
| } | } | ||||
| int stride_out = shape.z * shape.w; | int stride_out = shape.z * shape.w; | ||||
| int index_out = gidx * stride_out + gidy; | int index_out = gidx * stride_out + gidy; | ||||
| int stride_origin = 2 * stride_out; | |||||
| const int stride_origin = 2 * stride_out; | |||||
| int index_in = (gidx + offset.x) * stride_origin + gidy + offset.y; | int index_in = (gidx + offset.x) * stride_origin + gidy + offset.y; | ||||
| FLT4 result = input[index_in]; | FLT4 result = input[index_in]; | ||||
| output[index_out] = result; | output[index_out] = result; | ||||
| @@ -500,7 +500,7 @@ kernel::LiteKernel *OpenCLConv2DCreator(const std::vector<lite::Tensor *> &input | |||||
| } | } | ||||
| // case 3: common conv2d | // case 3: common conv2d | ||||
| kernel::OpenCLKernel *kernel; | |||||
| kernel::OpenCLKernel *kernel = nullptr; | |||||
| bool infer_shape_done = opParameter->infer_flag_; | bool infer_shape_done = opParameter->infer_flag_; | ||||
| if (infer_shape_done && UseFcReplaceConv(inputs, outputs, conv_param)) { | if (infer_shape_done && UseFcReplaceConv(inputs, outputs, conv_param)) { | ||||
| auto *fc_param = CreateFcParam(conv_param, inputs); | auto *fc_param = CreateFcParam(conv_param, inputs); | ||||
| @@ -226,7 +226,7 @@ int MatMulOpenCLKernel::Run() { | |||||
| kernel::LiteKernel *OpenCLMatMulKernelCreator(const std::vector<lite::Tensor *> &inputs, | kernel::LiteKernel *OpenCLMatMulKernelCreator(const std::vector<lite::Tensor *> &inputs, | ||||
| const std::vector<lite::Tensor *> &outputs, OpParameter *opParameter, | const std::vector<lite::Tensor *> &outputs, OpParameter *opParameter, | ||||
| const lite::InnerContext *ctx, const kernel::KernelKey &desc) { | const lite::InnerContext *ctx, const kernel::KernelKey &desc) { | ||||
| kernel::OpenCLKernel *kernel; | |||||
| kernel::OpenCLKernel *kernel = nullptr; | |||||
| bool infer_shape_done = opParameter->infer_flag_; | bool infer_shape_done = opParameter->infer_flag_; | ||||
| if (infer_shape_done && IsUseStrassenMatmul(inputs)) { | if (infer_shape_done && IsUseStrassenMatmul(inputs)) { | ||||
| MS_LOG(DEBUG) << "use_matmul_strassen"; | MS_LOG(DEBUG) << "use_matmul_strassen"; | ||||