Skip to content

Commit 42dd5da

Browse files
author
Markus Kliegl
committed
conv shift: fix return before syncthreads
1 parent 3dc8834 commit 42dd5da

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

paddle/operators/conv_shift_op.cu

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ __global__ void ConvShiftForward(const T *x, const T *y, T *out, int x_width,
6262
if (tx < num_x) {
6363
int load_i = (i - y_half_width + x_width) % x_width;
6464
sx[tx] = x[k * x_width + load_i];
65-
} else {
66-
return;
6765
}
6866
__syncthreads();
6967

70-
// Compute dot product of sx[tx:tx + y_width] and sy.
71-
T sum = 0;
72-
for (int j = 0; j < y_width; ++j) {
73-
sum += sx[tx + j] * sy[j];
74-
}
68+
if (tx < num_x) {
69+
// Compute dot product of sx[tx:tx + y_width] and sy.
70+
T sum = 0;
71+
for (int j = 0; j < y_width; ++j) {
72+
sum += sx[tx + j] * sy[j];
73+
}
7574

76-
// Save to out[k, i].
77-
out[k * x_width + i] = sum;
75+
// Save to out[k, i].
76+
out[k * x_width + i] = sum;
77+
}
7878
}
7979

8080
// Compute x gradient - initial naive implementation with atomic add.

0 commit comments

Comments
 (0)