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

[cherry-pick] fix the cumsum big shape and random result bug #43777

Merged
merged 1 commit into from
Jun 24, 2022

Conversation

wawltor
Copy link
Contributor

@wawltor wawltor commented Jun 23, 2022

PR types

Bug fixes

PR changes

OPs

Describe

fix the cumsum big shape and random result bug, cherry-pick from the #43101 #43722

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())

@wawltor wawltor closed this Jun 23, 2022
@wawltor wawltor reopened this Jun 23, 2022
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Jun 23, 2022
@PaddlePaddle PaddlePaddle unlocked this conversation Jun 23, 2022
Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

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

LGTM

@XiaoguangHu01 XiaoguangHu01 merged commit edff59b into PaddlePaddle:release/2.3 Jun 24, 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.

None yet

3 participants