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

add maximum limit for grid of index_select #41127

Merged
merged 10 commits into from
Apr 3, 2022

Conversation

FlyingQianMM
Copy link
Contributor

PR types

Bug fixes

PR changes

OPs

Describe

The grid number of index_select has not been limited, which may raise a bug like:

:parallel_for failed: cudaErrorInvalidConfiguration: invalid configuration argument. 

So we add a maximum limit for grid of index_select kernel.

@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.

@@ -21,6 +21,15 @@

namespace phi {

namespace {
template <typename Context>
void LimitGridDim(const Context& ctx, unsigned int* grid_dim) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这个函数是不是可以抽取出来,放在公共的文件中,不用每个算子都再定义一次?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经挪动至paddle/fluid/platform/device/gpu/gpu_launch_config.h中。

ZzSean
ZzSean previously approved these changes Mar 30, 2022
Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

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

LGTM

stream>>>(in_grad_data, numel);
int block_dim = 256;
dim3 grid_dim =
dim3((numel + PADDLE_CUDA_NUM_THREADS - 1) / PADDLE_CUDA_NUM_THREADS);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里block和grid的设置没有对应上,设置了block dim为256,grid就应该向上对齐block_dimPADDLE_CUDA_NUM_THREADS是512

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经修改,感谢!

ZzSean
ZzSean previously approved these changes Apr 1, 2022
Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

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

LGTM for op benchmark

@FlyingQianMM FlyingQianMM merged commit af8d248 into PaddlePaddle:develop Apr 3, 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.

3 participants