Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the cumsum bug for large size #43722

Merged
merged 1 commit into from
Jun 22, 2022
Merged

Conversation

wawltor
Copy link
Contributor

@wawltor wawltor commented Jun 21, 2022

PR types

Function optimization

PR changes

OPs

Describe

fix the cumsum bug for large size.
problem: In the cumsum kernel used the two dims block to cumsum the input tensor, but the max of thread in the dim of block.y is 65535, in some case the dim of block.y exceed 65535, the computation of the kernel will be shutdown.

solution: Use the 1 dim of block to compute.

import numpy as np
import paddle

#  Small shape Tensor,  the result is correct 
x = np.random.randn(2, 128, 128)

x_paddle = paddle.to_tensor(x.copy(), stop_gradient=False)
print('paddle cumsum; ', x_paddle.cumsum(0).abs().sum().numpy())

# Big shape Tensor, the result is error 
x = np.random.randn(2, 1280, 1280)
x_paddle = paddle.to_tensor(x.copy(), stop_gradient=False)
print('paddle cumsum; ', x_paddle.cumsum(0).abs().sum().numpy())

@paddle-bot-old
Copy link

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@joey12300 joey12300 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wawltor wawltor merged commit 4b3e8d5 into PaddlePaddle:develop Jun 22, 2022
sneaxiy pushed a commit to sneaxiy/Paddle that referenced this pull request Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants