Browse Source

!8101 [MS][LITE][Develop] modify CI cppcheck warning

Merge pull request !8101 from pengyongrong/stack
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
29697187e2
5 changed files with 7 additions and 13 deletions
  1. +1
    -1
      mindspore/lite/src/runtime/kernel/opencl/cl/activation.cl
  2. +3
    -6
      mindspore/lite/src/runtime/kernel/opencl/cl/convolution.cl
  3. +0
    -3
      mindspore/lite/src/runtime/kernel/opencl/cl/reshape.cl
  4. +2
    -2
      mindspore/lite/src/runtime/kernel/opencl/kernel/softmax.cc
  5. +1
    -1
      mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h

+ 1
- 1
mindspore/lite/src/runtime/kernel/opencl/cl/activation.cl View File

@@ -39,7 +39,7 @@ __kernel void Sigmoid(__read_only image2d_t input, __write_only image2d_t output
const int last_c4) {
int X = get_global_id(0);
int Y = get_global_id(1);
if (X >= img_shape.x || Y >= img_shape.y) return;
if (X >= img_shape.x || Y >= img_shape.y || c4 == 0) return;
int C4 = X % c4;
FLT4 in_c4 = READ_IMAGE(input, smp_zero, (int2)(X, Y));
if (C4 < c4 - 1) {


+ 3
- 6
mindspore/lite/src/runtime/kernel/opencl/cl/convolution.cl View File

@@ -30,9 +30,7 @@ __kernel void Convolution(__read_only image2d_t input, __write_only image2d_t ou
const int strideW = kernel_stride.w;

const int padTop = pad.x;
const int padBottom = pad.y;
const int padLeft = pad.z;
const int padRight = pad.w;

const int dilationH = dilation.x;
const int dilationW = dilation.y;
@@ -74,7 +72,7 @@ __kernel void Convolution(__read_only image2d_t input, __write_only image2d_t ou
}
}

if (bias) {
if (bias != 0) {
out_c4 = out_c4 + bias[co_slice];
}

@@ -116,7 +114,7 @@ __kernel void Winograd4x4To36(__read_only image2d_t input, __write_only image2d_
return;
}

int IH = input_shape.y, IW = input_shape.z;
int IW = input_shape.z;
int TILE_X = UP_DIV(IW, 4);
int tile_x = tile_xy % TILE_X;
int tile_y = tile_xy / TILE_X;
@@ -229,7 +227,6 @@ __kernel void Winograd36To4x4(__read_only image2d_t input, __write_only image2d_

int TILE_XY = input_shape.z;
int SLICES = input_shape.w;
int OH = output_shape.y;
int OW = output_shape.z;

if (tile_xy >= TILE_XY || row >= 4 || slice >= SLICES) {
@@ -257,7 +254,7 @@ __kernel void Winograd36To4x4(__read_only image2d_t input, __write_only image2d_
acc += AtM_row[y] * At[idx];
}

if (bias) {
if (bias != 0) {
acc += bias[slice];
}



+ 0
- 3
mindspore/lite/src/runtime/kernel/opencl/cl/reshape.cl View File

@@ -51,13 +51,10 @@ __kernel void reshape_NC4HW4(__read_only image2d_t src_data, __write_only image2
int4 dst_size) {
int X = get_global_id(0);
int Y = get_global_id(1);
int CO4 = UP_DIV(dst_size.z, C4NUM);
int CO4_rem = dst_size.z % C4NUM;
if (X >= dst_size.x || Y > dst_size.y) {
return;
}
int CI4 = UP_DIV(src_size.x, C4NUM);
int CI4_rem = src_size.x % C4NUM;
int in_img_x = CI4 * src_size.y;
int gcnt = X + dst_size.x * Y;
WRITE_IMAGE(dst_data, (int2)(X, Y), READ_IMAGE(src_data, smp_zero, (int2)(gcnt % in_img_x, gcnt / in_img_x)));


+ 2
- 2
mindspore/lite/src/runtime/kernel/opencl/kernel/softmax.cc View File

@@ -43,8 +43,8 @@ std::vector<float> SoftmaxOpenCLKernel::GetMaskForLastChannel(int channels) {
}

int SoftmaxOpenCLKernel::InitGlobalSize() {
size_t global_x, global_y, global_z;
global_z = 1;
size_t global_x, global_y;
const size_t global_z = 1;
if (axis_ == 1) {
global_x = UP_DIV(nhwc_shape_[3], C4NUM);
global_y = nhwc_shape_[2];


+ 1
- 1
mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h View File

@@ -38,7 +38,7 @@ struct OpenCLToFormatParameter {

struct Image2DInfo {
explicit Image2DInfo(const lite::Tensor *tensor) {
if (tensor) {
if (tensor != nullptr) {
auto shape = tensor->shape();
if (shape.size() == 1) {
N = shape[0];


Loading…
Cancel
Save