Skip to content

Commit 28605ee

Browse files
authored
[cherry-pick][OpenCL] Fix greater_than & eltwise_mul bug (#6534)
1 parent b0f5b71 commit 28605ee

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

lite/backends/opencl/cl_kernel/image/elementwise_mul_kernel.cl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ limitations under the License. */
1414

1515
#include <cl_common.h>
1616

17-
__kernel void elementwise_mul(__global image2d_t input,
18-
__global image2d_t bias,
17+
__kernel void elementwise_mul(__read_only image2d_t input,
18+
__read_only image2d_t bias,
1919
__write_only image2d_t outputImage) {
2020
int x = get_global_id(0);
2121
int y = get_global_id(1);
@@ -36,8 +36,8 @@ __kernel void elementwise_mul(__global image2d_t input,
3636
WRITE_IMG_TYPE(CL_DTYPE_CHAR, outputImage, coords, output);
3737
}
3838

39-
__kernel void channel_mul(__global image2d_t input,
40-
__global image2d_t bias,
39+
__kernel void channel_mul(__read_only image2d_t input,
40+
__read_only image2d_t bias,
4141
__write_only image2d_t outputImage,
4242
int w) {
4343
int x = get_global_id(0);
@@ -87,8 +87,8 @@ __kernel void channel_mul_d1(__read_only image2d_t input,
8787

8888
// etc : 1 1 1 72
8989
// run time Y [value,0,0,0] * 72
90-
__kernel void channel_mul_d2(__global image2d_t input,
91-
__global image2d_t bias,
90+
__kernel void channel_mul_d2(__read_only image2d_t input,
91+
__read_only image2d_t bias,
9292
__write_only image2d_t outputImage,
9393
int w) {
9494
int x = get_global_id(0);
@@ -152,8 +152,8 @@ __kernel void channel_mul_d2(__global image2d_t input,
152152
}
153153

154154
// c 1 1
155-
__kernel void channel_mul_d3(__global image2d_t input,
156-
__global image2d_t bias,
155+
__kernel void channel_mul_d3(__read_only image2d_t input,
156+
__read_only image2d_t bias,
157157
__write_only image2d_t outputImage,
158158
int w) {
159159
int x = get_global_id(0);
@@ -179,9 +179,10 @@ __kernel void channel_mul_d3(__global image2d_t input,
179179
WRITE_IMG_TYPE(CL_DTYPE_CHAR, outputImage, coords, output);
180180
}
181181

182-
__kernel void channel_mul_d4(__global image2d_t input,
183-
__global image2d_t bias,
184-
__write_only image2d_t outputImage, int w) {
182+
__kernel void channel_mul_d4(__read_only image2d_t input,
183+
__read_only image2d_t bias,
184+
__write_only image2d_t outputImage,
185+
int w) {
185186
int x = get_global_id(0);
186187
int y = get_global_id(1);
187188

lite/kernels/host/compare_compute.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ void CompareCompute<PType, CompareFunctor>::Run() {
198198
axis = x_dims.size();
199199
}
200200
int outer_num, mid_num, inner_num;
201-
int is_run_common_broadcast, axis_trim = 0;
201+
int is_run_common_broadcast = 0;
202+
int axis_trim = 0;
202203
auto y_dims_trimed = trim_trailing_singular_dims(y_dims);
203204
axis_trim = (y_dims_trimed.size() == 0) ? x_dims.size() : axis;
204205
get_mid_dims(x_dims,

0 commit comments

Comments
 (0)