Skip to content

Commit 87465ef

Browse files
authored
[PHI] Fix fast_ln_fwd_kernel for big tensor (#73252)
1 parent 079053a commit 87465ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

paddle/phi/kernels/funcs/layer_norm_impl.cu.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ __global__ __launch_bounds__(THREADS_PER_CTA) void fast_ln_fwd_kernel(
233233
#pragma unroll
234234
for (int it = 0, col = c; it < LDGS; it++) {
235235
if (col < cols) {
236-
phi::Load<T, VecSize>(x_ptr + row * ELTS_PER_ROW + col * VecSize,
237-
&x[it]);
236+
phi::Load<T, VecSize>(
237+
x_ptr + static_cast<int64_t>(row) * ELTS_PER_ROW + col * VecSize,
238+
&x[it]);
238239
} else {
239240
x[it] = Vec{};
240241
}
@@ -344,8 +345,9 @@ __global__ __launch_bounds__(THREADS_PER_CTA) void fast_ln_fwd_kernel(
344345
#pragma unroll
345346
for (int it = 0, col = c; it < LDGS; it++) {
346347
if (col < cols) {
347-
phi::Store<T, VecSize>(x[it],
348-
y_ptr + row * ELTS_PER_ROW + col * VecSize);
348+
phi::Store<T, VecSize>(
349+
x[it],
350+
y_ptr + static_cast<int64_t>(row) * ELTS_PER_ROW + col * VecSize);
349351
}
350352
col += THREADS_PER_ROW;
351353
}

0 commit comments

Comments
 (0)