Skip to content

Commit c5fc8e0

Browse files
committed
cleanup unnecessary macros in convolution ocl kernel
Signed-off-by: Li Peng <peng.li@intel.com>
1 parent 0aa5e43 commit c5fc8e0

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

modules/dnn/src/ocl4dnn/src/ocl4dnn_conv_spatial.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,7 @@ void OCL4DNNConvSpatial<Dtype>::setupKernelDetails(int32_t kernelType,
257257
addDef("INPUT_DEPTH", channels_ / group_);
258258
addDef("TOTAL_INPUT_DEPTH_SIZE", channels_);
259259
addDef("TOTAL_OUTPUT_DEPTH", num_output_);
260-
addDef("INPUT_START_X", 0);
261-
addDef("INPUT_START_Y", 0);
262-
addDef("INPUT_START_Z", 0);
263260
addDef("NUM_FILTERS", M_);
264-
addDef("OUT_BUFF_OFFSET", 0);
265261
addDef("TILE_X", tile_x);
266262
addDef("TILE_Y", tile_y);
267263
addDef("TILE_Y_STRIDE", tile_y_stride);

modules/dnn/src/opencl/conv_layer_spatial.cl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,8 @@ __kernel void ConvolveBasic(
189189
// NDRange: (output_width+pad)/ OUT_BLOCK_WIDTH, (output_height+pad)/OUT_BLOCK_HEIGHT, NUM_FILTERS/OUT_BLOCK_DEPTH
190190

191191
// NOTE: for beignet this reqd_work_group_size does not guarantee that SIMD16 mode will be used, the compiler could choose to use two SIMD8 threads, and if that happens the code will break.
192-
#ifndef __BEIGNET__
193192
__attribute__((reqd_work_group_size(1, 1, SIMD_SIZE)))
194193
__attribute__((intel_reqd_sub_group_size(SIMD_SIZE)))
195-
#endif
196194
__kernel void
197195
convolve_simd(
198196
ELTWISE_DATA_ARG
@@ -232,12 +230,12 @@ convolve_simd(
232230

233231
int curr_local_y = ( lid / ( TILE_X / 4 ) );
234232
int curr_local_x = ( lid % ( TILE_X / 4 ) ) * 4;
235-
int curr_y = or * STRIDE_Y + INPUT_START_Y + curr_local_y;
236-
int curr_x = oc * STRIDE_X + INPUT_START_X + curr_local_x;
233+
int curr_y = or * STRIDE_Y + curr_local_y;
234+
int curr_x = oc * STRIDE_X + curr_local_x;
237235
#if INPUT_PAD_W != 0 || INPUT_PAD_H != 0
238236
int saved_y = curr_y;
239237
#endif
240-
in_addr = input_batch_offset + INPUT_START_Z * input_height * input_width
238+
in_addr = input_batch_offset
241239
+ (curr_y - INPUT_PAD_H) * input_width // y tile offset
242240
+ curr_x - INPUT_PAD_W; // x tile offset
243241
union {
@@ -363,7 +361,7 @@ convolve_simd(
363361
fm = fm % ALIGNED_NUM_FILTERS;
364362

365363
if ((ALIGNED_NUM_FILTERS == NUM_FILTERS || fm < NUM_FILTERS)) {
366-
unsigned int out_addr = OUT_BUFF_OFFSET + ( num_in_batch * TOTAL_OUTPUT_DEPTH + fm ) * output_width * output_height;
364+
unsigned int out_addr = ( num_in_batch * TOTAL_OUTPUT_DEPTH + fm ) * output_width * output_height;
367365
out_addr += or * output_width + oc;
368366
// we need this address calculation for biases because we support views and batching
369367
#if APPLY_BIAS

0 commit comments

Comments
 (0)